Trigger seems to be activating even though data model shouldnt be triggering it
Posted: 04 Aug 2022, 20:29
We're hitting a very odd bug right now that I'm not sure how to explain. I'll start with our xaml and data model setup..
We have a top-level variable in our model named "GameStateName" -- which tells us where the player is -- ie, playing, in menus, etc.
In our top-level xaml, we have a bunch of data triggers that look at that variable and then switch parts of the UI to be visible/not visible:
Every time our game state changes, we have debug logging.
So, the weird thing that is happening is that the "Teams" view in the little code block above is somehow becoming visible, even though the game state is not (and hasn't ever been) GameStateName.Teams. I've checked and I don't see anywhere else in our code where we make this piece of UI visible except right here.
The weird thing -- this is not consistent at all. The only time we see this happening is when you are observing other players and cycling through them. In that case, obviously a lot of the UI and data model are changing, but the game state name is NOT changing in those cases. I just mention this because this bug seems to be related to "a lot of other stuff changing in the data model".
For the top-level XAML, nearly all the data triggers are related to the GameStateName, but there are a few other data triggers related to properties on the observed player.
Any suggestions about how I could go about debugging this? Is there a logging level that would help explain why some of these data triggers seem to be activating even though they shouldn't?
thanks!
sam
We have a top-level variable in our model named "GameStateName" -- which tells us where the player is -- ie, playing, in menus, etc.
In our top-level xaml, we have a bunch of data triggers that look at that variable and then switch parts of the UI to be visible/not visible:
Code: Select all
<b:DataTrigger Binding="{Binding Player.GameStateName}" Comparison="Equal" Value="{x:Static definitions:GameStateName.Teams}">
<b:ChangePropertyAction x:Name="StateTeams_ShowTeams" TargetName="Teams" PropertyName="Visibility" Value="Visible"/>
<b:ChangePropertyAction x:Name="StateTeams_HideInteract" TargetName="Interact" PropertyName="Visibility" Value="Hidden"/>
</b:DataTrigger>
So, the weird thing that is happening is that the "Teams" view in the little code block above is somehow becoming visible, even though the game state is not (and hasn't ever been) GameStateName.Teams. I've checked and I don't see anywhere else in our code where we make this piece of UI visible except right here.
The weird thing -- this is not consistent at all. The only time we see this happening is when you are observing other players and cycling through them. In that case, obviously a lot of the UI and data model are changing, but the game state name is NOT changing in those cases. I just mention this because this bug seems to be related to "a lot of other stuff changing in the data model".
For the top-level XAML, nearly all the data triggers are related to the GameStateName, but there are a few other data triggers related to properties on the observed player.
Any suggestions about how I could go about debugging this? Is there a logging level that would help explain why some of these data triggers seem to be activating even though they shouldn't?
thanks!
sam