mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-04-28 20:23:24 +08:00
fix: using ContentPreseter and add HeaderTemplate.
This commit is contained in:
@@ -20,27 +20,23 @@
|
|||||||
<!-- Compact-mode toggle: visible only in CompactOverlay/CompactInline. -->
|
<!-- Compact-mode toggle: visible only in CompactOverlay/CompactInline. -->
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
Name="PART_CompactPaneToggle"
|
Name="PART_CompactPaneToggle"
|
||||||
|
DockPanel.Dock="Top"
|
||||||
|
AutomationProperties.Name="Toggle navigation drawer"
|
||||||
|
ToolTip.Tip="Toggle navigation drawer"
|
||||||
Width="{DynamicResource ButtonDefaultHeight}"
|
Width="{DynamicResource ButtonDefaultHeight}"
|
||||||
Height="{DynamicResource ButtonDefaultHeight}"
|
Height="{DynamicResource ButtonDefaultHeight}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
AutomationProperties.Name="Toggle navigation drawer"
|
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
DockPanel.Dock="Top"
|
|
||||||
IsChecked="{Binding #PART_SplitView.IsPaneOpen, Mode=TwoWay}"
|
IsChecked="{Binding #PART_SplitView.IsPaneOpen, Mode=TwoWay}"
|
||||||
IsVisible="False"
|
IsVisible="False">
|
||||||
ToolTip.Tip="Toggle navigation drawer">
|
|
||||||
<Panel>
|
<Panel>
|
||||||
<PathIcon
|
<PathIcon
|
||||||
HorizontalAlignment="Center"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Data="{DynamicResource DrawerPageMenuGlyph}"
|
Data="{DynamicResource DrawerPageMenuGlyph}"
|
||||||
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
|
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
|
||||||
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNull}}"
|
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNull}}"
|
||||||
Theme="{DynamicResource InnerPathIcon}" />
|
Theme="{DynamicResource InnerPathIcon}" />
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_CompactPaneIconPresenter"
|
Name="PART_CompactPaneIconPresenter"
|
||||||
HorizontalAlignment="Center"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Content="{TemplateBinding DrawerIcon}"
|
Content="{TemplateBinding DrawerIcon}"
|
||||||
ContentTemplate="{TemplateBinding DrawerIconTemplate}"
|
ContentTemplate="{TemplateBinding DrawerIconTemplate}"
|
||||||
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
|
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
|
||||||
@@ -49,117 +45,99 @@
|
|||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_DrawerHeader"
|
Name="PART_DrawerHeader"
|
||||||
|
DockPanel.Dock="Top"
|
||||||
Background="{TemplateBinding DrawerHeaderBackground}"
|
Background="{TemplateBinding DrawerHeaderBackground}"
|
||||||
Content="{TemplateBinding DrawerHeader}"
|
Content="{TemplateBinding DrawerHeader}"
|
||||||
ContentTemplate="{TemplateBinding DrawerHeaderTemplate}"
|
ContentTemplate="{TemplateBinding DrawerHeaderTemplate}"
|
||||||
DockPanel.Dock="Top"
|
IsVisible="{TemplateBinding DrawerHeader, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||||
IsVisible="{TemplateBinding DrawerHeader,
|
|
||||||
Converter={x:Static ObjectConverters.IsNotNull}}" />
|
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_DrawerFooter"
|
Name="PART_DrawerFooter"
|
||||||
|
DockPanel.Dock="Bottom"
|
||||||
Background="{TemplateBinding DrawerFooterBackground}"
|
Background="{TemplateBinding DrawerFooterBackground}"
|
||||||
Content="{TemplateBinding DrawerFooter}"
|
Content="{TemplateBinding DrawerFooter}"
|
||||||
ContentTemplate="{TemplateBinding DrawerFooterTemplate}"
|
ContentTemplate="{TemplateBinding DrawerFooterTemplate}"
|
||||||
DockPanel.Dock="Bottom"
|
IsVisible="{TemplateBinding DrawerFooter, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||||
IsVisible="{TemplateBinding DrawerFooter,
|
|
||||||
Converter={x:Static ObjectConverters.IsNotNull}}" />
|
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_DrawerPresenter"
|
Name="PART_DrawerPresenter"
|
||||||
HorizontalContentAlignment="Stretch"
|
|
||||||
VerticalContentAlignment="Stretch"
|
|
||||||
Content="{TemplateBinding Drawer}"
|
Content="{TemplateBinding Drawer}"
|
||||||
ContentTemplate="{TemplateBinding DrawerTemplate}" />
|
ContentTemplate="{TemplateBinding DrawerTemplate}" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</SplitView.Pane>
|
</SplitView.Pane>
|
||||||
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
<Panel>
|
||||||
<DockPanel Name="PART_ContentDock">
|
<DockPanel Name="PART_ContentDock">
|
||||||
<Border
|
<Border
|
||||||
Name="PART_TopBar"
|
Name="PART_TopBar"
|
||||||
|
DockPanel.Dock="Top"
|
||||||
Height="{DynamicResource DrawerPageTopBarMinHeight}"
|
Height="{DynamicResource DrawerPageTopBarMinHeight}"
|
||||||
Padding="5"
|
Background="{DynamicResource DrawerPageTopBarBackground}">
|
||||||
Background="{DynamicResource DrawerPageTopBarBackground}"
|
<DockPanel>
|
||||||
DockPanel.Dock="Top">
|
|
||||||
<DockPanel HorizontalAlignment="Stretch">
|
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
Name="PART_PaneButton"
|
Name="PART_PaneButton"
|
||||||
|
DockPanel.Dock="Left"
|
||||||
|
AutomationProperties.Name="Toggle navigation drawer"
|
||||||
|
ToolTip.Tip="Toggle navigation drawer"
|
||||||
Width="{DynamicResource ButtonDefaultHeight}"
|
Width="{DynamicResource ButtonDefaultHeight}"
|
||||||
Height="{DynamicResource ButtonDefaultHeight}"
|
Height="{DynamicResource ButtonDefaultHeight}"
|
||||||
AutomationProperties.Name="Toggle navigation drawer"
|
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
DockPanel.Dock="Left"
|
IsChecked="{Binding #PART_SplitView.IsPaneOpen, Mode=TwoWay}">
|
||||||
IsChecked="{Binding #PART_SplitView.IsPaneOpen, Mode=TwoWay}"
|
|
||||||
ToolTip.Tip="Toggle navigation drawer">
|
|
||||||
<Panel>
|
<Panel>
|
||||||
<PathIcon
|
<PathIcon
|
||||||
HorizontalAlignment="Center"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Data="{DynamicResource DrawerPageMenuGlyph}"
|
Data="{DynamicResource DrawerPageMenuGlyph}"
|
||||||
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
|
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
|
||||||
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNull}}"
|
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNull}}"
|
||||||
Theme="{DynamicResource InnerPathIcon}" />
|
Theme="{DynamicResource InnerPathIcon}" />
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_PaneIconPresenter"
|
Name="PART_PaneIconPresenter"
|
||||||
HorizontalAlignment="Center"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Content="{TemplateBinding DrawerIcon}"
|
Content="{TemplateBinding DrawerIcon}"
|
||||||
ContentTemplate="{TemplateBinding DrawerIconTemplate}"
|
ContentTemplate="{TemplateBinding DrawerIconTemplate}"
|
||||||
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
|
Foreground="{DynamicResource DrawerPagePaneButtonForeground}"
|
||||||
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||||
</Panel>
|
</Panel>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<ContentControl
|
<ContentPresenter
|
||||||
Name="PART_TitlePresenter"
|
Name="PART_TitlePresenter"
|
||||||
Margin="8,0,0,0"
|
Margin="8,0,0,0"
|
||||||
VerticalAlignment="Center"
|
|
||||||
VerticalContentAlignment="Center"
|
|
||||||
Content="{TemplateBinding Header}"
|
Content="{TemplateBinding Header}"
|
||||||
FontSize="16"
|
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
||||||
FontWeight="SemiBold"
|
FontSize="{DynamicResource DrawerPageTitleFontSize}"
|
||||||
IsVisible="{TemplateBinding Header,
|
FontWeight="{DynamicResource DrawerPageTitleFontWeight}"
|
||||||
Converter={x:Static ObjectConverters.IsNotNull}}" />
|
IsVisible="{TemplateBinding Header, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Border>
|
</Border>
|
||||||
<Border
|
<Border
|
||||||
Name="PART_BottomBar"
|
Name="PART_BottomBar"
|
||||||
Height="{DynamicResource DrawerPageTopBarMinHeight}"
|
|
||||||
Padding="5"
|
|
||||||
Background="{DynamicResource DrawerPageTopBarBackground}"
|
|
||||||
DockPanel.Dock="Bottom"
|
DockPanel.Dock="Bottom"
|
||||||
|
Height="{DynamicResource DrawerPageTopBarMinHeight}"
|
||||||
|
Background="{DynamicResource DrawerPageTopBarBackground}"
|
||||||
IsVisible="False">
|
IsVisible="False">
|
||||||
<DockPanel HorizontalAlignment="Stretch">
|
<DockPanel>
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
Name="PART_BottomPaneButton"
|
Name="PART_BottomPaneButton"
|
||||||
|
DockPanel.Dock="Left"
|
||||||
AutomationProperties.Name="Toggle navigation drawer"
|
AutomationProperties.Name="Toggle navigation drawer"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
DockPanel.Dock="Left"
|
|
||||||
IsChecked="{Binding #PART_SplitView.IsPaneOpen, Mode=TwoWay}"
|
IsChecked="{Binding #PART_SplitView.IsPaneOpen, Mode=TwoWay}"
|
||||||
ToolTip.Tip="Toggle navigation drawer">
|
ToolTip.Tip="Toggle navigation drawer">
|
||||||
<Panel>
|
<Panel>
|
||||||
<PathIcon
|
<PathIcon
|
||||||
HorizontalAlignment="Center"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Data="{DynamicResource DrawerPaneButtonIcon}"
|
Data="{DynamicResource DrawerPaneButtonIcon}"
|
||||||
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNull}}"
|
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNull}}"
|
||||||
Theme="{DynamicResource InnerPathIcon}" />
|
Theme="{DynamicResource InnerPathIcon}" />
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_BottomPaneIconPresenter"
|
Name="PART_BottomPaneIconPresenter"
|
||||||
HorizontalAlignment="Center"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Content="{TemplateBinding DrawerIcon}"
|
Content="{TemplateBinding DrawerIcon}"
|
||||||
ContentTemplate="{TemplateBinding DrawerIconTemplate}"
|
ContentTemplate="{TemplateBinding DrawerIconTemplate}"
|
||||||
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||||
</Panel>
|
</Panel>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<ContentControl
|
<ContentPresenter
|
||||||
Name="PART_BottomTitlePresenter"
|
Name="PART_BottomTitlePresenter"
|
||||||
Margin="8,0,0,0"
|
Margin="8,0,0,0"
|
||||||
VerticalAlignment="Center"
|
|
||||||
VerticalContentAlignment="Center"
|
|
||||||
Content="{TemplateBinding Header}"
|
Content="{TemplateBinding Header}"
|
||||||
FontSize="16"
|
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
||||||
FontWeight="SemiBold"
|
FontSize="{DynamicResource DrawerPageTitleFontSize}"
|
||||||
IsVisible="{TemplateBinding Header,
|
FontWeight="{DynamicResource DrawerPageTitleFontWeight}"
|
||||||
Converter={x:Static ObjectConverters.IsNotNull}}" />
|
IsVisible="{TemplateBinding Header, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Border>
|
</Border>
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
@@ -178,7 +156,7 @@
|
|||||||
Background="{TemplateBinding BackdropBrush}"
|
Background="{TemplateBinding BackdropBrush}"
|
||||||
IsHitTestVisible="False"
|
IsHitTestVisible="False"
|
||||||
IsVisible="False" />
|
IsVisible="False" />
|
||||||
</Grid>
|
</Panel>
|
||||||
</SplitView>
|
</SplitView>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|||||||
@@ -4,4 +4,7 @@
|
|||||||
|
|
||||||
<!-- DrawerPage pane button -->
|
<!-- DrawerPage pane button -->
|
||||||
<StaticResource x:Key="DrawerPageMenuGlyph" ResourceKey="SemiIconMenu" />
|
<StaticResource x:Key="DrawerPageMenuGlyph" ResourceKey="SemiIconMenu" />
|
||||||
|
|
||||||
|
<StaticResource x:Key="DrawerPageTitleFontSize" ResourceKey="SemiFontSizeHeader6" />
|
||||||
|
<StaticResource x:Key="DrawerPageTitleFontWeight" ResourceKey="SemiFontWeightBold" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|||||||
Reference in New Issue
Block a user