Merge pull request #71 from irihitech/dialog
Dialog System, and MessageBox remake
This commit is contained in:
78
demo/Ursa.Demo/Pages/DialogDemo.axaml
Normal file
78
demo/Ursa.Demo/Pages/DialogDemo.axaml
Normal file
@@ -0,0 +1,78 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.DialogDemo"
|
||||
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:vm="using:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:DialogDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<Grid ColumnDefinitions="Auto, *">
|
||||
<TabControl Grid.Column="0" Width="300">
|
||||
<TabItem Header="Default">
|
||||
<StackPanel>
|
||||
<ToggleSwitch
|
||||
Name="overlay"
|
||||
Content="Window/Overlay"
|
||||
IsChecked="{Binding IsWindow}"
|
||||
OffContent="Overlay"
|
||||
OnContent="Window" />
|
||||
<ToggleSwitch
|
||||
Content="Global/Local"
|
||||
IsVisible="{Binding !#overlay.IsChecked}"
|
||||
IsChecked="{Binding IsGlobal}"
|
||||
OffContent="Local"
|
||||
OnContent="Global" />
|
||||
<ToggleSwitch
|
||||
Content="Modal/Regular"
|
||||
IsVisible="{Binding !#overlay.IsChecked}"
|
||||
IsChecked="{Binding IsModal}"
|
||||
OffContent="Regular"
|
||||
OnContent="Modal" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Buttons" />
|
||||
<ComboBox ItemsSource="{Binding Buttons}" SelectedItem="{Binding SelectedButton}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Mode" />
|
||||
<ComboBox ItemsSource="{Binding Modes}" SelectedItem="{Binding SelectedMode}"/>
|
||||
</StackPanel>
|
||||
<Button Content="Show Dialog" Command="{Binding ShowDialogCommand}" />
|
||||
<TextBlock>
|
||||
<Run Text="Default Result: "></Run>
|
||||
<Run Text="{Binding DefaultResult}"/>
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<Run Text="Dialog Date: "></Run>
|
||||
<Run Text="{Binding Date}"/>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="Custom">
|
||||
<StackPanel>
|
||||
<ToggleSwitch Content="Window/Overlay" OffContent="Overlay" OnContent="Window" IsChecked="{Binding IsWindow}" Name="overlay2" />
|
||||
<ToggleSwitch Content="Global/Local" IsVisible="{Binding !#overlay2.IsChecked}" OffContent="Local" OnContent="Global" IsChecked="{Binding IsGlobal}" />
|
||||
<ToggleSwitch Content="Modal/Regular" IsVisible="{Binding !#overlay2.IsChecked}" OffContent="Regular" OnContent="Modal" IsChecked="{Binding IsModal}" />
|
||||
<Button Content="Show Dialog" Command="{Binding ShowCustomDialogCommand}" />
|
||||
<TextBlock>
|
||||
<Run Text="Custom Result: "></Run>
|
||||
<Run Text="{Binding Result}"/>
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<Run Text="Dialog Date: "></Run>
|
||||
<Run Text="{Binding Date}"/>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<Grid Grid.Column="1">
|
||||
<Border ClipToBounds="True" CornerRadius="20" BorderThickness="1" BorderBrush="{DynamicResource SemiGrey1}">
|
||||
<u:OverlayDialogHost HostId="LocalHost" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/DialogDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/DialogDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class DialogDemo : UserControl
|
||||
{
|
||||
public DialogDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@
|
||||
<ComboBox ItemsSource="{Binding Icons}" SelectedItem="{Binding SelectedIcon}" />
|
||||
<ToggleSwitch Content="Try Long Message" IsChecked="{Binding UseLong}"></ToggleSwitch>
|
||||
<ToggleSwitch Content="Show Title" IsChecked="{Binding UseTitle}"></ToggleSwitch>
|
||||
<ToggleSwitch Content="Overlay" IsChecked="{Binding UseOverlay}"></ToggleSwitch>
|
||||
<Button Command="{Binding DefaultMessageBoxCommand}" Content="Default" />
|
||||
<Button Command="{Binding OkCommand}" Content="OK" />
|
||||
<Button Command="{Binding OkCancelCommand}" Content="OKCancel" />
|
||||
|
||||
Reference in New Issue
Block a user