Silverlight DataStateBehavior, initial value not used
- by JimmySavile
Hi,
I am trying to use the Silverlight DataStateBehavior, it works fine in most cases where I click a button which sets say a 'Selected' Property in the view model to either false or true. The DataStateBehavior then tells the VisualStateManager to go to the relevant state.
Like this:
<Button...>
<i:Interaction.Behaviors>
<id:DataStateBehavior Binding="{Binding Selected}" Value="True" TrueState="SelectedVisualState" FalseState="DeselectedVisualState"/>
</i:Interaction.Behaviors>
</Button>
The above works fine. What I am trying to do though is to get it to set the correct state when the application loads, if I were to set the 'Selected' property on the view model to true by default I wouldn't see any changes in the UI until I clicked the button to change the viewmodel property.
I know there are several classes involved with the DataState stuff including:
BindingListener.cs
ConverterHelper.cs
DataStateBehavior.cs
DataStateSwitchBehavior.cs
DataTrigger.cs
Any clues would be good,
Thanks