Search code examples
xamllistviewuwplistviewitemuwp-xaml

How to change style of Selected ListView Item in UWP


I have a ListView in my UWP application with this code.

<ListView Name="menuListView" HorizontalAlignment="Center" 
              Grid.Row="1" SelectionChanged="ListView_SelectionChanged" 
              BorderThickness="0,0,0,5" SelectedIndex="0"
              Grid.ColumnSpan="2">

        <ListView.ItemsPanel>
            <ItemsPanelTemplate>
            <StackPanel Orientation="Horizontal"></StackPanel>
        </ItemsPanelTemplate>
         </ListView.ItemsPanel>
        <TextBlock Name="dayTB"  Text="Day" Margin="25 0 0 0" FontSize="18" />
        <TextBlock Name="weekTB" Text="Week" Margin="25 0 0 0" FontSize="18" />
        <TextBlock Name="monthTB" Text="Month" Margin="25 0 0 0" FontSize="18" />

    </ListView>

It looks like this.

enter image description here

I am trying to make it look like this for quite some time now, but my tries are not successful.

enter image description here

Is there a way to achieve this? Any help would be appreciated.


Solution

  • The right control used in the picture, is the Pivot, not ListView.

    try this basic Pivot XAML code, and play around it

    <Pivot Title="EMAIL">
    <PivotItem Header="All">
    <TextBlock Text="all emails go here." />
    </PivotItem>
    <PivotItem Header="Unread">
    <TextBlock Text="unread emails go here." />
    </PivotItem>
    <PivotItem Header="Flagged">
    <TextBlock Text="flagged emails go here." />
    </PivotItem>
    <PivotItem Header="Urgent">
    <TextBlock Text="urgent emails go here." />
    </PivotItem>
    </Pivot>