Skip to content

Commit

Permalink
TitleBar contextMenu #329
Browse files Browse the repository at this point in the history
  • Loading branch information
kikipoulet committed Jan 13, 2025
1 parent 12834d9 commit 1770851
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions SukiUI.Demo/SukiUIDemoView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
ShowTitlebarBackground="{Binding ShowTitleBar}" ShowBottomBorder="{Binding ShowBottomBar}"
IsTitleBarVisible="{Binding TitleBarVisible, Mode=TwoWay}"
mc:Ignorable="d">
<suki:SukiWindow.TitleBarContextMenu>
<ContextMenu>
<MenuItem Header="Custom TitleBar Context Menu Item"></MenuItem>
</ContextMenu>
</suki:SukiWindow.TitleBarContextMenu>
<suki:SukiWindow.Hosts>
<suki:SukiToastHost Manager="{Binding ToastManager}"/>
<suki:SukiDialogHost Manager="{Binding DialogManager}"/>
Expand Down
3 changes: 2 additions & 1 deletion SukiUI/Controls/SukiWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
Opacity="0.1" />

<DockPanel LastChildFill="True">
<Panel DockPanel.Dock="Top">
<Panel ContextMenu="{TemplateBinding TitleBarContextMenu}" DockPanel.Dock="Top">

<Panel.Styles>
<Style Selector="suki|SukiWindow[ShowBottomBorder=True] /template/ Border#PART_BottomBorder">
<Setter Property="BorderThickness" Value="0,0,0,1" />
Expand Down
9 changes: 9 additions & 0 deletions SukiUI/Controls/SukiWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ public double TitleFontSize
get => GetValue(TitleFontSizeProperty);
set => SetValue(TitleFontSizeProperty, value);
}

public static readonly StyledProperty<ContextMenu> TitleBarContextMenuProperty =
AvaloniaProperty.Register<SukiWindow, ContextMenu>(nameof(TitleBarContextMenu), defaultValue: null);

public ContextMenu TitleBarContextMenu
{
get => GetValue(TitleBarContextMenuProperty);
set => SetValue(TitleBarContextMenuProperty, value);
}

public static readonly StyledProperty<FontWeight> TitleFontWeightProperty =
AvaloniaProperty.Register<SukiWindow, FontWeight>(nameof(TitleFontWeight), defaultValue: FontWeight.Bold);
Expand Down

0 comments on commit 1770851

Please sign in to comment.