|
What's the preferred way to add an event -> ICommand mapping from within a style. I know I can do this use the i:interaction stuff *IF* I'm re-templating. In my case, I do not want to re-template. I just want to add an event handler through the style (because the base style must remain generic). There is no "root" UIElement to add to either. Specifically, I'm trying to handle an event thats coming from the TreeViewItem in my VM. I template the TreeViewItem in my UI Library, but I can't have app specific stuff in there. Don't want to copy the styles over because they are quite large and they really need to remain in the UI library so I don't have to maintain 2 copies.
I've seen some mention of attached behaviors, but it seems like you can only add a single attached command through a style??
|
|
|
|
|
whats the event that you want to handle?
is it selection event?
if it is, then you dont have to goto style for this
<TreeView ......>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectedItemChanged">
<i:InvokeCommandAction CommandName="ItemSelected" Command="{Binding ItemSelectedCommand}" CommandParameter="{Binding SelectedItem, ElementName=default}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</TreeView>
|
|
|
|