Merge pull request #334 from irihitech/enumAOT
Revert EnumSlector related demo page
This commit is contained in:
@@ -7,6 +7,11 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
<!-- Uncomment below to enable Native AOT compilation-->
|
||||
<!--
|
||||
<PublishAot>true</PublishAot>
|
||||
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
||||
-->
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -52,11 +52,11 @@
|
||||
OnContent="Yes" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="Buttons" />
|
||||
<ComboBox ItemsSource="{Binding DialogButtons}" SelectedValue="{Binding SelectedButton}" />
|
||||
<u:EnumSelector EnumType="{x:Type u:DialogButton}" Value="{Binding SelectedButton}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="Mode" />
|
||||
<ComboBox ItemsSource="{Binding DialogModes}" SelectedValue="{Binding SelectedMode}" />
|
||||
<u:EnumSelector EnumType="{x:Type u:DialogMode}" Value="{Binding SelectedMode}" />
|
||||
</StackPanel>
|
||||
<Button Command="{Binding ShowDialogCommand}" Content="Show Dialog" />
|
||||
<TextBlock>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="clr-namespace:Ursa.Demo.ViewModels;assembly=Ursa.Demo"
|
||||
xmlns:common="clr-namespace:Ursa.Common;assembly=Ursa"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
@@ -15,7 +16,7 @@
|
||||
<TabControl Grid.Column="0" Width="300">
|
||||
<TabItem Header="Default">
|
||||
<StackPanel>
|
||||
<ComboBox ItemsSource="{Binding Positions}" SelectedValue="{Binding SelectedPosition}" />
|
||||
<u:EnumSelector EnumType="common:Position" Value="{Binding SelectedPosition}" />
|
||||
<ToggleSwitch
|
||||
Content="Global/Local"
|
||||
IsChecked="{Binding IsGlobal}"
|
||||
@@ -33,7 +34,7 @@
|
||||
OnContent="Yes" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Buttons" />
|
||||
<ComboBox ItemsSource="{Binding DialogButtons}" SelectedValue="{Binding SelectedButton}" />
|
||||
<u:EnumSelector EnumType="{x:Type u:DialogButton}" Value="{Binding SelectedButton}" />
|
||||
</StackPanel>
|
||||
<Button Command="{Binding ShowDialogCommand}" Content="Show Default Drawer" />
|
||||
<TextBlock>
|
||||
@@ -48,7 +49,7 @@
|
||||
</TabItem>
|
||||
<TabItem Header="Custom">
|
||||
<StackPanel>
|
||||
<ComboBox ItemsSource="{Binding Positions}" SelectedValue="{Binding SelectedPosition}" />
|
||||
<u:EnumSelector EnumType="common:Position" Value="{Binding SelectedPosition}" />
|
||||
<ToggleSwitch
|
||||
Content="Global/Local"
|
||||
IsChecked="{Binding IsGlobal}"
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<Setter Property="Width" Value="{Binding ItemSelfWidth}" />
|
||||
<Setter Property="Height" Value="{Binding ItemSelfHeight}" />
|
||||
</Style>
|
||||
<Style Selector="ComboBox">
|
||||
<Style Selector="u|EnumSelector">
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
@@ -30,13 +30,13 @@
|
||||
Margin="4 0">
|
||||
<u:FormGroup>
|
||||
<u:FormItem Label="Orientation">
|
||||
<ComboBox ItemsSource="{Binding Orientations}" SelectedValue="{Binding SelectedOrientation}"/>
|
||||
<u:EnumSelector EnumType="Orientation" Value="{Binding SelectedOrientation}" />
|
||||
</u:FormItem>
|
||||
<u:FormItem Label="HorizontalScrollBar">
|
||||
<ComboBox ItemsSource="{Binding ScrollBarVisibilities}" SelectedValue="{Binding HorizontalVisibility}"/>
|
||||
<u:EnumSelector EnumType="ScrollBarVisibility" Value="{Binding HorizontalVisibility}" />
|
||||
</u:FormItem>
|
||||
<u:FormItem Label="VerticalScrollBar">
|
||||
<ComboBox ItemsSource="{Binding ScrollBarVisibilities}" SelectedValue="{Binding VerticalVisibility}"/>
|
||||
<u:EnumSelector EnumType="ScrollBarVisibility" Value="{Binding VerticalVisibility}" />
|
||||
</u:FormItem>
|
||||
<u:FormItem>
|
||||
<u:FormItem.Label>
|
||||
@@ -93,10 +93,10 @@
|
||||
Value="{Binding ItemSelfHeight}" />
|
||||
</u:FormItem>
|
||||
<u:FormItem Label="HorizontalAlignment">
|
||||
<ComboBox ItemsSource="{Binding HorizontalAlignments}" SelectedValue="{Binding CmbHAlign}"/>
|
||||
<u:EnumSelector EnumType="HorizontalAlignment" Value="{Binding CmbHAlign}" />
|
||||
</u:FormItem>
|
||||
<u:FormItem Label="VerticalAlignment">
|
||||
<ComboBox ItemsSource="{Binding VerticalAlignments}" SelectedValue="{Binding CmbVAlign}"/>
|
||||
<u:EnumSelector EnumType="VerticalAlignment" Value="{Binding CmbVAlign}" />
|
||||
</u:FormItem>
|
||||
</u:FormGroup>
|
||||
</u:Form>
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
x:DataType="vm:EnumSelectorDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel>
|
||||
<u:Banner Type="Warning" Header="Native AOT non-compatible" Content="EnumSelector highly relies on reflection, it is not compatible with NativeAOT compilation. " Classes="Warning"></u:Banner>
|
||||
<ToggleSwitch Name="description" Content="Show Description" />
|
||||
<TextBlock Text="Select Type" />
|
||||
<ComboBox
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
x:Class="Ursa.Demo.Pages.FormDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:common="clr-namespace:Ursa.Common;assembly=Ursa"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
@@ -14,21 +15,21 @@
|
||||
<ScrollViewer>
|
||||
<StackPanel>
|
||||
<Grid RowDefinitions="Auto, Auto" ColumnDefinitions="Auto, Auto">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Label Position" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Label Alignment" VerticalAlignment="Center" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1"
|
||||
Name="position"
|
||||
ItemsSource="{Binding Positions}"
|
||||
SelectedValue="{Binding SelectedPosition}" />
|
||||
<ComboBox Grid.Row="1" Grid.Column="1"
|
||||
Name="alignment"
|
||||
ItemsSource="{Binding HorizontalAlignments}"
|
||||
SelectedValue="{Binding SelectedHorizontalAlignment}" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Label Position" VerticalAlignment="Center"></TextBlock>
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Label Alignment" VerticalAlignment="Center"></TextBlock>
|
||||
<u:EnumSelector Grid.Row="0" Grid.Column="1"
|
||||
Name="position"
|
||||
EnumType="common:Position"
|
||||
Value="{x:Static common:Position.Top}" />
|
||||
<u:EnumSelector Grid.Row="1" Grid.Column="1"
|
||||
Name="alignment"
|
||||
EnumType="HorizontalAlignment"
|
||||
Value="{x:Static HorizontalAlignment.Left}" />
|
||||
</Grid>
|
||||
<u:Form
|
||||
DataContext="{Binding Model}"
|
||||
LabelAlignment="{Binding #alignment.SelectedValue}"
|
||||
LabelPosition="{Binding #position.SelectedValue}"
|
||||
LabelAlignment="{Binding #alignment.Value}"
|
||||
LabelPosition="{Binding #position.Value}"
|
||||
LabelWidth="*">
|
||||
<u:FormGroup Header="Information">
|
||||
<TextBox
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
x:Class="Ursa.Demo.Pages.IconButtonDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:common="clr-namespace:Ursa.Common;assembly=Ursa"
|
||||
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="clr-namespace:Ursa.Demo.ViewModels"
|
||||
x:DataType="vm:IconButtonDemoViewModel"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
@@ -15,16 +14,14 @@
|
||||
</UserControl.Resources>
|
||||
<StackPanel HorizontalAlignment="Left" Spacing="16">
|
||||
<ToggleSwitch Name="loading" Content="Toggle Loading" />
|
||||
<ComboBox Name="placement"
|
||||
ItemsSource="{Binding Positions}"
|
||||
SelectedValue="{Binding SelectedPosition}" />
|
||||
<u:EnumSelector Name="placement" EnumType="{x:Type common:Position}" />
|
||||
<u:IconButton
|
||||
Content="Hello World"
|
||||
IconPlacement="{Binding #placement.SelectedValue}"
|
||||
IconPlacement="{Binding #placement.Value}"
|
||||
IsLoading="{Binding #loading.IsChecked}" />
|
||||
<u:IconButton
|
||||
Content="Hello Panda"
|
||||
IconPlacement="{Binding #placement.SelectedValue}"
|
||||
IconPlacement="{Binding #placement.Value}"
|
||||
IsLoading="{Binding #loading.IsChecked}">
|
||||
<u:IconButton.Icon>
|
||||
<TextBlock
|
||||
@@ -35,7 +32,7 @@
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
Content="GitHub"
|
||||
IconPlacement="{Binding #placement.SelectedValue}"
|
||||
IconPlacement="{Binding #placement.Value}"
|
||||
IsLoading="{Binding #loading.IsChecked}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
@@ -47,7 +44,7 @@
|
||||
<u:IconButton
|
||||
Width="150"
|
||||
Content="GitHub"
|
||||
IconPlacement="{Binding #placement.SelectedValue}"
|
||||
IconPlacement="{Binding #placement.Value}"
|
||||
IsLoading="{Binding #loading.IsChecked}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
@@ -60,7 +57,7 @@
|
||||
Width="150"
|
||||
Classes="Warning"
|
||||
Content="GitHub"
|
||||
IconPlacement="{Binding #placement.SelectedValue}"
|
||||
IconPlacement="{Binding #placement.Value}"
|
||||
IsLoading="{Binding #loading.IsChecked}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
@@ -72,7 +69,7 @@
|
||||
<u:IconButton
|
||||
Width="150"
|
||||
Content="GitHub"
|
||||
IconPlacement="{Binding #placement.SelectedValue}"
|
||||
IconPlacement="{Binding #placement.Value}"
|
||||
IsLoading="{Binding #loading.IsChecked}"
|
||||
Theme="{DynamicResource SolidIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
@@ -86,7 +83,7 @@
|
||||
Width="150"
|
||||
Classes="Warning"
|
||||
Content="GitHub"
|
||||
IconPlacement="{Binding #placement.SelectedValue}"
|
||||
IconPlacement="{Binding #placement.Value}"
|
||||
IsLoading="{Binding #loading.IsChecked}"
|
||||
Theme="{DynamicResource SolidIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
|
||||
@@ -19,13 +19,11 @@
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid ColumnDefinitions="Auto, Auto, *" RowDefinitions="Auto, Auto, *">
|
||||
<ComboBox Name="Orientation"
|
||||
ItemsSource="{Binding Orientations}"
|
||||
SelectedValue="{Binding SelectedOrientation}"/>
|
||||
<u:EnumSelector Name="Orientation" EnumType="Orientation" />
|
||||
<u:ToolBar
|
||||
DockPanel.Dock="Top"
|
||||
Header="Hello World"
|
||||
Orientation="{Binding #Orientation.SelectedValue}">
|
||||
Orientation="{Binding #Orientation.Value}">
|
||||
<Button u:ToolBar.OverflowMode="Never" Content="Button 1" />
|
||||
<u:ToolBarSeparator />
|
||||
<TextBox Width="100" VerticalAlignment="Center"></TextBox>
|
||||
@@ -54,7 +52,7 @@
|
||||
<u:ToolBar
|
||||
DockPanel.Dock="Top"
|
||||
ItemsSource="{Binding Items}"
|
||||
Orientation="{Binding #Orientation.SelectedValue}">
|
||||
Orientation="{Binding #Orientation.Value}">
|
||||
<u:ToolBar.ItemTemplate>
|
||||
<template:ToolBarItemTemplateSelector />
|
||||
</u:ToolBar.ItemTemplate>
|
||||
|
||||
@@ -25,25 +25,6 @@ public partial class DialogDemoViewModel: ObservableObject
|
||||
[ObservableProperty] private DateTime? _date;
|
||||
[ObservableProperty] private bool _fullScreen;
|
||||
[ObservableProperty] private bool _showInTaskBar;
|
||||
|
||||
public ObservableCollection<DialogButton> DialogButtons =>
|
||||
[
|
||||
DialogButton.None,
|
||||
DialogButton.OK,
|
||||
DialogButton.OKCancel,
|
||||
DialogButton.YesNo,
|
||||
DialogButton.YesNoCancel,
|
||||
];
|
||||
|
||||
public ObservableCollection<DialogMode> DialogModes =>
|
||||
[
|
||||
DialogMode.Info,
|
||||
DialogMode.Warning,
|
||||
DialogMode.Error,
|
||||
DialogMode.Question,
|
||||
DialogMode.None,
|
||||
DialogMode.Success,
|
||||
];
|
||||
|
||||
public DialogDemoViewModel()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
@@ -25,23 +24,6 @@ public partial class DrawerDemoViewModel : ObservableObject
|
||||
[ObservableProperty] private bool _isModal;
|
||||
[ObservableProperty] private DateTime? _date;
|
||||
|
||||
public ObservableCollection<Position> Positions =>
|
||||
[
|
||||
Position.Left,
|
||||
Position.Top,
|
||||
Position.Right,
|
||||
Position.Bottom,
|
||||
];
|
||||
|
||||
public ObservableCollection<DialogButton> DialogButtons =>
|
||||
[
|
||||
DialogButton.None,
|
||||
DialogButton.OK,
|
||||
DialogButton.OKCancel,
|
||||
DialogButton.YesNo,
|
||||
DialogButton.YesNoCancel,
|
||||
];
|
||||
|
||||
public DrawerDemoViewModel()
|
||||
{
|
||||
ShowDialogCommand = new AsyncRelayCommand(ShowDefaultDialog);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Layout;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
@@ -24,35 +23,6 @@ public partial class ElasticWrapPanelDemoViewModel : ObservableObject
|
||||
[ObservableProperty] private HorizontalAlignment _cmbHAlign = HorizontalAlignment.Left;
|
||||
[ObservableProperty] private VerticalAlignment _cmbVAlign = VerticalAlignment.Stretch;
|
||||
|
||||
public ObservableCollection<Orientation> Orientations =>
|
||||
[
|
||||
Orientation.Horizontal,
|
||||
Orientation.Vertical,
|
||||
];
|
||||
|
||||
public ObservableCollection<ScrollBarVisibility> ScrollBarVisibilities =>
|
||||
[
|
||||
ScrollBarVisibility.Auto,
|
||||
ScrollBarVisibility.Hidden,
|
||||
ScrollBarVisibility.Visible,
|
||||
];
|
||||
|
||||
public ObservableCollection<HorizontalAlignment> HorizontalAlignments =>
|
||||
[
|
||||
HorizontalAlignment.Left,
|
||||
HorizontalAlignment.Center,
|
||||
HorizontalAlignment.Right,
|
||||
HorizontalAlignment.Stretch,
|
||||
];
|
||||
|
||||
public ObservableCollection<VerticalAlignment> VerticalAlignments =>
|
||||
[
|
||||
VerticalAlignment.Top,
|
||||
VerticalAlignment.Center,
|
||||
VerticalAlignment.Bottom,
|
||||
VerticalAlignment.Stretch,
|
||||
];
|
||||
|
||||
private double _oldItemSelfWidth;
|
||||
private double _oldItemSelfHeight;
|
||||
|
||||
|
||||
@@ -1,33 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Avalonia.Layout;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Ursa.Common;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public partial class FormDemoViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty] private DataModel _model;
|
||||
[ObservableProperty] private Position _selectedPosition = Position.Top;
|
||||
[ObservableProperty] private HorizontalAlignment _selectedHorizontalAlignment = HorizontalAlignment.Left;
|
||||
|
||||
public ObservableCollection<Position> Positions =>
|
||||
[
|
||||
Position.Left,
|
||||
Position.Top,
|
||||
Position.Right,
|
||||
Position.Bottom,
|
||||
];
|
||||
|
||||
public ObservableCollection<HorizontalAlignment> HorizontalAlignments =>
|
||||
[
|
||||
HorizontalAlignment.Stretch,
|
||||
HorizontalAlignment.Left,
|
||||
HorizontalAlignment.Center,
|
||||
HorizontalAlignment.Right,
|
||||
];
|
||||
|
||||
public FormDemoViewModel()
|
||||
{
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Ursa.Common;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public partial class IconButtonDemoViewModel : ObservableObject
|
||||
public class IconButtonDemoViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty] private Position _selectedPosition = Position.Top;
|
||||
|
||||
public ObservableCollection<Position> Positions =>
|
||||
[
|
||||
Position.Left,
|
||||
Position.Top,
|
||||
Position.Right,
|
||||
Position.Bottom,
|
||||
];
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
using Avalonia.Layout;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Ursa.Controls;
|
||||
@@ -9,14 +8,6 @@ namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public partial class ToolBarDemoViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty] private Orientation _selectedOrientation;
|
||||
|
||||
public ObservableCollection<Orientation> Orientations =>
|
||||
[
|
||||
Orientation.Horizontal,
|
||||
Orientation.Vertical
|
||||
];
|
||||
|
||||
public ObservableCollection<ToolBarItemViewModel> Items { get; set; }
|
||||
|
||||
public ToolBarDemoViewModel()
|
||||
@@ -76,6 +67,7 @@ public class ToolBarComboBoxItemViewModel : ToolBarItemViewModel
|
||||
public ObservableCollection<string>? Items { get; set; }
|
||||
|
||||
private string? _selectedItem;
|
||||
|
||||
public string? SelectedItem
|
||||
{
|
||||
get => _selectedItem;
|
||||
|
||||
Reference in New Issue
Block a user