The problem here seems to be that the binding initially evaluates to null
and thus doesn't fire the change notification required for the evaluation and state change.
I've fixed it with the following subclass:
public class FixedDataStateBehavior: DataStateBehavior
{
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.Loaded += (sender, routedEventArgs) =>
{
var bindingExpression = BindingOperations.GetBindingExpression(this, BindingProperty);
SetCurrentValue(BindingProperty,new object());
bindingExpression.UpdateTarget();
};
}
}
and used it like this:
<FixedDataStateBehavior Binding="{Binding SelectedCamera}" Value="{x:Null}" TrueState="CameraSettingsUnselected" FalseState="CameraSettingsSelected"/>