mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-10-16 23:49:19 +02:00
Add window icon, make the title bar draggable and drop the full-screen caption button
Use the Starter icon for the window and the executable; the whole caption strip drags the window. Extending the client area makes Avalonia 12 add an extra full-screen toggle to the window chrome (which lives in its own host, so it is not reachable from the window's visual tree); it is hidden globally in App.axaml via its WindowDecorationProperties.ElementRole. Standard minimize / maximize / close are kept.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
|
||||
xmlns:chrome="clr-namespace:Avalonia.Controls.Chrome;assembly=Avalonia.Controls"
|
||||
x:Class="StarterNG.App"
|
||||
x:CompileBindings="True"
|
||||
RequestedThemeVariant="Dark">
|
||||
@@ -10,6 +11,15 @@
|
||||
<FluentTheme />
|
||||
<materialIcons:MaterialIconStyles />
|
||||
<StyleInclude Source="avares://Starter/Styles/Carbon.axaml" />
|
||||
|
||||
<!-- Extending the client area (MainWindow) makes Avalonia 12 draw an extra
|
||||
full-screen toggle in the window chrome. The chrome lives in its own host
|
||||
(not the window's visual tree), so it is hidden here, globally, by the
|
||||
decoration role Avalonia tags it with. Standard minimise / maximise /
|
||||
close are left untouched. -->
|
||||
<Style Selector="Button[(chrome|WindowDecorationProperties.ElementRole)=FullScreenButton]">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
</Style>
|
||||
</Application.Styles>
|
||||
<Application.Resources>
|
||||
<PathGeometry x:Key="DiscordLogo" Figures="M 81.15 0 c -1.2376 2.1973 -2.3489 4.4704 -3.3591 6.794 c -9.5975 -1.4396 -19.3718 -1.4396 -28.9945 0 c -0.985 -2.3236 -2.1216 -4.5967 -3.3591 -6.794 c -9.0166 1.5407 -17.8059 4.2431 -26.1405 8.0568 C 2.779 32.5304 -1.6914 56.3725 0.5312 79.8863 c 9.6732 7.1476 20.5083 12.603 32.0505 16.0884 c 2.6014 -3.4854 4.8998 -7.1981 6.8698 -11.0623 c -3.738 -1.3891 -7.3497 -3.1318 -10.8098 -5.1523 c 0.9092 -0.6567 1.7932 -1.3386 2.6519 -1.9953 c 20.281 9.547 43.7696 9.547 64.0758 0 c 0.8587 0.7072 1.7427 1.3891 2.6519 1.9953 c -3.4601 2.0457 -7.0718 3.7632 -10.835 5.1776 c 1.97 3.8642 4.2683 7.5769 6.8698 11.0623 c 11.5419 -3.4854 22.3769 -8.9156 32.0509 -16.0631 c 2.626 -27.2771 -4.496 -50.9172 -18.817 -71.8548 C 98.9811 4.2684 90.1918 1.5659 81.1752 0.0505 l -0.0252 -0.0505 Z M 42.2802 65.4144 c -6.2383 0 -11.4159 -5.6575 -11.4159 -12.6535 s 4.9755 -12.6788 11.3907 -12.6788 s 11.5169 5.708 11.4159 12.6788 c -0.101 6.9708 -5.026 12.6535 -11.3907 12.6535 Z M 84.3576 65.4144 c -6.2637 0 -11.3907 -5.6575 -11.3907 -12.6535 s 4.9755 -12.6788 11.3907 -12.6788 s 11.4917 5.708 11.3906 12.6788 c -0.101 6.9708 -5.026 12.6535 -11.3906 12.6535 Z" FillRule="NonZero"/>
|
||||
|
||||
BIN
StarterNG/Assets/starter.ico
Normal file
BIN
StarterNG/Assets/starter.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
@@ -9,11 +9,14 @@
|
||||
xmlns:views="clr-namespace:StarterNG.Views"
|
||||
xmlns:starterNg="clr-namespace:StarterNG"
|
||||
Title="Starter MaSzyna"
|
||||
Icon="/Assets/starter.ico"
|
||||
Width="1200" Height="768" MinWidth="1200" MinHeight="666"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
<!-- The client area is extended over the title bar in code-behind (the
|
||||
ExtendClientArea* hints), so the logo + nav sit on the top bar while the
|
||||
OS minimise / maximise / close buttons stay in the top-right corner. -->
|
||||
standard minimise / maximise / close buttons stay in the top-right corner.
|
||||
Extending the client area also makes Avalonia 12 add an extra full-screen caption
|
||||
button; it is hidden in App.axaml via its WindowDecorationProperties.ElementRole. -->
|
||||
|
||||
<DockPanel LastChildFill="True">
|
||||
|
||||
@@ -27,27 +30,24 @@
|
||||
BorderThickness="0,0,0,1">
|
||||
<Grid RowDefinitions="32,48">
|
||||
|
||||
<!-- Row 0: title / caption strip. Transparent background makes the
|
||||
whole strip a drag handle (PointerPressed -> BeginMoveDrag),
|
||||
and the OS buttons render at its top-right. The log button sits
|
||||
on top of the strip, just left of the OS min/max/close buttons. -->
|
||||
<StackPanel Orientation="Horizontal" Spacing="16" Grid.Row="0">
|
||||
<Border Background="Transparent"
|
||||
PointerPressed="TitleBar_OnPointerPressed">
|
||||
<TextBlock Text="Starter MaSzyna" VerticalAlignment="Center"
|
||||
Margin="14,0,0,0" FontSize="11"
|
||||
Foreground="{StaticResource CarbonFgDim}" />
|
||||
</Border>
|
||||
<!-- Row 0: title / caption strip. The transparent background spans the
|
||||
whole strip so PointerPressed -> BeginMoveDrag drags the window from
|
||||
anywhere on it (the log button and the OS caption buttons handle their
|
||||
own clicks). The OS min/max/close buttons render at its top-right, so
|
||||
~140px is reserved on the right for them. -->
|
||||
<Grid Grid.Row="0" Background="Transparent"
|
||||
PointerPressed="TitleBar_OnPointerPressed"
|
||||
ColumnDefinitions="*,Auto">
|
||||
<TextBlock Grid.Column="0" Text="Starter MaSzyna" VerticalAlignment="Center"
|
||||
Margin="14,0,0,0" FontSize="11"
|
||||
Foreground="{StaticResource CarbonFgDim}" />
|
||||
|
||||
<!-- Reserve ~140px on the right for the OS caption buttons so the
|
||||
log button lands immediately to their left. -->
|
||||
<Button Classes="Basic" Click="openLastLogClick"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Stretch"
|
||||
Margin="0,0,0,0" Padding="10,0" Cursor="Hand"
|
||||
<Button Grid.Column="1" Classes="Basic" Click="openLastLogClick"
|
||||
VerticalAlignment="Stretch" Margin="0,0,140,0" Padding="10,0" Cursor="Hand"
|
||||
ToolTip.Tip="{Binding [ShowLatestLogTooltip], Source={x:Static starterNg:App.Loc}}">
|
||||
<materialIcons:MaterialIcon Kind="FileDocument" Height="16" Width="16" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- Row 1: logo + navigation (left) and the right cluster (right) -->
|
||||
<Grid Grid.Row="1" ColumnDefinitions="Auto,Auto,*,Auto">
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<ApplicationIcon>Assets\starter.ico</ApplicationIcon>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
<AssemblyVersion>1.2.0.4</AssemblyVersion>
|
||||
<FileVersion>1.2.0.4</FileVersion>
|
||||
@@ -48,6 +49,8 @@
|
||||
<AvaloniaResource Include="Assets\Logo\*.png" />
|
||||
<None Remove="Assets\Test\ep07p.bmp" />
|
||||
<AvaloniaResource Include="Assets\Test\ep07p.bmp" />
|
||||
<None Remove="Assets\starter.ico" />
|
||||
<AvaloniaResource Include="Assets\starter.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user