WPF CustomContentState

From no name for this wiki
Revision as of 15:40, 10 February 2010 by Claude (talk | contribs)
Jump to: navigation, search
<Page x:Class="WpfApplication3.Page1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ns="clr-namespace:WpfApplication3"
    Title="Page1">

    <DockPanel>

        <DockPanel.Resources>
            <ObjectDataProvider x:Key="usersDataSource" ObjectType="{x:Type ns:Users}"/>
            <DataTemplate x:Key="NameTemplate">
                <TextBlock Text="{Binding Path=Name}"/>
      </DataTemplate>
        </DockPanel.Resources>

        <Label FontWeight="Bold" DockPanel.Dock="Top">State Navigation</Label>
        <TextBlock TextWrapping="Wrap" DockPanel.Dock="Top">Change the list selection several times, then navigate backwards and forwards to reapply previous and next list selections.</TextBlock>

        <Button Name="removeBackEntryButton" DockPanel.Dock="Top" Click="RemoveBackEntryButton_Click" Height="25">Remove Back Entry</Button>

        <ListBox Name="userListBox"  SelectionChanged="userListBox_SelectionChanged" DockPanel.Dock="Top" Height="150"  DataContext="{StaticResource usersDataSource}" ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" ItemTemplate="{StaticResource NameTemplate}" />

        <ListBox Name="logListBox" ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible"></ListBox>

    </DockPanel>

</Page>