Silverlight DataStateBehavior, initial value not used
Posted
by JimmySavile
on Stack Overflow
See other posts from Stack Overflow
or by JimmySavile
Published on 2010-01-21T20:45:05Z
Indexed on
2010/04/07
2:03 UTC
Read the original article
Hit count: 998
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
© Stack Overflow or respective owner