0

I've got a few DataTriggers in a Style. Most just change some style properties. I would like a new one to call a method.

                        <DataTrigger Binding="{Binding ValueChanged}" Value="True">
                    <Setter CallThis="MyFunction"> </Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </ContentControl.Style>
</ContentControl>

So when ValueChanged is true, MyFunction should get called. Is there a proper way to accomplish this?

Boumbles
  • 2,473
  • 3
  • 24
  • 42
  • Care to offer a bit more insight on what you want the end result to be? What would the method do, and what purpose is this control serving? I'm curious if the resulting action would mainly involve the view or viewmodel. If the control in question was something like a `CheckBox`, it would have a `Command` that would be executed when the user changed the value. Other scenarios might require something more exotic like "EventToCommand" or hooking up event handlers in `OnApplyTemplate`. For what it's worth, triggers have `EnterActions` but they mostly interact with storyboards. – Guttsy Feb 25 '16 at 06:06
  • Can you post full of your `ContentControl` XAML? Fear we do a copyright abuse :)? – NoName Feb 25 '16 at 10:57
  • @Guttsy the desired end result is actually related to my [other question](http://stackoverflow.com/questions/35560621/automatically-resize-columns-of-wpf-gridview) I am just attempting a different approach here. – Boumbles Feb 25 '16 at 13:26
  • @Sakura I'll see if I can trim down the code to avoid getting my wrist slapped for posting code. – Boumbles Feb 25 '16 at 13:26

0 Answers0