locked
Can handlers of controls be styled?

    Question

  • For example, if I want all TextBlock controls use TextBlock_PointerEntered as the event handler for the pointer entered event, can TextBlock_PointerEntered but put in the the style block for TextBlock?

    Hong

    Sunday, June 08, 2014 1:48 AM

Answers

  • Styles allow bundling sets of Properties, not events.

    Can you explain the scenario you're trying to achieve?

    --Rob

    Monday, June 09, 2014 1:41 AM
    Owner

All replies

  • Styles allow bundling sets of Properties, not events.

    Can you explain the scenario you're trying to achieve?

    --Rob

    Monday, June 09, 2014 1:41 AM
    Owner
  • Thanks for the clarification, Rob.

    For the case I am dealing with now, I want all TextBlocks of a user control to have the same handlers for tap, pointer entered and pointer exited.

    I am using Segoe UI Symbols to make a rating control for a universal portable library because I have not been able to find one.


    Hong

    Monday, June 09, 2014 1:55 AM
  • Two options would be to create a subclass of the TextBlock with the handlers included or to loop through and add the handlers programmatically.
    Tuesday, June 10, 2014 10:48 PM
    Owner