Blend reveals Pivot
's template and the ContentPresenter
found beneath but where can I find the default RightHeaderTemplate
? I wish to stretch a RelativePanel
onto the entire right header area.
<ContentPresenter x:Name="RightHeaderPresenter" ContentTemplate="{TemplateBinding RightHeaderTemplate}" Grid.Column="2" Content="{TemplateBinding RightHeader}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
For example the TabView.TabStripFooter
can offer this by default.
Tried this for size but to no avail:
<Pivot x:Name="MyPivotTable" ItemsSource="{x:Bind ViewModel.MyItems}" SelectedItem="{x:Bind ViewModel.ActiveDocument, Mode=OneWay}">
<Pivot.RightHeader>
<RelativePanel Width="{Binding ElementName=MyPivotTable, Path=RightHeader.ActualWidth}">
Control is being aligned to the most right:
CodePudding user response:
You can find the default styles, templates in the generic.xaml. AFAIK, you should be able to find the generic.xaml here:
C:\Users\???.nuget\packages\microsoft.windowsappsdk\1.1.5\lib\net5.0-windows10.0.17763.0\Microsoft.WinUI\Themes\generic.xaml
UPDATE
You can stretch the RightHeader area by changing the ColumnDefinitions
. Since the RightHeaderPresenter is assigned to Grid.Column="2"
, this should work:
<PivotPanel
x:Name="Panel"
VerticalAlignment="Stretch">
<Grid x:Name="PivotLayoutElement">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<!--
<ColumnDefinition Width="Auto" />
-->
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
...
</PivotPanel>