feat: add demo.
This commit is contained in:
19
demo/Ursa.Demo/Pages/PopConfirmDemo.axaml
Normal file
19
demo/Ursa.Demo/Pages/PopConfirmDemo.axaml
Normal file
@@ -0,0 +1,19 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:viewModels="clr-namespace:Ursa.Demo.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800"
|
||||
d:DesignHeight="450"
|
||||
x:DataType="viewModels:PopConfirmDemoViewModel"
|
||||
x:Class="Ursa.Demo.Pages.PopConfirmDemo">
|
||||
<StackPanel HorizontalAlignment="Left">
|
||||
<u:PopConfirm PopupHeader="Header" PopupContent="Content"
|
||||
ConfirmCommand="{Binding Path=ConfirmCommand}"
|
||||
CancelCommand="{Binding Path=CancelCommand}"
|
||||
>
|
||||
<Button Content="Hello World"></Button>
|
||||
</u:PopConfirm>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
25
demo/Ursa.Demo/Pages/PopConfirmDemo.axaml.cs
Normal file
25
demo/Ursa.Demo/Pages/PopConfirmDemo.axaml.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Ursa.Controls;
|
||||
using Ursa.Demo.ViewModels;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class PopConfirmDemo : UserControl
|
||||
{
|
||||
public PopConfirmDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
|
||||
{
|
||||
base.OnAttachedToVisualTree(e);
|
||||
if (this.DataContext is not PopConfirmDemoViewModel vm) return;
|
||||
var manager = WindowToastManager.TryGetToastManager(TopLevel.GetTopLevel(this), out var m)
|
||||
? m
|
||||
: new WindowToastManager(TopLevel.GetTopLevel(this));
|
||||
vm.ToastManager = manager;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user