locked
splitpage - details view not populating

    Question

  • Hi,

    Can someone tell me what I am missing here.  I am using the splitpage.xaml page for the first time.  I have left it pretty much as default.  I have populated the Item list successfully but nothing happens when I click on an item.  I would have expected the details of that item to populate the Details view. 

    I would have expected that the below line in the Details view would have automatically populated the Details view with what is selected in the List view.  Or do I still need to do something in the ItemListView_SelectionChanged method?
    DataContext = "{Binding SelectedItem, ElementName=itemListView}"

    Maybe its something very simple I am missing. 

    Below is my item list and my detail list from the xaml - NB the item list populates fine.

    Thanks for any help.

     <!-- Vertical scrolling item list -->
            <ListView
                x:Name="itemListView"
                AutomationProperties.AutomationId="ItemsListView"
                AutomationProperties.Name="Items"
                TabIndex="1"
                Grid.Row="1"
                Margin="-10,-10,0,0"
                Padding="120,0,0,60"
                ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
                IsSwipeEnabled="False"
                SelectionChanged="ItemListView_SelectionChanged">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Grid Margin="6">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Border Background="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}" Width="60" Height="60">
                                <Image Source="" Stretch="UniformToFill" AutomationProperties.Name="{Binding ErrorDate}"/>
                            </Border>
                            <StackPanel Grid.Column="1" Margin="10,0,0,0">
                                <TextBlock Text="{Binding ErrorDate}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap" MaxHeight="40"/>
                                <TextBlock Text="{Binding UserMessage}" Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap"/>
                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                </ListView.ItemTemplate>
                <ListView.ItemContainerStyle>
                    <Style TargetType="FrameworkElement">
                        <Setter Property="Margin" Value="0,0,0,10"/>
                    </Style>
                </ListView.ItemContainerStyle>
            </ListView>
    
    
    
            <!-- Details for selected item -->
            <ScrollViewer
           x:Name = "itemDetail"
            AutomationProperties.AutomationId = "ItemDetailScrollViewer"
            Grid.Column = "1"
            Grid.RowSpan = "2"
            Padding = "60,0,66,0"
            DataContext = "{Binding SelectedItem, ElementName=itemListView}"
                        HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"
                        ScrollViewer.HorizontalScrollMode="Disabled" ScrollViewer.VerticalScrollMode="Enabled"
                        ScrollViewer.ZoomMode="Disabled">
    
                <Grid x:Name="itemDetailGrid" Margin="0,60,0,50">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
    
                    <Image Grid.Row="1" Margin="0,0,20,0" Width="180" Height="180" Source="" Stretch="UniformToFill" AutomationProperties.Name="{Binding ErrorDate}"/>
                    <StackPanel x:Name="itemDetailTitlePanel" Grid.Row="1" Grid.Column="1">
                        <TextBlock x:Name="itemTitle" Margin="0,-10,0,0" Text="{Binding Title}" Style="{StaticResource SubheaderTextBlockStyle}"/>
                        <TextBlock x:Name="itemSubtitle" Margin="0,0,0,20" Text="{Binding ExceptionMessage}" Style="{StaticResource SubtitleTextBlockStyle}"/>
                    </StackPanel>
                    <TextBlock Grid.Row="2" Grid.ColumnSpan="2" Margin="0,20,0,0" Text="{Binding InfoMessage}" Style="{StaticResource BodyTextBlockStyle}"/>
                </Grid>
            </ScrollViewer>

    Friday, January 9, 2015 4:39 PM

Answers

  • Hi Ireland75,

    I don't think you need some events like Selection_Changed since the data is binding. Once you change the selection in ListView, the content for selected item will be also changed.

    I would suggest you to create a split template to see how it works instead of create a single Split Page on your project. You need binding things on to the item detail content, if you create a single split page, there is no test data.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Ireland75 Monday, January 12, 2015 2:15 PM
    Monday, January 12, 2015 7:40 AM
    Moderator

All replies

  • Hi Ireland75,

    I don't think you need some events like Selection_Changed since the data is binding. Once you change the selection in ListView, the content for selected item will be also changed.

    I would suggest you to create a split template to see how it works instead of create a single Split Page on your project. You need binding things on to the item detail content, if you create a single split page, there is no test data.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Ireland75 Monday, January 12, 2015 2:15 PM
    Monday, January 12, 2015 7:40 AM
    Moderator
  • thanks james...the template showed me where I was going wrong.

    Monday, January 12, 2015 2:15 PM