Behavior with Event inside Style
Posted: 05 Jun 2019, 18:16
Hi
I implemented Behavior in which there is an Event. If I attach this Behavior to the element that is inside Style.ControlTemplate ..., then the event is not called. When invoking Event, the list of delegates is empty. As I understand it, when using inside Styles, you need to clone the Behavior created in Style.
How to act in this case?
In the method of
I create a Behavior instance with an existing event. It works.
I implemented Behavior in which there is an Event. If I attach this Behavior to the element that is inside Style.ControlTemplate ..., then the event is not called. When invoking Event, the list of delegates is empty. As I understand it, when using inside Styles, you need to clone the Behavior created in Style.
How to act in this case?
In the method of
Code: Select all
Noesis::Ptr<Noesis::Freezable> LayoutDragElementBehavior::CreateInstanceCore() const
{
return *new LayoutDragElementBehavior(mDragEvent);
}Code: Select all
<TabControl x:Name="tab" Visibility="Collapsed" TabStripPlacement="Bottom" BorderThickness="0.5" BorderBrush="#303030" SelectionChanged="OnTabSelectionChanged">
<TabControl.Resources>
<Style TargetType="{x:Type TabItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Grid Height="25">
<i:Interaction.Behaviors>
<docking:LayoutDragElementBehavior OnDrag="OnTabItemDrag"/>
</i:Interaction.Behaviors>
<Border Name="Border" Background="Transparent" BorderThickness="0" CornerRadius="0" Margin="0" BorderBrush="#303030">
<TextBlock />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</TabControl.Resources>
</TabControl>