NavigationPane and DataTemplate

Navigation for WPF Forum

Posted 8 years ago by Arthur Damen
Version: 10.2.0533
Avatar
Hi,
I want to Bind Data to a navigationBar it's navigationPane
What's the way to do this? Thanks.

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ac="http://schemas.actiprosoftware.com/winfx/xaml/navigation"
    Title="MainWindow" Height="350" Width="525">
  <Window.Resources>
    <DataTemplate x:Name="Test" DataType="ac:NavigationPane" >
      <ac:NavigationPane>
        <StackPanel>
          <TextBlock>aaaaaaaaaaaaaaaaaaaaaaaa</TextBlock>
        </StackPanel>
      </ac:NavigationPane>
    </DataTemplate>
  </Window.Resources>
    <Grid>
      
    <ac:NavigationBar>
      <ac:NavigationPane  ContentTemplate="Test"></ac:NavigationPane>
    </ac:NavigationBar>
  </Grid>
</Window>

Comments (2)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Arthur,

We include a NavigationBar Bound Items QuickStart that shows how to bind to a data source. In your example above though, you cannot access resources like that. You'd have to use something like:
<ac:NavigationPane  ContentTemplate="{StaticResource Test}"></ac:NavigationPane>
Also, normally the DataTemplate targets the type of your data object, not the UI control (i.e. NavigationPane).

[Modified at 08/09/2011 01:31 PM]


Actipro Software Support

Posted 8 years ago by Arthur Damen
Avatar
You are right, i forgot to enter the static part, sorry.

I will have a look at the example.
The latest build of this product (v2019.1 build 0681) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.