开发者

Wpf Data Trigger Value can be Generic Type?

开发者 https://www.devze.com 2023-02-28 21:47 出处:网络
I have wpf data trigger as below. <DataTrigger Value=\"0\" Binding=\"{Binding Path=TestDirection,Mode=OneWay}\">

I have wpf data trigger as below.

   <DataTrigger Value="0" Binding="{Binding Path=TestDirection,Mode=OneWay}">
                        <DataTrigger.EnterActions>
                            <BeginStoryboard Storyboard="{StaticResource LastDonePrice_UpTickDirection_Blink}"/>
                        </DataTrigger.EnterActions>
                    </DataTrigger>
                    <DataTrigger  Value="2" Binding="{Binding Path=TestDirect开发者_开发技巧ion,Mode=OneWay}">
                        <DataTrigger.EnterActions>
                            <BeginStoryboard Storyboard="{StaticResource LastDonePrice_DownTickDirection_Blink}" />
                        </DataTrigger.EnterActions>
                    </DataTrigger>

TestDirection is the property of Generic Type returning '0' or '2'. I want to animate the storyboard based on this values. But It's not working now. Please advise. Thanks.


You can write a Value Converter while binding "TestDirection" and value converter will return a boolean value if that generic type is 0 or 2....

some thing like this...

<DataTrigger  Value="true" Binding="{Binding Path=TestDirection,Converter={StaticResource <Converter>},Mode=OneWay}">
0

精彩评论

暂无评论...
验证码 换一张
取 消