Visual State Manager
Hey, I try to use Visual State Manager. And I saw official Microsoft's tut: https://docs.microsoft.com/en-us/dotnet ... ew=net-5.0
And here is event declared MouseEnter="MouseEnterEventTexample" and after it fired in .cpp code I want go to te StateElement.. But I want to fire it automatically on the element it fired, no pass the UIElement like here:
1. Here is passed rect, but I dont want pass any elements becouse I dont know which element's event triggered. Can u help me?
2. Is it properly coded?
3. How the code setters?
That doesnt work. In normal triggers.setters that worked.
And here is event declared MouseEnter="MouseEnterEventTexample" and after it fired in .cpp code I want go to te StateElement.. But I want to fire it automatically on the element it fired, no pass the UIElement like here:
Code: Select all
VisualStateManager.GoToElementState(rect, "MouseEnter", true);
2. Is it properly coded?
Code: Select all
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Path x:Name="Button" Data="M-12,0 L60,0 72,30 0,30 z" Stretch="Fill" Stroke="#FFBCBCC2" Fill="Black" Opacity="0.75" Width="350" Height="50" ForceCursor="True" StrokeThickness="2" UseLayoutRounding="True" SnapsToDevicePixels="True" Margin="4,-41,3.8,-2.2" />
<TextBlock x:Name="Label" Text="{TemplateBinding Content}" Margin="13.5,-20.4,13.165,15.12" HorizontalAlignment="Center" VerticalAlignment="Center" ></TextBlock>
</Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="MouseStates">
<VisualState x:Name="MouseEnterTest">
<VisualState.Setters>
<Setter Target="Button" Property="Stroke" Value="Yellow" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</ControlTemplate>
</Setter.Value>
</Setter>
Code: Select all
<VisualState.Setters>
<Setter Target="Button" Property="Stroke" Value="Yellow" />
</VisualState.Setters>
Re: Visual State Manager
And why does animations dont work...
Help :/
Nothing works, from source I call
Code: Select all
<Grid>
<Path x:Name="Button" Data="M0,0 L60,0 70,30 0,30 z" Stretch="Fill" Stroke="#FFBCBCC2" Fill="Black" Opacity="0.75" Width="350" Height="50" ForceCursor="True" StrokeThickness="2" UseLayoutRounding="True" SnapsToDevicePixels="True">
</Path>
<TextBlock x:Name="Label" Text="{TemplateBinding Content}" Margin="161,91.8,161.042,91.621" HorizontalAlignment="Center" VerticalAlignment="Center" ></TextBlock>
<Path x:Name="Button_Glow" Data="M0,0 L60,0 70,30 0,30 z" Stretch="Fill" Stroke="{x:Null}" Fill="#FFFDFF00" Opacity="0.285" Width="Auto" Height="Auto" ForceCursor="True" StrokeThickness="2" UseLayoutRounding="True" SnapsToDevicePixels="True" Margin="145,86,137.042,74.421">
<Path.Effect>
<BlurEffect Radius="50"/>
</Path.Effect>
</Path>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="TabStates">
<VisualState x:Name="TabFocused">
<Storyboard RepeatBehavior="Forever" AutoReverse="True">
<DoubleAnimation Storyboard.TargetName="Button_Glow" Storyboard.TargetProperty="Opacity" From="0.0" To="0.22" Duration="0:0:0.8"/>
</Storyboard>
</VisualState>
<VisualState x:Name="TabNormal">
<VisualState.Setters>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
Nothing works, from source I call
Code: Select all
Noesis::Symbol symbolFocused("TabFocused");
Noesis::Symbol symbolNormal("TabNormal");
VisualStateManager::GoToState(mainMenuTabs[index].GetButton(), symbolFocused, true);
Re: Visual State Manager
Ok for those who will have the same issues. For me on OnInitialized() manager doesnt work, I setted it manaully in .xaml. Topic can be closed.
Re: Visual State Manager
Thank you! Closing this.
Who is online
Users browsing this forum: Google [Bot] and 2 guests