Posted 13 years ago
by Aled Hughes
-
Principal Software Engineer,
Control Techniques Ltd.
Version: 11.1.0545
Hi,
I have a NavigationBar that gets its items via data binding (ItemsSource property is set to an IEnumerable collection and an ItemContainerStyle is defined) and I want it to hide the navigation pane buttons when there is only one item in the bound collection.
So I bound the ArePanesVisible property to a property in my view-model that returns true if there is more than one navigation item, false otherwise.
However, I find that the NavigationBar fails to show the single panel.
Here is the XAML code:If I set ArePanesVisible="False" rather than through a binding it still doesn't show the default pane. I also tried setting the SelectedItem property to the first item in the list.
I found the only way to get it to work was to set the ArePanesVisible property to false in the IsLoaded event (or later). Or if the navigation panes are explicitly set in XAML rather than through ItemsSource.
This seems to be a bit of a bug to me, or am I missing something?
(11.1.542.0)
ADDITION: I find that if I set the ArePanesVisible=false, collapse then expand the navigation control the hosted panel disappears and I get a "{DisconnectedItem}" text instead. Why is this? I don't really want to loose the ability to minimize it!
[Modified at 09/06/2011 07:06 AM]
I have a NavigationBar that gets its items via data binding (ItemsSource property is set to an IEnumerable collection and an ItemContainerStyle is defined) and I want it to hide the navigation pane buttons when there is only one item in the bound collection.
So I bound the ArePanesVisible property to a property in my view-model that returns true if there is more than one navigation item, false otherwise.
However, I find that the NavigationBar fails to show the single panel.
Here is the XAML code:
<navigation:NavigationBar Grid.Column="0" Name="navigationBar1"
ItemsSource="{Binding NavigationItems}"
ArePanesVisible="{Binding MoreThanOneNavigationItem}"
IsTextSearchEnabled="False">
<navigation:NavigationBar.ItemContainerStyle>
<Style TargetType="{x:Type navigation:NavigationPane}">
<Setter Property="Title" Value="{Binding Name}"/>
<Setter Property="Content" Value="{Binding NavigationContent}"/>
<Setter Property="ImageSourceLarge" Value="{Binding ImageUri}"/>
</Style>
</navigation:NavigationBar.ItemContainerStyle>
</navigation:NavigationBar>
I found the only way to get it to work was to set the ArePanesVisible property to false in the IsLoaded event (or later). Or if the navigation panes are explicitly set in XAML rather than through ItemsSource.
This seems to be a bit of a bug to me, or am I missing something?
(11.1.542.0)
ADDITION: I find that if I set the ArePanesVisible=false, collapse then expand the navigation control the hosted panel disappears and I get a "{DisconnectedItem}" text instead. Why is this? I don't really want to loose the ability to minimize it!
[Modified at 09/06/2011 07:06 AM]