0
votes

I'm using VisualStateManager in a Windows 8.1 app to update the visibility of buttons on the BottomAppBar...

However this same XAML appears to not be supported for the BottomAppBar on Windows Phone 8.1.

When I attempt to update a button in Blend I get the error: An animation is trying to modify an object named '', but no such object can be found in the PageStandIn.

Is there a way to make this work or will I have to use code-behind to toggle the visibility manually? is there any way to make this work so I can share the code from win81 to update the command bar?

1

1 Answers

1
votes

The AppBars are very special, they are part of the System UI (in some sense) and thus somethings tend not work as expected.

Using storyboards don't work for updating them. You can use the code behind, but if you are using an MVVM framework you should be able to Bind them to a Boolean and using a BooleanToVisibilityConverter to do the visibility management.

Model

public bool ShowAppButton {get; set;}

View

<AppBarButton x:Name="MyAppButton" Label="AppButton" Visibility="{Binding ShowAppButton, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">

Hope this helps!