-
- colin14321
- Posts: 12
- Joined:
EventSetter in Style
Hi there,
I was wondering if there is support for System.Windows.EventSetter?
I am currently trying to have an EventSetter inside of a Style. If EventSetter is not available, is there another simple way to do this inside of a style?
Code snippet:
Thank you!
I was wondering if there is support for System.Windows.EventSetter?
I am currently trying to have an EventSetter inside of a Style. If EventSetter is not available, is there another simple way to do this inside of a style?
Code snippet:
Code: Select all
<TreeView.ItemContainerStyle>
<Style TargetType="TreeViewItem" BasedOn="{StaticResource TreeViewItem}">
<EventSetter Event="Loaded" Handler="TreeViewItem_Loaded"/>
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="PointTree_MouseLeftButtonDown"/>
<EventSetter Event="Expanded" Handler="PointTree_Expanded"/>
</Style>
</TreeView.ItemContainerStyle>
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: EventSetter in Style
Hi,
Unfortunately EventSetter is not implemented in Noesis, it was not requested before so could you please add a ticket to our bugtracker about it?
An alternative to EventSetters is to bind to commands exposed in your viewmodel. This can be done in a style by using our StyleInteraction extension.
Unfortunately EventSetter is not implemented in Noesis, it was not requested before so could you please add a ticket to our bugtracker about it?
An alternative to EventSetters is to bind to commands exposed in your viewmodel. This can be done in a style by using our StyleInteraction extension.
Code: Select all
<TreeView.ItemContainerStyle>
<Style TargetType="TreeViewItem" BasedOn="{StaticResource TreeViewItem}">
<Setter Property="noesis:StyleInteraction.Triggers">
<Setter.Value>
<noesis:StyleTriggerCollection>
<b:EventTrigger EventName="Loaded">
<b:InvokeCommandAction Command="{Binding ItemLoadedCommand}"/>
</b:EventTrigger>
<b:EventTrigger EventName="PreviewMouseLeftButtonDown">
<b:InvokeCommandAction Command="{Binding ItemClickedCommand}"/>
</b:EventTrigger>
<b:EventTrigger EventName="Expanded">
<b:InvokeCommandAction Command="{Binding ItemExpandedCommand}"/>
</b:EventTrigger>
</noesis:StyleTriggerCollection>
</Setter.Value>
</Setter>
</Style>
</TreeView.ItemContainerStyle>-
- colin14321
- Posts: 12
- Joined:
Re: EventSetter in Style
Yes no problem! It is under issue #2404. https://www.noesisengine.com/bugs/view.php?id=2404
I will give commands a try.
Thank you!
I will give commands a try.
Thank you!
Who is online
Users browsing this forum: No registered users and 7 guests