feat: WIP.

This commit is contained in:
rabbitism
2024-06-25 21:49:23 +08:00
parent 27b8acf714
commit fd9a8668c5
3 changed files with 61 additions and 2 deletions

View File

@@ -1,10 +1,11 @@
<Window <u:UrsaWindow
x:Class="Ursa.Demo.Views.MainWindow" x:Class="Ursa.Demo.Views.MainWindow"
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="clr-namespace:Ursa.Demo.Views" xmlns:views="clr-namespace:Ursa.Demo.Views"
xmlns:u="https://irihi.tech/ursa"
xmlns:viewModels="clr-namespace:Ursa.Demo.ViewModels" xmlns:viewModels="clr-namespace:Ursa.Demo.ViewModels"
Title="Ursa.Demo" Title="Ursa.Demo"
d:DesignHeight="450" d:DesignHeight="450"
@@ -14,4 +15,4 @@
Icon="/Assets/Ursa.ico" Icon="/Assets/Ursa.ico"
mc:Ignorable="d"> mc:Ignorable="d">
<views:MainView /> <views:MainView />
</Window> </u:UrsaWindow>

View File

@@ -0,0 +1,8 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<!-- Add Resources Here -->
<ControlTheme x:Key="{x:Type u:UrsaWindow}" TargetType="u:UrsaWindow">
</ControlTheme>
</ResourceDictionary>

View File

@@ -0,0 +1,50 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Platform;
namespace Ursa.Controls;
/// <summary>
/// Ursa Window is an advanced Window control that provides a lot of features and customization options.
/// </summary>
public class UrsaWindow: Window
{
public static readonly StyledProperty<bool> ShowFullScreenButtonProperty = AvaloniaProperty.Register<UrsaWindow, bool>(
nameof(ShowFullScreenButton), false);
public bool ShowFullScreenButton
{
get => GetValue(ShowFullScreenButtonProperty);
set => SetValue(ShowFullScreenButtonProperty, value);
}
public static readonly StyledProperty<bool> ShowMaximumButtonProperty = AvaloniaProperty.Register<UrsaWindow, bool>(
nameof(ShowMaximumButton));
public bool ShowMaximumButton
{
get => GetValue(ShowMaximumButtonProperty);
set => SetValue(ShowMaximumButtonProperty, value);
}
public static readonly StyledProperty<bool> ShowMinimumButtonProperty = AvaloniaProperty.Register<UrsaWindow, bool>(
nameof(ShowMinimumButton));
public bool ShowMinimumButton
{
get => GetValue(ShowMinimumButtonProperty);
set => SetValue(ShowMinimumButtonProperty, value);
}
public static readonly StyledProperty<bool> ShowCloseButtonProperty = AvaloniaProperty.Register<UrsaWindow, bool>(
nameof(ShowCloseButton));
public bool ShowCloseButton
{
get => GetValue(ShowCloseButtonProperty);
set => SetValue(ShowCloseButtonProperty, value);
}
}