feat: init avalonia demo.
This commit is contained in:
1 parent
adb6355884
commit
63bf5c6aa7
95 files changed
+20896
-2634
No files matched your search
@@ -0,0 +1,51 @@
|
||||
<UserControl x:Class="HandyControlDemo.UserControl.LeftMainContent"
|
||||
Background="{DynamicResource RegionBrush}"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:data="clr-namespace:HandyControlDemo.Data"
|
||||
Margin="16,16,0,16"
|
||||
CornerRadius="10"
|
||||
Effect="{StaticResource EffectShadow4}">
|
||||
<TabControl BorderThickness="0 1 0 0"
|
||||
SelectionChanged="TabControl_OnSelectionChanged"
|
||||
ItemsSource="{Binding DemoInfoCollection}"
|
||||
Background="Transparent"
|
||||
SelectedIndex="0">
|
||||
<TabControl.ItemTemplate>
|
||||
<DataTemplate DataType="data:DemoInfoModel">
|
||||
<TextBlock Text="{Binding Title}" />
|
||||
</DataTemplate>
|
||||
</TabControl.ItemTemplate>
|
||||
<TabControl.ContentTemplate>
|
||||
<DataTemplate DataType="data:DemoInfoModel">
|
||||
<Panel Margin="10">
|
||||
<ListBox SelectionMode="Single"
|
||||
Padding="0"
|
||||
BorderThickness="0"
|
||||
SelectedIndex="{Binding SelectedIndex}"
|
||||
ItemsSource="{Binding DemoItemList}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="data:DemoItemModel">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Rectangle Width="16"
|
||||
Height="16"
|
||||
Fill="{Binding ImageBrush}" />
|
||||
<TextBlock Margin="6,0,0,0"
|
||||
Text="{Binding Name}" />
|
||||
<Path IsVisible="{Binding IsNew}"
|
||||
VerticalAlignment="Center"
|
||||
Data="{StaticResource NewGeometry}"
|
||||
Stretch="Uniform"
|
||||
Margin="10,0,0,0"
|
||||
Width="30"
|
||||
Height="14"
|
||||
Fill="{DynamicResource AccentBrush}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Panel>
|
||||
</DataTemplate>
|
||||
</TabControl.ContentTemplate>
|
||||
</TabControl>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,26 @@
|
||||
using Avalonia.Controls;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using HandyControlDemo.Data;
|
||||
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class LeftMainContent : Avalonia.Controls.UserControl
|
||||
{
|
||||
public LeftMainContent()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void TabControl_OnSelectionChanged(object? _, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (e.AddedItems.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.AddedItems[0] is DemoItemModel demoItem)
|
||||
{
|
||||
WeakReferenceMessenger.Default.Send(demoItem, MessageToken.SwitchDemo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<UserControl x:Class="HandyControlDemo.UserControl.MainContent"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Panel>
|
||||
<Border Margin="16">
|
||||
<Grid MinHeight="300"
|
||||
MinWidth="200"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
RowDefinitions="Auto,*">
|
||||
<Border Grid.RowSpan="2"
|
||||
Background="{DynamicResource RegionBrush}"
|
||||
CornerRadius="10"
|
||||
Effect="{StaticResource EffectShadow4}" />
|
||||
<Border Height="32"
|
||||
Grid.Row="0"
|
||||
CornerRadius="10,10,0,0"
|
||||
Background="{DynamicResource TitleBrush}"
|
||||
Classes="clip">
|
||||
<Panel>
|
||||
<TextBlock Foreground="White"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding ContentTitle}" />
|
||||
</Panel>
|
||||
</Border>
|
||||
<Border Grid.Row="1"
|
||||
ClipToBounds="True">
|
||||
<ContentControl Margin="0,0,0,10"
|
||||
Content="{Binding SubContent}" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Panel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class MainContent : Avalonia.Controls.UserControl
|
||||
{
|
||||
public MainContent()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControlDemo.UserControl"
|
||||
BorderThickness="0,1,0,0"
|
||||
BorderBrush="{DynamicResource BorderBrush}"
|
||||
Background="{StaticResource CloudDrawingBrush}"
|
||||
x:Class="HandyControlDemo.UserControl.MainWindowContent">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="240"
|
||||
MinWidth="240"
|
||||
MaxWidth="400" />
|
||||
<ColumnDefinition MinWidth="200" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<controls:MainContent Grid.Column="1" />
|
||||
<controls:LeftMainContent Grid.Column="0" />
|
||||
<GridSplitter Margin="0,26,0,26"
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="Right"
|
||||
Width="4"
|
||||
Background="Transparent" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class MainWindowContent : Avalonia.Controls.UserControl
|
||||
{
|
||||
public MainWindowContent()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<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"
|
||||
mc:Ignorable="d"
|
||||
d:DesignWidth="800"
|
||||
d:DesignHeight="450"
|
||||
x:Class="HandyControlDemo.UserControl.ButtonDemoCtl"
|
||||
Background="{DynamicResource RegionBrush}">
|
||||
<ScrollViewer>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
VerticalAlignment="Top"
|
||||
Spacing="4"
|
||||
Margin="32">
|
||||
<Button Content="default" />
|
||||
<Button Content="primary"
|
||||
Classes="primary" />
|
||||
<Button Content="success"
|
||||
Classes="success" />
|
||||
<Button Content="info"
|
||||
Classes="info" />
|
||||
<Button Content="warning"
|
||||
Classes="warning" />
|
||||
<Button Content="danger"
|
||||
Classes="danger" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class ButtonDemoCtl : Avalonia.Controls.UserControl
|
||||
{
|
||||
public ButtonDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user