How to Change Size of Pivot Item Header in Template - xaml

I'm looking to be able to modify the default Pivot template to change the size of the Pivot Item headers. How might I do this with the following Style
<Style x:Key="PivotStyle" TargetType="phone:Pivot">
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<Grid/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="phone:Pivot">
<Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid CacheMode="BitmapCache" Grid.RowSpan="2" >
<Grid.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="Transparent" Offset="0.0" />
<GradientStop Color="Transparent" Offset="1.0" />
</LinearGradientBrush>
</Grid.Background>
</Grid>
<Grid Background="{TemplateBinding Background}" CacheMode="BitmapCache" Grid.Row="2" />
<ContentPresenter ContentTemplate="{TemplateBinding TitleTemplate}" Content="{TemplateBinding Title}" Margin="24,17,0,-7" />
<Primitives:PivotHeadersControl x:Name="HeadersListElement" Foreground="{StaticResource PhoneForegroundBrush}" FontSize="28" Grid.Row="1"/>
<ItemsPresenter x:Name="PivotItemPresenter" Margin="{TemplateBinding Padding}" Grid.Row="2"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
I am trying to get this to mimick the following

You can surely change your Pivot Header's font-size, family and so on by changing HeaderTemplate:
<phone:Pivot Title="PivotTest" Style="{StaticResource PivotStyle}">
<phone:Pivot.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontSize="10"/>
</DataTemplate>
</phone:Pivot.HeaderTemplate>
<phone:PivotItem Header="One">
// item 1
</phone:PivotItem>
<phone:PivotItem Header="Two">
// item 2
</phone:PivotItem>
</phone:Pivot>
EDIT - within a style:
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Key="myHeader">
<TextBlock Text="{Binding}" FontSize="10"/>
</DataTemplate>
<Style x:Key="PivotStyle" TargetType="phone:Pivot">
<Setter Property="HeaderTemplate" Value="{StaticResource myHeader}"/>
<Setter Property="Margin" Value="0"/>
....

Related

Display content in a UWP app - XAML Control

I am trying to display the content of a UWP app exactly the same way the content is displayed in the Store app (see above).
I used a ListView, but the Items appear right of the Header, instead of appearing straight below it, as you can see on the following screenshot:
This is my XAML:
<Page.Resources>
<local:Items x:Key="Item"/>
<DataTemplate x:Name="myListViewDataTemplate">
<Grid Margin="0" Width="200">
<Grid.RowDefinitions>
<RowDefinition Height="200"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Image Grid.Row="0" Source="{Binding Path=ItemImage}" Stretch="UniformToFill"/>
<TextBlock Grid.Row="1" Text="{Binding Path=ItemName}" Margin="0,5,0,0"
VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="20"/>
</Grid>
</DataTemplate>
</Page.Resources>
<Grid Background="LightGray">
<ListView ItemTemplate="{StaticResource myListViewDataTemplate}" ItemsSource="{StaticResource Item}">
<ListView.Header>
<TextBlock Margin="20,10,0,10" Text="Group of items" FontSize="22" FontWeight="SemiBold"/>
</ListView.Header>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Background="Transparent"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
</Grid>
Any idea on how to solve the problem?
One easy workaround is to just use a TextBlock instead of specifying the Header and place it on top of the ListView, but I prefer your current approach as it's simply neater.
But to make it look like what you want, we will need to modify the default Style of the ListView, which wraps the Header and the items inside a StackPanel(child of an ItemsPresenter). We don't want that, so we first remove the tempate bindings of Header and HeaderTemplate from the ItemsPresenter, and then we replace the root Border with a Grid, finally we add a ContentPresenter as the Header and place it above the ScrollViewer (the parent of the ItemsPresenter).
You can refer to the following Style which does everything that I described above.
<Style x:Key="ListViewStyle1"
TargetType="ListView">
<Setter Property="IsTabStop"
Value="False" />
<Setter Property="TabNavigation"
Value="Once" />
<Setter Property="IsSwipeEnabled"
Value="True" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility"
Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility"
Value="Auto" />
<Setter Property="ScrollViewer.HorizontalScrollMode"
Value="Disabled" />
<Setter Property="ScrollViewer.IsHorizontalRailEnabled"
Value="False" />
<Setter Property="ScrollViewer.VerticalScrollMode"
Value="Enabled" />
<Setter Property="ScrollViewer.IsVerticalRailEnabled"
Value="True" />
<Setter Property="ScrollViewer.ZoomMode"
Value="Disabled" />
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled"
Value="False" />
<Setter Property="ScrollViewer.BringIntoViewOnFocusChange"
Value="True" />
<Setter Property="UseSystemFocusVisuals"
Value="True" />
<Setter Property="ItemContainerTransitions">
<Setter.Value>
<TransitionCollection>
<AddDeleteThemeTransition />
<ContentThemeTransition />
<ReorderThemeTransition />
<EntranceThemeTransition IsStaggeringEnabled="False" />
</TransitionCollection>
</Setter.Value>
</Setter>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<ItemsStackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListView">
<Grid BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<ContentPresenter x:Name="Header" Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}" />
<ScrollViewer x:Name="ScrollViewer"
Grid.Row="1"
AutomationProperties.AccessibilityView="Raw"
BringIntoViewOnFocusChange="{TemplateBinding ScrollViewer.BringIntoViewOnFocusChange}"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsHorizontalScrollChainingEnabled="{TemplateBinding ScrollViewer.IsHorizontalScrollChainingEnabled}"
IsVerticalScrollChainingEnabled="{TemplateBinding ScrollViewer.IsVerticalScrollChainingEnabled}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
TabNavigation="{TemplateBinding TabNavigation}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}">
<ItemsPresenter FooterTransitions="{TemplateBinding FooterTransitions}"
FooterTemplate="{TemplateBinding FooterTemplate}"
Footer="{TemplateBinding Footer}"
Padding="{TemplateBinding Padding}" />
</ScrollViewer>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Then you just apply it to your ListView like this. Oh BTW, make sure you set the VerticalAlignment to Top too.
<ListView VerticalAlignment="Top"
Style="{StaticResource ListViewStyle1}"
...>
Hope this helps!

Menu button at the bottom UWP Hamburger Navigation pane

I am currently building a hamburger menu for my UWP app build using SplitView.Pane. The "Buttons" are listBoxItems in a listBox. Is there a way to make the setting icon be located at the bottom of the SplitView.Pane like in the native windows new App...Thanks
try this sample .....
it's working good like a native app
https://mohamedsaqer.wordpress.com/category/xaml/
use 2 ListBox inside a RelativePanel. in down listbox set RelativePanel.AlignBottomWithPanel="True" and when select item from the fist listbox set the selectedIndex=-1 for the other listBox
<SplitView.Pane>
<RelativePanel>
<ListBox x:Name="UpperListBox">
<ListBoxItem .....
</ListBox>
<ListBox x:Name="DownListBox" RelativePanel.AlignBottomWithPanel="True">
<ListBoxItem .....
</ListBox>
</RelativePanel>
There is no easy (if any) way to align part of ListBox items on the top and another part on the bottom, so the answer is pretty simple - don't use ListBox and build necessary layout manually. For example, like this:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Button x:Name="TopButton1" Grid.Row="0" Content="TopButton" />
<Button x:Name="TopButton2" Grid.Row="1" Content="TopButton" />
<Button x:Name="TopButton3" Grid.Row="2" Content="TopButton" />
<Button x:Name="BottomButton" Grid.Row="4" Content="BottomButton" />
</Grid>
Btw, it's recommended to use ListView instead of ListBox in UWP apps.
I have an app with ham menu and I use Radio Buttons. In the group propertie of radio button I use the same group name. That way you can use any layout you like, for ex grid, with stack panels and your buttons can be anywhere. When you tapp any button it will selected like listview and tapping another one will unselect and select the new one.
Hum Menu
<SplitView.Pane>
<Grid>
<StackPanel>
<ToggleButton x:Name="HamburgerButton" FontFamily="Segoe MDL2 Assets" Content=""
Width="50" Height="50" Background="Transparent" Tapped="HamburgerButton_Tapped" Foreground="White"
FontSize="16" FontWeight="Bold" Style="{StaticResource HamburgerToggleButtonStyle}" />
<RadioButton Content="Top 1" x:Name="btn1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsChecked="False" Foreground="White" GroupName="HamMenu"/>
<RadioButton Content="Top 2" x:Name="btn2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsChecked="True" Foreground="White" GroupName="HamMenu"/>
<RadioButton Content="Top 3" x:Name="btn3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsChecked="False" Foreground="White" GroupName="HamMenu"/>
</StackPanel>
<StackPanel VerticalAlignment="Bottom">
<RadioButton Tag="" Content="Bottom 1" x:Name="btn4" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Style="{StaticResource RadioButtonStyle1}" IsChecked="False" Foreground="White" GroupName="HamMenu"/>
<RadioButton Tag="" Content="Bottom 2" x:Name="btn5" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Style="{StaticResource RadioButtonStyle1}" IsChecked="False" Foreground="White" GroupName="HamMenu"/>
</StackPanel>
</Grid>
</SplitView.Pane>
Radio button Style
<Style x:Key="RadioButtonStyle1" TargetType="RadioButton">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
<Setter Property="Padding" Value="8,6,0,0"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Top"/>
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
<Setter Property="MinWidth" Value="120"/>
<Setter Property="UseSystemFocusVisuals" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Grid x:Name="MainRadioGrid">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="PointerOver">
<Storyboard>
<ColorAnimation Duration="0" To="#7FFFFFFF" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="SecondaryRadioGrid" d:IsOptimized="True"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="CheckStates">
<VisualState x:Name="Checked">
<VisualState.Setters>
<Setter Target="MainRadioGrid.(Panel.Background)">
<Setter.Value>
<SolidColorBrush Color="White"/>
</Setter.Value>
</Setter>
<Setter Target="IconTextHum.(TextBlock.Foreground).(SolidColorBrush.Color)">
<Setter.Value>
<Color>Black</Color>
</Setter.Value>
</Setter>
<Setter Target="ContentPresenter.(ContentPresenter.Foreground).(SolidColorBrush.Color)">
<Setter.Value>
<Color>Black</Color>
</Setter.Value>
</Setter>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Unchecked"/>
<VisualState x:Name="Indeterminate">
<VisualState.Setters>
<Setter Target="ContentPresenter.(ContentPresenter.Foreground).(SolidColorBrush.Color)">
<Setter.Value>
<Color>Black</Color>
</Setter.Value>
</Setter>
<Setter Target="IconTextHum.(TextBlock.Foreground).(SolidColorBrush.Color)">
<Setter.Value>
<Color>Black</Color>
</Setter.Value>
</Setter>
<Setter Target="SecondaryRadioGrid.(Panel.Background).(SolidColorBrush.Color)">
<Setter.Value>
<Color>#02000000</Color>
</Setter.Value>
</Setter>
<Setter Target="MainRadioGrid.(Panel.Background)">
<Setter.Value>
<SolidColorBrush Color="White"/>
</Setter.Value>
</Setter>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid x:Name="SecondaryRadioGrid" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="#02000000">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid x:Name="grid1" Height="50" VerticalAlignment="Top" Width="50">
<TextBlock x:Name="IconTextHum" TextWrapping="Wrap" Text="{TemplateBinding Tag}" d:LayoutOverrides="Width, Height" FontFamily="Segoe MDL2 Assets" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="21.333"/>
</Grid>
<ContentPresenter x:Name="ContentPresenter" AutomationProperties.AccessibilityView="Raw" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTransitions="{TemplateBinding ContentTransitions}" Content="{TemplateBinding Content}" Grid.Column="1" TextWrapping="Wrap" VerticalAlignment="Center" Margin="10,0,0,0"/>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
You should use a RelativePanel element:
<SplitView.Pane>
<RelativePanel>
<StackPanel RelativePanel.AlignTopWithPanel="True">
...
</StackPanel>
<StackPanel RelativePanel.AlignBottomWithPanel="True">
...
</StackPanel>
</RelativePanel>
</SplitView.Pane>

How to adjust the text in a textbox in wp7?

In my app, what i want is when the text goes beyond the width of the text box, i want it to mention it somehow to the user,(either by placing ... at the end or decreasing the font size so that it fits the text box).
How can i do this?
There are two way to do so
First one is :
Set TextWrapping property of TextBox to Wrap, Remove Height Property of textbox and set Width Propert of TextBox To some definite size (200).
Second is :
Use following style on textbox. It enable scrolling in textbox control
<phone:PhoneApplicationPage.Resources>
<ControlTemplate x:Key="PhoneDisabledTextBoxTemplate" TargetType="TextBox">
<ContentControl x:Name="ContentElement" BorderThickness="0" HorizontalContentAlignment="Stretch" Margin="{StaticResource PhoneTextBoxInnerMargin}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="Stretch"/>
</ControlTemplate>
<Style x:Key="AppTextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="Segoe WP"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="FontSize" Value="26"/>
<Setter Property="Height" Value="60"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Grid Background="Transparent" >
<Grid>
<ScrollViewer x:Name="EnabledBorder" BorderBrush="#e64358" BorderThickness="1" Background="{TemplateBinding Background}" Margin="0,5" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
<ContentControl x:Name="ContentElement" BorderThickness="0" HorizontalContentAlignment="Left" Padding="{TemplateBinding Padding}" VerticalContentAlignment="Center" />
</ScrollViewer>
<Border x:Name="DisabledOrReadonlyBorder" BorderThickness="{TemplateBinding BorderThickness}" Background="#FF71B68D" Margin="0" Visibility="Collapsed">
<Border.BorderBrush>
<SolidColorBrush Color="#e64358"/>
</Border.BorderBrush>
<TextBox x:Name="DisabledOrReadonlyContent" Background="Transparent" Foreground="{StaticResource PhoneDisabledBrush}" FontWeight="{TemplateBinding FontWeight}" FontStyle="{TemplateBinding FontStyle}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" IsReadOnly="True" SelectionForeground="{TemplateBinding SelectionForeground}" SelectionBackground="{TemplateBinding SelectionBackground}" TextAlignment="{TemplateBinding TextAlignment}" TextWrapping="{TemplateBinding TextWrapping}" Text="{TemplateBinding Text}" Template="{StaticResource PhoneDisabledTextBoxTemplate}"/>
</Border>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</phone:PhoneApplicationPage.Resources>
<TextBox Style="{StaticResource AppTextBoxStyle}" Width = "300"/>
You can use text ellipsis..try this..
<TextBlock Name="txtFeedTitle"
Text="{Binding Title}"
TextWrapping="Wrap"
TextTrimming="WordEllipsis"
Style="{StaticResource PhoneTextTitle3Style}"/>
You Could use this for assigning a particular length of string
String str="aaaaaaaaa";
textBoxName.Text = str.Substring(0, 5) + "...";
You could use TextWrapping property of textBox cintrol
Here the solution
<phone:PhoneApplicationPage.Resources>
<Style x:Key="AppTextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="Segoe WP"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="FontSize" Value="26"/>
<Setter Property="Height" Value="60"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border BorderThickness='1'
Background='#ffefefef'
BorderBrush='LightBlue'>
<TextBlock Text="{TemplateBinding Text}"
TextTrimming="WordEllipsis"
Margin='4,1' />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</phone:PhoneApplicationPage.Resources>
<TextBox HorizontalAlignment="Left" Height="42"
Margin="40,177,0,0"
Text="TextBox with long text to show Text ellipsis"
VerticalAlignment="Top" Width="184"
Style="{StaticResource AppTextBoxStyle}" />

How to Change a Pivot Items Body Default Colors

I have been using a general custom Pivot style in my app, but it is changing the header foreground as well as body foreground to the same color (Blue). I only need the header foreground to change accordingly to my specifications, but the body foreground should remain to be the default application foreground. How might I make that change in the following template?
<Style x:Key="PivotStyleBlue" TargetType="phone:Pivot">
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/>
<!--<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>-->
<Setter Property="Foreground" Value="Blue"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<Grid/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="phone:Pivot">
<Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid CacheMode="BitmapCache" Grid.RowSpan="2" >
<Grid.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="Transparent" Offset="0.0" />
<GradientStop Color="Transparent" Offset="1.0" />
</LinearGradientBrush>
</Grid.Background>
</Grid>
<Grid Background="{TemplateBinding Background}" CacheMode="BitmapCache"
Grid.Row="2" />
<ContentPresenter ContentTemplate="{TemplateBinding TitleTemplate}"
Content="{TemplateBinding Title}" Margin="24,17,0,-7"/>
<Primitives:PivotHeadersControl x:Name="HeadersListElement"
Grid.Row="1"/>
<ItemsPresenter x:Name="PivotItemPresenter"
Margin="{TemplateBinding Padding}" Grid.Row="2"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Change Foreground of HeadersListElement only.
<Primitives:PivotHeadersControl
x:Name="HeadersListElement"
Foreground="Blue"
Grid.Row="1" />

Nested ListView Scrolling Issue

I'm working WINRT application its have a Nested Listviews.I have some problem in main Listview Scrolling when my mouse point comes around second Listview i can't scroll the main Listview i Disabled the second Listview " ScrollViewer.VerticalScrollBarVisibility" and "ScrollViewer.VerticalScrollMode" too but its not working. Here i have attach my code.
<Page.Resources>
<DataTemplate x:Key="ItemTemplate">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="95*"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<Grid>
<TextBlock x:Name="txtSlno" Foreground="Black" FontSize="18">
<Run Text="{Binding SNLO}"/>
<Run Text="."/>
</TextBlock>
<TextBlock x:Name="txtItem" Text="{Binding ItemDescription}" FontSize="18" Margin="22,0,0,0" TextWrapping="Wrap" Foreground="Black"/>
</Grid>
<ListView x:Name="lstCategory" Grid.Row="1" Margin="30,0,0,0" ItemsSource="{Binding Categories}" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollMode="Disabled" SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate>
<RadioButton Content="{Binding CategoryDescription}" FontSize="16" IsChecked="{Binding IsChecked,Mode=TwoWay}" GroupName="{Binding ItemId}" Foreground="Black" BorderBrush="Black" IsThreeState="False" Style="{StaticResource RadioButtonStyle}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</DataTemplate>
</Page.Resources>
Main ListView
<ListView x:Name="lstItem" ItemsSource="{Binding ItemList,Mode=TwoWay}" ItemTemplate="{StaticResource ItemTemplate}" SelectionMode="None" Margin="0,20,0,13"/>
If you look at the default template of the ListView control you can see that it contains a ScrollViewer that surrounds the inner ItemsPresenter.
The ScrollViewer is what swallows the mouse events, that is why your outer ListView cannot be scrolled.
You can simply create a custom template which does not contain a ScrollViewer like this:
<Style x:Key="ListViewWithoutScrollViewerStyle" TargetType="ListView">
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="TabNavigation" Value="Once"/>
<Setter Property="IsSwipeEnabled" Value="True"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled"/>
<Setter Property="ScrollViewer.IsHorizontalRailEnabled" Value="False"/>
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Enabled"/>
<Setter Property="ScrollViewer.IsVerticalRailEnabled" Value="False"/>
<Setter Property="ScrollViewer.ZoomMode" Value="Disabled"/>
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False"/>
<Setter Property="ScrollViewer.BringIntoViewOnFocusChange" Value="True"/>
<Setter Property="ItemContainerTransitions">
<Setter.Value>
<TransitionCollection>
<AddDeleteThemeTransition/>
<ContentThemeTransition/>
<ReorderThemeTransition/>
<EntranceThemeTransition IsStaggeringEnabled="False"/>
</TransitionCollection>
</Setter.Value>
</Setter>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListView">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
<!--Commented out the ScrollViewer so it does not swallow the mouse events.-->
<!--<ScrollViewer x:Name="ScrollViewer" BringIntoViewOnFocusChange="{TemplateBinding ScrollViewer.BringIntoViewOnFocusChange}" HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}" IsHorizontalScrollChainingEnabled="{TemplateBinding ScrollViewer.IsHorizontalScrollChainingEnabled}" IsVerticalScrollChainingEnabled="{TemplateBinding ScrollViewer.IsVerticalScrollChainingEnabled}" IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}" IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}" TabNavigation="{TemplateBinding TabNavigation}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}" ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}">-->
<ItemsPresenter HeaderTemplate="{TemplateBinding HeaderTemplate}" Header="{TemplateBinding Header}" HeaderTransitions="{TemplateBinding HeaderTransitions}" Padding="{TemplateBinding Padding}"/>
<!--</ScrollViewer>-->
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Applying this Style to the inner ListView should make the scrolling work for the outer ListView