Silverlight 4.0 视觉状态管理器
谁能帮助我或者我错过了什么吗?视觉状态未触发
xmlns:swi="clr-namespace:System.Windows.Interactivity; assembly=System.Windows.Interactivity" xmlns:esi =“clr命名空间:Expression.Samples.Interactivity;程序集=Expression.Samples.Interactivity” xmlns:mei="clr-namespace:Microsoft.Expression.Interactivity.Core; assembly=Microsoft.Expression.Interactions"
<my:DataGridTemplateColumn IsReadOnly="True">
<my:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="vsgUrgency">
<VisualState x:Name="UrgencySerious">
<Storyboard>
<ColorAnimation Storyboard.TargetName="orbUrgency"
Storyboard.TargetProperty="Fill" To="Red"/>
</Storyboard>
</VisualState>
<VisualState x:Name="UrgencyNormal">
<Storyboard>
<ColorAnimation Storyboard.TargetName="orbUrgency"
Storyboard.TargetProperty="Fill" To="Green"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<swi:Interaction.Triggers>
<esi:DataTrigger Binding="{Binding Urgency}" Value="Serious">
<mei:GoToStateAction StateName="UrgencySerious"/>
</esi:DataTrigger>
<esi:DataTrigger Binding="{Binding Urgency}" Value="Normal">
<mei:GoToStateAction StateName="UrgencyNormal"/>
</esi:DataTrigger>
</swi:Interaction.Triggers>
<TextBlock Text="{Binding Urgency}"/>
<Path x:Name="orbUrgency" Width="14.6566" Height="14.5449" Stretch="Fill" StrokeThickness="1"
StrokeLineJoin="Round" Fill="#FFE50A0A"
Data="F1 M 9.3269,3.61737C 13.3742,3.61737 16.6552,6.87332 16.6552,10.8898C 16.6552,14.9063 13.3742,18.1623 9.3269,18.1623C 5.2796,18.1623 1.99862,14.9063 1.99862,10.8898C 1.99862,6.87332 5.27956,3.61737 9.3269,3.61737 Z ">
</Path>
</StackPanel>
</DataTemplate>
</my:DataGridTemplateColumn.CellTemplate>
</my:DataGridTemplateColumn>
Can anyone please help me or is there anything I miss out? the visualstate is not triggered
xmlns:swi="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:esi="clr-namespace:Expression.Samples.Interactivity;assembly=Expression.Samples.Interactivity"
xmlns:mei="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
<my:DataGridTemplateColumn IsReadOnly="True">
<my:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="vsgUrgency">
<VisualState x:Name="UrgencySerious">
<Storyboard>
<ColorAnimation Storyboard.TargetName="orbUrgency"
Storyboard.TargetProperty="Fill" To="Red"/>
</Storyboard>
</VisualState>
<VisualState x:Name="UrgencyNormal">
<Storyboard>
<ColorAnimation Storyboard.TargetName="orbUrgency"
Storyboard.TargetProperty="Fill" To="Green"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<swi:Interaction.Triggers>
<esi:DataTrigger Binding="{Binding Urgency}" Value="Serious">
<mei:GoToStateAction StateName="UrgencySerious"/>
</esi:DataTrigger>
<esi:DataTrigger Binding="{Binding Urgency}" Value="Normal">
<mei:GoToStateAction StateName="UrgencyNormal"/>
</esi:DataTrigger>
</swi:Interaction.Triggers>
<TextBlock Text="{Binding Urgency}"/>
<Path x:Name="orbUrgency" Width="14.6566" Height="14.5449" Stretch="Fill" StrokeThickness="1"
StrokeLineJoin="Round" Fill="#FFE50A0A"
Data="F1 M 9.3269,3.61737C 13.3742,3.61737 16.6552,6.87332 16.6552,10.8898C 16.6552,14.9063 13.3742,18.1623 9.3269,18.1623C 5.2796,18.1623 1.99862,14.9063 1.99862,10.8898C 1.99862,6.87332 5.27956,3.61737 9.3269,3.61737 Z ">
</Path>
</StackPanel>
</DataTemplate>
</my:DataGridTemplateColumn.CellTemplate>
</my:DataGridTemplateColumn>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您的意思是使用紧急情况下的 DataTriggers 来表示 CellTemplate 上的状态,我认为您需要更改 GoToStateActions 上的 Target 属性
您希望目标是单元格。
http:// blogs.msdn.com/expression/archive/2010/02/22/switching-visual-states-easily-using-gotostateaction.aspx
Assuming you mean the states on the CellTemplate using the DataTriggers on Urgency, I think you need to change the Target property on the GoToStateActions
You want the Target to be the Cell.
http://blogs.msdn.com/expression/archive/2010/02/22/switching-visual-states-easily-using-gotostateaction.aspx