winrt-xamlwindows-phone-8.1datatriggervisualstates

DataTrigger with VisualStates in Windows phone 8.1


I'm trying to convert old Window phone 7.5 Silverlight Application to new WinRT Universal application and I have problems with this pice of code:

<Style TargetType="Button">
    <Setter Property="Visibility" Value="Collapsed"/>
    <Style.Triggers>
        <DataTrigger Binding="{Binding Active}" Value="True">
            <Setter Property="Visibility" Value="Visible"/>
        </DataTrigger>
    </Style.Triggers>
</Style>

I used DataTrigger to set visibility of control based on binding value.

In Windows Phone 8.1 winrt app this functionality is out. I've tried with VisualStates to achieve same functionality but I can't figure it out. Can anyone help me or direct me with good example. I'm stuck here with this...


Solution

  • DataTriggers are not available currently in WinRT, you have couple of options instead: