mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-03-03 00:00:55 +08:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7314fbc9c | ||
|
|
4a0da34d56 | ||
|
|
6edfba9595 | ||
|
|
9f9ba4c91b | ||
|
|
5aa8e2e10d | ||
|
|
755777fd73 | ||
|
|
1b647f7984 | ||
|
|
fc0fdef07f | ||
|
|
c61ac70125 | ||
|
|
d5eec907a3 | ||
|
|
ca6e04e18a | ||
|
|
f3f59bd5b2 | ||
|
|
0f63bc68bc | ||
|
|
f46bd16904 | ||
|
|
ddad2a80d5 | ||
|
|
e10e83d282 | ||
|
|
9de52992b4 | ||
|
|
61fef49023 | ||
|
|
05385a733c | ||
|
|
646c9c0dbb | ||
|
|
925c368c53 |
6
Nuget.Config
Normal file
6
Nuget.Config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="avalonia-nightly" value="https://nuget-feed-nightly.avaloniaui.net/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
@@ -1,13 +1,13 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
<AvaloniaVersion>11.3.10</AvaloniaVersion>
|
||||
<AvaloniaVersion>12.0.999-cibuild0061987-alpha</AvaloniaVersion>
|
||||
<DataGridVersion>11.3.10</DataGridVersion>
|
||||
<SkiaSharpVersion>3.119.1</SkiaSharpVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)"/>
|
||||
<PackageVersion Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
|
||||
<!-- <PackageVersion Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />-->
|
||||
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
|
||||
<PackageVersion Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)"/>
|
||||
<PackageVersion Include="Avalonia.iOS" Version="$(AvaloniaVersion)" />
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Semi.Avalonia.Demo.Android;
|
||||
MainLauncher = true,
|
||||
LaunchMode = LaunchMode.SingleTop,
|
||||
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
|
||||
public class MainActivity : AvaloniaMainActivity<App>
|
||||
public class MainActivity : AvaloniaMainActivity
|
||||
{
|
||||
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
|
||||
{
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
<semi:SemiTheme Locale="zh-CN" />
|
||||
<semi:SemiPopupAnimations />
|
||||
<semi:ColorPickerSemiTheme />
|
||||
<semi:DataGridSemiTheme />
|
||||
<semi:TreeDataGridSemiTheme />
|
||||
<!-- <semi:DataGridSemiTheme /> -->
|
||||
<!-- <semi:TreeDataGridSemiTheme /> -->
|
||||
</Application.Styles>
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input.Platform;
|
||||
using Avalonia.Media;
|
||||
using Semi.Avalonia.Demo.Converters;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</StackPanel.Styles>
|
||||
|
||||
<AutoCompleteBox
|
||||
Watermark="Please select a State"
|
||||
PlaceholderText="Please select a State"
|
||||
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
|
||||
<AutoCompleteBox
|
||||
Classes="Large"
|
||||
@@ -41,7 +41,7 @@
|
||||
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
|
||||
<AutoCompleteBox
|
||||
IsEnabled="False"
|
||||
Watermark="Disabled"
|
||||
PlaceholderText="Disabled"
|
||||
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
|
||||
<AutoCompleteBox
|
||||
InnerLeftContent="https://"
|
||||
@@ -52,16 +52,16 @@
|
||||
<AutoCompleteBox
|
||||
Width="100"
|
||||
Classes="Large"
|
||||
Watermark="Large"
|
||||
PlaceholderText="Large"
|
||||
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
|
||||
<AutoCompleteBox
|
||||
Width="100"
|
||||
Watermark="Default"
|
||||
PlaceholderText="Default"
|
||||
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
|
||||
<AutoCompleteBox
|
||||
Width="100"
|
||||
Classes="Small"
|
||||
Watermark="Small"
|
||||
PlaceholderText="Small"
|
||||
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
|
||||
</StackPanel>
|
||||
|
||||
@@ -69,12 +69,12 @@
|
||||
<AutoCompleteBox
|
||||
Width="100"
|
||||
IsEnabled="False"
|
||||
Watermark="Disabled"
|
||||
PlaceholderText="Disabled"
|
||||
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
|
||||
<AutoCompleteBox
|
||||
Width="100"
|
||||
Classes="Bordered"
|
||||
Watermark="Bordered"
|
||||
PlaceholderText="Bordered"
|
||||
ValueMemberBinding="{Binding Name,DataType=vm:StateData}" />
|
||||
<AutoCompleteBox
|
||||
Width="100"
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
<UserControl
|
||||
x:Class="Semi.Avalonia.Demo.Pages.DataGridDemo"
|
||||
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:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels;assembly=Semi.Avalonia.Demo"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:DataType="vm:DataGridDemoViewModel"
|
||||
mc:Ignorable="d">
|
||||
<TabControl>
|
||||
<TabItem Header="DataGrid">
|
||||
<Grid RowDefinitions="Auto, *">
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||
<ToggleSwitch Content="Enable" Name="enable" IsChecked="True" />
|
||||
<ToggleSwitch Content="Inset Content" Name="inset" />
|
||||
<ToggleSwitch Content="ScrollBar Auto Hide" Name="autohide" />
|
||||
</StackPanel>
|
||||
<DataGrid Grid.Row="1"
|
||||
Margin="8"
|
||||
CanUserReorderColumns="True"
|
||||
CanUserResizeColumns="True"
|
||||
CanUserSortColumns="True"
|
||||
HeadersVisibility="All"
|
||||
IsReadOnly="True"
|
||||
Classes.InsetContent="{Binding #inset.IsChecked}"
|
||||
ScrollViewer.AllowAutoHide="{Binding #autohide.IsChecked}"
|
||||
IsEnabled="{Binding #enable.IsChecked}"
|
||||
ItemsSource="{Binding GridData1}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vm:Song"
|
||||
Binding="{Binding Title}"
|
||||
Header="Title" />
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vm:Song"
|
||||
Binding="{Binding Artist}"
|
||||
Header="Artist" />
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vm:Song"
|
||||
Binding="{Binding Album}"
|
||||
Header="Album" />
|
||||
<DataGridTemplateColumn Header="Duration" SortMemberPath="Duration">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock
|
||||
Margin="8,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Duration}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Grouping">
|
||||
<DataGrid
|
||||
Margin="8"
|
||||
CanUserReorderColumns="True"
|
||||
CanUserResizeColumns="True"
|
||||
CanUserSortColumns="True"
|
||||
HeadersVisibility="All"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding GridData2}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vm:Song"
|
||||
Binding="{Binding Title}"
|
||||
Header="Title" />
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vm:Song"
|
||||
Binding="{Binding Artist}"
|
||||
Header="Artist" />
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vm:Song"
|
||||
Binding="{Binding Album}"
|
||||
Header="Album" />
|
||||
<DataGridTemplateColumn
|
||||
x:DataType="vm:Song"
|
||||
Header="Duration"
|
||||
SortMemberPath="Duration">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate x:DataType="vm:Song">
|
||||
<TextBlock
|
||||
Margin="8,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Duration}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</TabItem>
|
||||
<TabItem Name="EditableTab" Header="Editable">
|
||||
<Grid Margin="8" RowDefinitions="Auto,*,Auto">
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="4">
|
||||
<TextBlock VerticalAlignment="Center" Text="FontSize:" />
|
||||
<Slider
|
||||
Name="FontSizeSlider"
|
||||
Width="100"
|
||||
VerticalAlignment="Center"
|
||||
Maximum="30"
|
||||
Minimum="5"
|
||||
Value="14" />
|
||||
<CheckBox
|
||||
Name="IsThreeStateCheckBox"
|
||||
Content="IsThreeState"
|
||||
IsChecked="False" />
|
||||
</StackPanel>
|
||||
<DataGrid
|
||||
Grid.Row="1"
|
||||
Margin="8"
|
||||
ItemsSource="{Binding GridData3}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridCheckBoxColumn
|
||||
Width="2*"
|
||||
Binding="{Binding IsSelected}"
|
||||
Header="Select"
|
||||
IsThreeState="{Binding #IsThreeStateCheckBox.IsChecked, Mode=OneWay}" />
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vm:SongViewModel"
|
||||
Binding="{Binding Title}"
|
||||
FontSize="{Binding #FontSizeSlider.Value, Mode=OneWay}"
|
||||
Header="Title" />
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vm:SongViewModel"
|
||||
Binding="{Binding Artist}"
|
||||
Header="Artist" />
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vm:SongViewModel"
|
||||
Binding="{Binding Album}"
|
||||
Header="Album" />
|
||||
<DataGridTemplateColumn Width="2*" Header="Comments">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding CountOfComment}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate>
|
||||
<DataTemplate>
|
||||
<NumericUpDown
|
||||
HorizontalAlignment="Stretch"
|
||||
FormatString="N0"
|
||||
Minimum="0"
|
||||
Value="{Binding CountOfComment}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button
|
||||
Grid.Row="2"
|
||||
Margin="12,0,12,12"
|
||||
HorizontalAlignment="Right"
|
||||
Command="{Binding AddCommand}"
|
||||
Content="Add" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</UserControl>
|
||||
@@ -1,13 +0,0 @@
|
||||
using Avalonia.Controls;
|
||||
using Semi.Avalonia.Demo.ViewModels;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Pages;
|
||||
|
||||
public partial class DataGridDemo : UserControl
|
||||
{
|
||||
public DataGridDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = new DataGridDemoViewModel();
|
||||
}
|
||||
}
|
||||
@@ -36,10 +36,20 @@
|
||||
<HyperlinkButton HorizontalAlignment="Right" Content="更多" />
|
||||
</Panel>
|
||||
</HeaderedContentControl.Header>
|
||||
<HeaderedContentControl.Content>
|
||||
<SelectableTextBlock Text="Semi Design 是由互娱社区前端团队与 UED 团队共同设计开发并维护的设计系统。设计系统包含设计语言以及一整套可复用的前端组件,帮助设计师与开发者更容易地打造高质量的、用户体验一致的、符合设计规范的 Web 应用。" />
|
||||
</HeaderedContentControl.Content>
|
||||
<SelectableTextBlock Text="Semi Design 是由互娱社区前端团队与 UED 团队共同设计开发并维护的设计系统。设计系统包含设计语言以及一整套可复用的前端组件,帮助设计师与开发者更容易地打造高质量的、用户体验一致的、符合设计规范的 Web 应用。" />
|
||||
</HeaderedContentControl>
|
||||
<TextBlock>Real GroupBox</TextBlock>
|
||||
<GroupBox
|
||||
HorizontalAlignment="Left"
|
||||
MaxWidth="360">
|
||||
<HeaderedContentControl.Header>
|
||||
<Panel>
|
||||
<SelectableTextBlock Text="Semi Design" />
|
||||
<HyperlinkButton HorizontalAlignment="Right" Content="更多" />
|
||||
</Panel>
|
||||
</HeaderedContentControl.Header>
|
||||
<SelectableTextBlock Text="Semi Design 是由互娱社区前端团队与 UED 团队共同设计开发并维护的设计系统。设计系统包含设计语言以及一整套可复用的前端组件,帮助设计师与开发者更容易地打造高质量的、用户体验一致的、符合设计规范的 Web 应用。" />
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -1,327 +0,0 @@
|
||||
<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:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
||||
xmlns:controls="clr-namespace:Semi.Avalonia.Demo.Controls"
|
||||
xmlns:cvt="clr-namespace:Semi.Avalonia.Demo.Converters"
|
||||
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
|
||||
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="1450"
|
||||
x:DataType="vm:HighContrastDemoViewModel"
|
||||
x:Class="Semi.Avalonia.Demo.Pages.HighContrastDemo">
|
||||
<Design.DataContext>
|
||||
<vm:HighContrastDemoViewModel />
|
||||
</Design.DataContext>
|
||||
<SplitView
|
||||
Name="splitView"
|
||||
CompactPaneLength="50"
|
||||
DisplayMode="CompactInline"
|
||||
IsPaneOpen="{Binding #toggle.IsChecked, Mode=TwoWay}"
|
||||
OpenPaneLength="300"
|
||||
PanePlacement="Right">
|
||||
<SplitView.Pane>
|
||||
<StackPanel>
|
||||
<ToggleSwitch
|
||||
Name="toggle"
|
||||
HorizontalAlignment="Right"
|
||||
IsChecked="True"
|
||||
Theme="{DynamicResource IconBorderlessToggleSwitch}"
|
||||
Content="{StaticResource SemiIconSidebar}" />
|
||||
<Border IsVisible="{Binding #splitView.IsPaneOpen}" Theme="{DynamicResource CardBorder}">
|
||||
<Panel>
|
||||
<TextBlock
|
||||
IsVisible="{Binding SelectedColorResource, Converter={x:Static ObjectConverters.IsNull}}"
|
||||
Text="Click on Color to Check Details"
|
||||
TextWrapping="Wrap" />
|
||||
<controls:ColorDetailControl
|
||||
Background="{Binding SelectedColorResource.Brush}"
|
||||
IsVisible="{Binding SelectedColorResource, Converter={x:Static ObjectConverters.IsNotNull}}"
|
||||
ResourceKey="{Binding SelectedColorResource.ResourceKey}"
|
||||
ResourceName="{Binding SelectedColorResource.ResourceKey}" />
|
||||
</Panel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</SplitView.Pane>
|
||||
<SplitView.Content>
|
||||
<ScrollViewer>
|
||||
<StackPanel Spacing="10">
|
||||
<TextBlock Text="Theme Preview" FontWeight="SemiBold" />
|
||||
<ListBox
|
||||
Theme="{StaticResource PureCardRadioGroupListBox}"
|
||||
ItemsSource="{Binding ThemeVariants}"
|
||||
SelectedItem="{Binding SelectedThemeVariant}">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel HorizontalAlignment="Left" Spacing="5" MinWidth="200">
|
||||
<ThemeVariantScope RequestedThemeVariant="{Binding}">
|
||||
<Border
|
||||
Padding="5 25 5 5"
|
||||
HorizontalAlignment="Left"
|
||||
Background="{DynamicResource WindowColor}"
|
||||
BorderBrush="{DynamicResource WindowTextColor}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="3">
|
||||
<StackPanel Spacing="10">
|
||||
<StackPanel Orientation="Horizontal" Spacing="50">
|
||||
<StackPanel Spacing="5">
|
||||
<TextBlock
|
||||
FontSize="50"
|
||||
Text="Aa" />
|
||||
<StackPanel Orientation="Horizontal" Spacing="3">
|
||||
<StackPanel.Styles>
|
||||
<Style Selector="Border">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource WindowTextColor}" />
|
||||
<Setter Property="CornerRadius" Value="5" />
|
||||
<Setter Property="Width" Value="10" />
|
||||
<Setter Property="Height" Value="{Binding $self.Width}" />
|
||||
</Style>
|
||||
</StackPanel.Styles>
|
||||
<Border Background="{DynamicResource WindowColor}" />
|
||||
<Border Background="{DynamicResource HotlightColor}" />
|
||||
<Border Background="{DynamicResource GrayTextColor}" />
|
||||
<Border Background="{DynamicResource HighlightTextColor}" />
|
||||
<Border Background="{DynamicResource HighlightColor}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<Border
|
||||
BorderThickness="1"
|
||||
BorderBrush="{DynamicResource WindowTextColor}"
|
||||
CornerRadius="3"
|
||||
Padding="8">
|
||||
<Panel>
|
||||
<StackPanel Spacing="5">
|
||||
<Border
|
||||
Width="50"
|
||||
Height="1"
|
||||
Background="{DynamicResource WindowTextColor}" />
|
||||
<Border
|
||||
Height="1"
|
||||
Background="{DynamicResource WindowTextColor}" />
|
||||
<Border
|
||||
Height="1"
|
||||
Background="{DynamicResource WindowTextColor}" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Orientation="Horizontal"
|
||||
Spacing="2">
|
||||
<Border
|
||||
Width="20"
|
||||
Height="5"
|
||||
Background="{DynamicResource HighlightColor}"
|
||||
CornerRadius="1" />
|
||||
<Border
|
||||
Width="20"
|
||||
Height="5"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{DynamicResource ButtonTextColor}"
|
||||
CornerRadius="1" />
|
||||
</StackPanel>
|
||||
</Panel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<Border
|
||||
Height="1"
|
||||
Background="{DynamicResource WindowTextColor}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</ThemeVariantScope>
|
||||
<TextBlock Text="{Binding}" FontWeight="SemiBold" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<ThemeVariantScope
|
||||
MinWidth="400"
|
||||
RequestedThemeVariant="{Binding SelectedThemeVariant}">
|
||||
<Border Padding="10" Background="{DynamicResource WindowColor}">
|
||||
<StackPanel Spacing="16">
|
||||
<StackPanel.Styles>
|
||||
<Style Selector="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
</Style>
|
||||
<Style Selector="controls|ColorItemControl.ColorBlock">
|
||||
<Setter Property="Width" Value="44" />
|
||||
<Setter Property="Height" Value="{Binding $self.Width}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource WindowTextColor}" />
|
||||
<Setter Property="CornerRadius" Value="3" />
|
||||
</Style>
|
||||
</StackPanel.Styles>
|
||||
<Panel>
|
||||
<TextBlock
|
||||
Foreground="{DynamicResource WindowTextColor}"
|
||||
Text="Background" />
|
||||
<controls:ColorItemControl
|
||||
Classes="ColorBlock"
|
||||
DataContext="{Binding ColorResources[0]}"
|
||||
Background="{DynamicResource WindowColor}" />
|
||||
</Panel>
|
||||
<Panel>
|
||||
<TextBlock
|
||||
Foreground="{DynamicResource WindowTextColor}"
|
||||
Text="Text" />
|
||||
<controls:ColorItemControl
|
||||
Classes="ColorBlock"
|
||||
DataContext="{Binding ColorResources[1]}"
|
||||
Background="{DynamicResource WindowTextColor}" />
|
||||
</Panel>
|
||||
<Panel>
|
||||
<TextBlock
|
||||
Foreground="{DynamicResource HotlightColor}"
|
||||
TextDecorations="Underline"
|
||||
Text="Hyperlink" />
|
||||
<controls:ColorItemControl
|
||||
Classes="ColorBlock"
|
||||
DataContext="{Binding ColorResources[2]}"
|
||||
Background="{DynamicResource HotlightColor}" />
|
||||
</Panel>
|
||||
<Panel>
|
||||
<TextBlock
|
||||
Foreground="{DynamicResource GrayTextColor}"
|
||||
Text="Inactive Text" />
|
||||
<controls:ColorItemControl
|
||||
Classes="ColorBlock"
|
||||
DataContext="{Binding ColorResources[3]}"
|
||||
Background="{DynamicResource GrayTextColor}" />
|
||||
</Panel>
|
||||
<Panel>
|
||||
<TextBlock
|
||||
Foreground="{DynamicResource HighlightTextColor}"
|
||||
Background="{DynamicResource HighlightColor}"
|
||||
Text="Selected text" />
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="4">
|
||||
<controls:ColorItemControl
|
||||
Classes="ColorBlock"
|
||||
DataContext="{Binding ColorResources[4]}"
|
||||
Background="{DynamicResource HighlightTextColor}" />
|
||||
<controls:ColorItemControl
|
||||
Classes="ColorBlock"
|
||||
DataContext="{Binding ColorResources[5]}"
|
||||
Background="{DynamicResource HighlightColor}" />
|
||||
</StackPanel>
|
||||
</Panel>
|
||||
<Panel>
|
||||
<Border
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
BorderBrush="{DynamicResource ButtonTextColor}"
|
||||
Background="{DynamicResource ButtonFaceColor}"
|
||||
BorderThickness="2"
|
||||
CornerRadius="3">
|
||||
<TextBlock
|
||||
Foreground="{DynamicResource ButtonTextColor}"
|
||||
Padding="16 6"
|
||||
Text="Button text" />
|
||||
</Border>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="4">
|
||||
<controls:ColorItemControl
|
||||
Classes="ColorBlock"
|
||||
DataContext="{Binding ColorResources[6]}"
|
||||
Background="{DynamicResource ButtonTextColor}" />
|
||||
<controls:ColorItemControl
|
||||
Classes="ColorBlock"
|
||||
DataContext="{Binding ColorResources[7]}"
|
||||
Background="{DynamicResource ButtonFaceColor}" />
|
||||
</StackPanel>
|
||||
</Panel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</ThemeVariantScope>
|
||||
|
||||
<DataGrid
|
||||
HorizontalAlignment="Left"
|
||||
CanUserSortColumns="False"
|
||||
AutoGenerateColumns="False"
|
||||
ItemsSource="{Binding ColorResources}"
|
||||
GridLinesVisibility="All"
|
||||
BorderBrush="{DynamicResource SemiColorBorder}"
|
||||
BorderThickness="1"
|
||||
Padding="5">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Header="Color">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<controls:ColorItemControl
|
||||
Width="40"
|
||||
Height="20"
|
||||
CornerRadius="3"
|
||||
Background="{Binding Brush}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="ResourceKey">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<SelectableTextBlock
|
||||
Margin="12 0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding ResourceKey}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="Hex">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<SelectableTextBlock
|
||||
Margin="12 0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Brush,
|
||||
Converter={x:Static cvt:ColorConverter.ToHex},ConverterParameter={x:False}}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="Description">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<SelectableTextBlock
|
||||
Margin="12 0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Description}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="Pair With">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<SelectableTextBlock
|
||||
Margin="12 0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding PairWith}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Width="100" Header="CopyText">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="vm:ColorResource">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:HighContrastDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</SplitView.Content>
|
||||
</SplitView>
|
||||
</UserControl>
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using Semi.Avalonia.Demo.ViewModels;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Pages;
|
||||
|
||||
public partial class HighContrastDemo : UserControl
|
||||
{
|
||||
public HighContrastDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new HighContrastDemoViewModel();
|
||||
}
|
||||
|
||||
public async Task Copy(object? o)
|
||||
{
|
||||
if (o is null) return;
|
||||
var toplevel = TopLevel.GetTopLevel(this);
|
||||
if (toplevel?.Clipboard is { } c)
|
||||
{
|
||||
await c.SetTextAsync(o.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,15 +28,15 @@
|
||||
<NumericUpDown
|
||||
Width="100"
|
||||
Classes="Large"
|
||||
Watermark="Large"
|
||||
PlaceholderText="Large"
|
||||
ButtonSpinnerLocation="Left" />
|
||||
<NumericUpDown
|
||||
Width="100"
|
||||
Watermark="Default"
|
||||
PlaceholderText="Default"
|
||||
ShowButtonSpinner="False" />
|
||||
<NumericUpDown
|
||||
Width="100"
|
||||
Watermark="Small"
|
||||
PlaceholderText="Small"
|
||||
Classes="Small" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@@ -353,12 +353,12 @@
|
||||
<StackPanel>
|
||||
<TextBlock Text="Install via nuget: " />
|
||||
<Border Margin="0,16" Classes="CodeBlock">
|
||||
<SelectableTextBlock FontFamily="Consolas" Text="{Binding $parent[local:Overview].MainInstall}" />
|
||||
<SelectableTextBlock Text="{Binding $parent[local:Overview].MainInstall}" />
|
||||
</Border>
|
||||
<TextBlock Text="Reference styles: " />
|
||||
<Border Margin="0,16" Classes="CodeBlock">
|
||||
<SelectableTextBlock
|
||||
FontFamily="Consolas"
|
||||
|
||||
Text="{Binding $parent[local:Overview].MainStyle}"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
@@ -368,12 +368,12 @@
|
||||
<StackPanel>
|
||||
<TextBlock Text="Install via nuget: " />
|
||||
<Border Margin="0,16" Classes="CodeBlock">
|
||||
<SelectableTextBlock FontFamily="Consolas" Text="{Binding $parent[local:Overview].ColorPickerInstall}" />
|
||||
<SelectableTextBlock Text="{Binding $parent[local:Overview].ColorPickerInstall}" />
|
||||
</Border>
|
||||
<TextBlock Text="Reference styles: " />
|
||||
<Border Margin="0,16" Classes="CodeBlock">
|
||||
<SelectableTextBlock
|
||||
FontFamily="Consolas"
|
||||
|
||||
Text="{Binding $parent[local:Overview].ColorPickerStyle}"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
@@ -383,12 +383,12 @@
|
||||
<StackPanel>
|
||||
<TextBlock Text="Install via nuget: " />
|
||||
<Border Margin="0,16" Classes="CodeBlock">
|
||||
<SelectableTextBlock FontFamily="Consolas" Text="{Binding $parent[local:Overview].DataGridInstall}" />
|
||||
<SelectableTextBlock Text="{Binding $parent[local:Overview].DataGridInstall}" />
|
||||
</Border>
|
||||
<TextBlock Text="Reference styles: " />
|
||||
<Border Margin="0,16" Classes="CodeBlock">
|
||||
<SelectableTextBlock
|
||||
FontFamily="Consolas"
|
||||
|
||||
Text="{Binding $parent[local:Overview].DataGridStyle}"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
@@ -398,12 +398,12 @@
|
||||
<StackPanel>
|
||||
<TextBlock Text="Install via nuget: " />
|
||||
<Border Margin="0,16" Classes="CodeBlock">
|
||||
<SelectableTextBlock FontFamily="Consolas" Text="{Binding $parent[local:Overview].TreeDataGridInstall}" />
|
||||
<SelectableTextBlock Text="{Binding $parent[local:Overview].TreeDataGridInstall}" />
|
||||
</Border>
|
||||
<TextBlock Text="Reference styles: " />
|
||||
<Border Margin="0,16" Classes="CodeBlock">
|
||||
<SelectableTextBlock
|
||||
FontFamily="Consolas"
|
||||
|
||||
Text="{Binding $parent[local:Overview].TreeDataGridStyle}"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
@@ -413,12 +413,12 @@
|
||||
<StackPanel>
|
||||
<TextBlock Text="Install via nuget: " />
|
||||
<Border Margin="0,16" Classes="CodeBlock">
|
||||
<SelectableTextBlock FontFamily="Consolas" Text="{Binding $parent[local:Overview].DockInstall}" />
|
||||
<SelectableTextBlock Text="{Binding $parent[local:Overview].DockInstall}" />
|
||||
</Border>
|
||||
<TextBlock Text="Reference styles: " />
|
||||
<Border Margin="0,16" Classes="CodeBlock">
|
||||
<SelectableTextBlock
|
||||
FontFamily="Consolas"
|
||||
|
||||
Text="{Binding $parent[local:Overview].DockStyle}"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
@@ -428,12 +428,12 @@
|
||||
<StackPanel>
|
||||
<TextBlock Text="Install via nuget: " />
|
||||
<Border Margin="0,16" Classes="CodeBlock">
|
||||
<SelectableTextBlock FontFamily="Consolas" Text="{Binding $parent[local:Overview].TabaloniaInstall}" />
|
||||
<SelectableTextBlock Text="{Binding $parent[local:Overview].TabaloniaInstall}" />
|
||||
</Border>
|
||||
<TextBlock Text="Reference styles: " />
|
||||
<Border Margin="0,16" Classes="CodeBlock">
|
||||
<SelectableTextBlock
|
||||
FontFamily="Consolas"
|
||||
|
||||
Text="{Binding $parent[local:Overview].TabaloniaStyle}"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
@@ -443,12 +443,12 @@
|
||||
<StackPanel>
|
||||
<TextBlock Text="Install via nuget: " />
|
||||
<Border Margin="0,16" Classes="CodeBlock">
|
||||
<SelectableTextBlock FontFamily="Consolas" Text="{Binding $parent[local:Overview].AvaloniaEditInstall}" />
|
||||
<SelectableTextBlock Text="{Binding $parent[local:Overview].AvaloniaEditInstall}" />
|
||||
</Border>
|
||||
<TextBlock Text="Reference styles: " />
|
||||
<Border Margin="0,16" Classes="CodeBlock">
|
||||
<SelectableTextBlock
|
||||
FontFamily="Consolas"
|
||||
|
||||
Text="{Binding $parent[local:Overview].AvaloniaEditStyle}"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input.Platform;
|
||||
using Avalonia.Threading;
|
||||
using Semi.Avalonia.Demo.ViewModels;
|
||||
|
||||
|
||||
@@ -22,6 +22,15 @@
|
||||
TickFrequency="10"
|
||||
TickPlacement="Outside"
|
||||
Value="0" />
|
||||
<Slider
|
||||
Value="0"
|
||||
Minimum="0"
|
||||
Maximum="100"
|
||||
TickPlacement="BottomRight"
|
||||
IsSnapToTickEnabled="True"
|
||||
IsDirectionReversed="True"
|
||||
Ticks="0,20,25,40,75,100"
|
||||
Width="300" />
|
||||
<Slider
|
||||
Width="300"
|
||||
Classes="ToolTip"
|
||||
|
||||
@@ -23,36 +23,36 @@
|
||||
<TextBox
|
||||
Width="100"
|
||||
Classes="Large"
|
||||
Watermark="Large" />
|
||||
PlaceholderText="Large" />
|
||||
<TextBox
|
||||
Width="100"
|
||||
Watermark="Default" />
|
||||
PlaceholderText="Default" />
|
||||
<TextBox
|
||||
Width="100"
|
||||
Classes="Small"
|
||||
Watermark="Small" />
|
||||
PlaceholderText="Small" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBox
|
||||
Width="100"
|
||||
IsEnabled="False"
|
||||
Watermark="Disabled" />
|
||||
PlaceholderText="Disabled" />
|
||||
<TextBox
|
||||
Width="100"
|
||||
Classes="Bordered"
|
||||
Watermark="Bordered" />
|
||||
PlaceholderText="Bordered" />
|
||||
<TextBox
|
||||
Width="100"
|
||||
Classes="Bordered"
|
||||
IsEnabled="False" />
|
||||
</StackPanel>
|
||||
<TextBox Width="300" Classes="TextArea" Watermark="TextArea TextBox" />
|
||||
<TextBox Width="300" Classes="TextArea" PlaceholderText="TextArea TextBox" />
|
||||
<TextBox Width="300" Classes="TextArea ClearButton" Text="TextArea with ClearButton - text should be clearable" />
|
||||
<TextBox
|
||||
Width="300"
|
||||
Theme="{StaticResource LooklessTextBox}"
|
||||
Watermark="Lookless TextBox"
|
||||
PlaceholderText="Lookless TextBox"
|
||||
InnerLeftContent="https://"
|
||||
InnerRightContent=".com" />
|
||||
</StackPanel>
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
<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:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
||||
xmlns:converters="clr-namespace:Semi.Avalonia.Demo.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Semi.Avalonia.Demo.Pages.TreeDataGridDemo"
|
||||
x:DataType="vm:TreeDataGridDemoViewModel">
|
||||
<UserControl.Resources>
|
||||
<converters:FileIconConverter x:Key="FileIconConverter">
|
||||
<StaticResource x:Key="file" ResourceKey="SemiIconFile" />
|
||||
<StaticResource x:Key="folderOpen" ResourceKey="SemiIconFolderOpen" />
|
||||
<StaticResource x:Key="folderClosed" ResourceKey="SemiIconFolder" />
|
||||
</converters:FileIconConverter>
|
||||
</UserControl.Resources>
|
||||
<TabControl>
|
||||
<TabItem Header="Songs">
|
||||
<TreeDataGrid
|
||||
AutoDragDropRows="True"
|
||||
DataContext="{Binding SongsContext}"
|
||||
Source="{Binding Songs}">
|
||||
<TreeDataGrid.Resources>
|
||||
<DataTemplate x:Key="AlbumCell" DataType="vm:SongViewModel">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
Text="{Binding Album}" />
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="AlbumEditCell" DataType="vm:SongViewModel">
|
||||
<ComboBox
|
||||
VerticalAlignment="Center"
|
||||
Classes="Small"
|
||||
ItemsSource="{x:Static vm:Song.Albums}"
|
||||
SelectedItem="{Binding Album}" />
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="CommentsCell" DataType="vm:SongViewModel">
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding CountOfComment}" />
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="CommentsEditCell" DataType="vm:SongViewModel">
|
||||
<NumericUpDown
|
||||
Width="100"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Classes="Small"
|
||||
Value="{Binding CountOfComment}" />
|
||||
</DataTemplate>
|
||||
</TreeDataGrid.Resources>
|
||||
<TreeDataGrid.Styles>
|
||||
<Style Selector="TreeDataGrid TreeDataGridRow:nth-last-child(2n)">
|
||||
<Setter Property="Background" Value="{DynamicResource SemiColorFill0}" />
|
||||
</Style>
|
||||
</TreeDataGrid.Styles>
|
||||
</TreeDataGrid>
|
||||
</TabItem>
|
||||
<TabItem Header="Files">
|
||||
<Grid DataContext="{Binding FilesContext}" RowDefinitions="Auto, *">
|
||||
<DockPanel Margin="0,4" DockPanel.Dock="Top">
|
||||
<ComboBox
|
||||
DockPanel.Dock="Left"
|
||||
ItemsSource="{Binding Drives}"
|
||||
SelectedItem="{Binding SelectedDrive}" />
|
||||
<TextBox
|
||||
Margin="4,0,0,0"
|
||||
VerticalContentAlignment="Center"
|
||||
KeyDown="SelectedPath_KeyDown"
|
||||
Text="{Binding SelectedPath, Mode=OneWay}" />
|
||||
</DockPanel>
|
||||
<TreeDataGrid
|
||||
Name="fileViewer"
|
||||
Grid.Row="1"
|
||||
Source="{Binding Source}">
|
||||
<TreeDataGrid.Resources>
|
||||
|
||||
<!-- Template for Name column cells -->
|
||||
<DataTemplate x:Key="FileNameCell" DataType="vm:FileNodeViewModel">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<PathIcon
|
||||
Theme="{StaticResource InnerPathIcon}"
|
||||
Margin="8,0">
|
||||
<PathIcon.Data>
|
||||
<MultiBinding Converter="{StaticResource FileIconConverter}">
|
||||
<Binding Path="IsDirectory" />
|
||||
<Binding Path="IsExpanded" />
|
||||
</MultiBinding>
|
||||
</PathIcon.Data>
|
||||
</PathIcon>
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding Name}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Edit template for Name column cells -->
|
||||
<DataTemplate x:Key="FileNameEditCell" DataType="vm:FileNodeViewModel">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Margin="0,0,4,0" VerticalAlignment="Center">
|
||||
<Image.Source>
|
||||
<MultiBinding Converter="{StaticResource FileIconConverter}">
|
||||
<Binding Path="IsDirectory" />
|
||||
<Binding Path="IsExpanded" />
|
||||
</MultiBinding>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<TextBox
|
||||
VerticalAlignment="Center"
|
||||
Classes="Small"
|
||||
Text="{Binding Name}">
|
||||
<TextBox.Styles>
|
||||
<Style Selector="DataValidationErrors">
|
||||
<Setter Property="Theme" Value="{DynamicResource TooltipDataValidationErrors}" />
|
||||
</Style>
|
||||
</TextBox.Styles>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</TreeDataGrid.Resources>
|
||||
<TreeDataGrid.Styles>
|
||||
<Style Selector="TreeDataGrid TreeDataGridRow:nth-child(2n)">
|
||||
<Setter Property="Background" Value="{DynamicResource SemiColorFill0}" />
|
||||
</Style>
|
||||
</TreeDataGrid.Styles>
|
||||
</TreeDataGrid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</UserControl>
|
||||
@@ -1,22 +0,0 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Semi.Avalonia.Demo.ViewModels;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Pages;
|
||||
|
||||
public partial class TreeDataGridDemo : UserControl
|
||||
{
|
||||
public TreeDataGridDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new TreeDataGridDemoViewModel();
|
||||
}
|
||||
|
||||
private void SelectedPath_KeyDown(object? sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter && DataContext is TreeDataGridDemoViewModel vm)
|
||||
{
|
||||
vm.FilesContext.SelectedPath = (sender as TextBox)?.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
<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:vm="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
||||
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Semi.Avalonia.Demo.Pages.VariablesDemo"
|
||||
x:DataType="vm:VariablesDemoViewModel">
|
||||
<Design.DataContext>
|
||||
<vm:VariablesDemoViewModel />
|
||||
</Design.DataContext>
|
||||
<Grid RowDefinitions="Auto, *">
|
||||
<TextBox
|
||||
Grid.Row="0"
|
||||
Width="600"
|
||||
Margin="8"
|
||||
Classes="ClearButton"
|
||||
Text="{Binding SearchText}"
|
||||
Watermark="Input Variable Category/ResourceKey/Type/Value/Description" />
|
||||
|
||||
<DataGrid
|
||||
Grid.Row="1"
|
||||
Margin="8"
|
||||
CanUserReorderColumns="True"
|
||||
CanUserResizeColumns="True"
|
||||
CanUserSortColumns="True"
|
||||
HeadersVisibility="All"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding GridData}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn
|
||||
Width="300"
|
||||
x:DataType="vm:VariableItem"
|
||||
Header="ResourceKey">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="vm:VariableItem">
|
||||
<SelectableTextBlock
|
||||
Margin="12,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding ResourceKey}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn
|
||||
Width="200"
|
||||
x:DataType="vm:VariableItem"
|
||||
Header="Type">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="vm:VariableItem">
|
||||
<SelectableTextBlock
|
||||
Margin="12,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Type.Name}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn
|
||||
Width="200"
|
||||
x:DataType="vm:VariableItem"
|
||||
Header="Value">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="vm:VariableItem">
|
||||
<SelectableTextBlock
|
||||
Margin="12,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Value}"
|
||||
TextWrapping="Wrap" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn
|
||||
Width="*"
|
||||
x:DataType="vm:VariableItem"
|
||||
Header="Description">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="vm:VariableItem">
|
||||
<SelectableTextBlock
|
||||
Margin="12,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Description}"
|
||||
TextWrapping="Wrap" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn
|
||||
Width="100"
|
||||
x:DataType="vm:VariableItem"
|
||||
Header="CopyText"
|
||||
SortMemberPath="Duration">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="vm:VariableItem">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:VariablesDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using Semi.Avalonia.Demo.ViewModels;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Pages;
|
||||
|
||||
public partial class VariablesDemo : UserControl
|
||||
{
|
||||
public VariablesDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new VariablesDemoViewModel();
|
||||
}
|
||||
|
||||
public async Task Copy(object? o)
|
||||
{
|
||||
if (o is null) return;
|
||||
var toplevel = TopLevel.GetTopLevel(this);
|
||||
if (toplevel?.Clipboard is { } c)
|
||||
{
|
||||
await c.SetTextAsync(o.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,20 +13,23 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia"/>
|
||||
<PackageReference Include="Avalonia.Controls.ColorPicker"/>
|
||||
<PackageReference Include="Avalonia.Controls.DataGrid"/>
|
||||
<!-- <PackageReference Include="Avalonia.Controls.DataGrid"/>-->
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Include="Avalonia.Diagnostics">
|
||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<!-- <PackageReference Include="Avalonia.Diagnostics">-->
|
||||
<!-- <IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>-->
|
||||
<!-- <PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>-->
|
||||
<!-- </PackageReference>-->
|
||||
<PackageReference Include="CommunityToolkit.Mvvm"/>
|
||||
<PackageReference Include="Irihi.Avalonia.Shared"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Semi.Avalonia\Semi.Avalonia.csproj"/>
|
||||
<ProjectReference Include="..\..\src\Semi.Avalonia.ColorPicker\Semi.Avalonia.ColorPicker.csproj"/>
|
||||
<ProjectReference Include="..\..\src\Semi.Avalonia.DataGrid\Semi.Avalonia.DataGrid.csproj"/>
|
||||
<ProjectReference Include="..\..\src\Semi.Avalonia.TreeDataGrid\Semi.Avalonia.TreeDataGrid.csproj"/>
|
||||
<!-- <ProjectReference Include="..\..\src\Semi.Avalonia.DataGrid\Semi.Avalonia.DataGrid.csproj"/>-->
|
||||
<!-- <ProjectReference Include="..\..\src\Semi.Avalonia.TreeDataGrid\Semi.Avalonia.TreeDataGrid.csproj"/>-->
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaXaml Remove="Pages\VariablesDemo.axaml" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Semi.Avalonia.Demo.Controls"
|
||||
xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
||||
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
|
||||
x:DataType="viewModels:FunctionalColorGroupViewModel">
|
||||
<ControlTheme x:Key="{x:Type controls:FunctionalColorGroupControl}" TargetType="controls:FunctionalColorGroupControl">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="controls:FunctionalColorGroupControl">
|
||||
<Grid RowDefinitions="Auto, *">
|
||||
<SelectableTextBlock
|
||||
Grid.Row="0"
|
||||
Margin="0,16,0,0"
|
||||
Classes="H3"
|
||||
Text="{TemplateBinding Title}"
|
||||
Theme="{DynamicResource TitleSelectableTextBlock}" />
|
||||
<TabControl Grid.Row="1">
|
||||
<TabItem Header="Light">
|
||||
<DataGrid IsReadOnly="True" ItemsSource="{TemplateBinding LightColors}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="70" Header="Color">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||
<controls:ColorItemControl
|
||||
Width="40"
|
||||
Height="20"
|
||||
Background="{Binding Brush}"
|
||||
CornerRadius="3" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Width="300" Header="ResourceKey">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||
<SelectableTextBlock
|
||||
Margin="12,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding ResourceKey}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Width="100" Header="Hex">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||
<SelectableTextBlock
|
||||
Margin="12,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Hex}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Width="80" Header="Opacity">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||
<SelectableTextBlock
|
||||
Margin="12,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Brush.Opacity}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
x:DataType="viewModels:ColorItemViewModel"
|
||||
Binding="{Binding ColorDisplayName}"
|
||||
CanUserSort="False"
|
||||
Header="Description" />
|
||||
<DataGridTemplateColumn Width="100" Header="CopyText">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</TabItem>
|
||||
<TabItem Header="Dark">
|
||||
<DataGrid IsReadOnly="True" ItemsSource="{TemplateBinding DarkColors}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="70" Header="Color">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||
<controls:ColorItemControl
|
||||
Width="40"
|
||||
Height="20"
|
||||
Background="{Binding Brush}"
|
||||
CornerRadius="3" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Width="300" Header="ResourceKey">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||
<SelectableTextBlock
|
||||
Margin="12,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding ResourceKey}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Width="100" Header="Hex">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||
<SelectableTextBlock
|
||||
Margin="12,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Hex}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Width="80" Header="Opacity">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||
<SelectableTextBlock
|
||||
Margin="12,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Brush.Opacity}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
x:DataType="viewModels:ColorItemViewModel"
|
||||
Binding="{Binding ColorDisplayName}"
|
||||
CanUserSort="False"
|
||||
Header="Description" />
|
||||
<DataGridTemplateColumn Width="100" Header="CopyText">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
@@ -1,110 +0,0 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Semi.Avalonia.Demo.Controls"
|
||||
xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels"
|
||||
xmlns:pages="clr-namespace:Semi.Avalonia.Demo.Pages"
|
||||
x:DataType="viewModels:ShadowGroupViewModel">
|
||||
<ControlTheme x:Key="{x:Type controls:ShadowGroupControl}" TargetType="controls:ShadowGroupControl">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="controls:ShadowGroupControl">
|
||||
<Grid RowDefinitions="Auto, *">
|
||||
<SelectableTextBlock
|
||||
Grid.Row="0"
|
||||
Margin="0,16,0,0"
|
||||
Classes="H3"
|
||||
Text="{TemplateBinding Title}"
|
||||
Theme="{DynamicResource TitleSelectableTextBlock}" />
|
||||
<TabControl Grid.Row="1">
|
||||
<TabItem Header="Light">
|
||||
<DataGrid IsReadOnly="True" ItemsSource="{TemplateBinding LightShadows}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="300" Header="ResourceKey">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
||||
<SelectableTextBlock
|
||||
Margin="12,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding ResourceKey}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Width="300" Header="BoxShadows">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
||||
<SelectableTextBlock
|
||||
Margin="12,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding BoxShadowValue}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
x:DataType="viewModels:ShadowItemViewModel"
|
||||
Binding="{Binding ShadowDisplayName}"
|
||||
CanUserSort="False"
|
||||
Header="Description" />
|
||||
<DataGridTemplateColumn Width="100" Header="CopyText">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</TabItem>
|
||||
<TabItem Header="Dark">
|
||||
<DataGrid IsReadOnly="True" ItemsSource="{TemplateBinding DarkShadows}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="300" Header="ResourceKey">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
||||
<SelectableTextBlock
|
||||
Margin="12,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding ResourceKey}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Width="300" Header="BoxShadows">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
||||
<SelectableTextBlock
|
||||
Margin="12,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding BoxShadowValue}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
x:DataType="viewModels:ShadowItemViewModel"
|
||||
Binding="{Binding ShadowDisplayName}"
|
||||
CanUserSort="False"
|
||||
Header="Description" />
|
||||
<DataGridTemplateColumn Width="100" Header="CopyText">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
@@ -2,8 +2,6 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceInclude Source="ColorDetailControl.axaml" />
|
||||
<ResourceInclude Source="ColorItemControl.axaml" />
|
||||
<ResourceInclude Source="FunctionalColorGroupControl.axaml" />
|
||||
<ResourceInclude Source="ShadowGroupControl.axaml" />
|
||||
<ResourceInclude Source="ToggleSwitch.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
@@ -1,154 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Avalonia.Collections;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace Semi.Avalonia.Demo.ViewModels;
|
||||
|
||||
public class DataGridDemoViewModel : ObservableObject
|
||||
{
|
||||
public ObservableCollection<Song> GridData1 { get; set; }
|
||||
|
||||
public DataGridCollectionView GridData2 { get; set; }
|
||||
|
||||
public ObservableCollection<SongViewModel> GridData3 { get; set; }
|
||||
|
||||
public RelayCommand AddCommand { get; set; }
|
||||
|
||||
public DataGridDemoViewModel()
|
||||
{
|
||||
GridData1 = new ObservableCollection<Song>(Song.Songs);
|
||||
GridData2 = new DataGridCollectionView(Song.Songs);
|
||||
GridData2.GroupDescriptions.Add(new DataGridPathGroupDescription("Album"));
|
||||
GridData3 = new ObservableCollection<SongViewModel>(Song.Songs.Take(10).Select(a => new SongViewModel()
|
||||
{
|
||||
Title = a.Title,
|
||||
Artist = a.Artist,
|
||||
Album = a.Album,
|
||||
CountOfComment = a.CountOfComment,
|
||||
IsSelected = false
|
||||
}));
|
||||
AddCommand = new RelayCommand(Add);
|
||||
}
|
||||
|
||||
private void Add()
|
||||
{
|
||||
GridData3.Add(new SongViewModel());
|
||||
}
|
||||
}
|
||||
|
||||
public class Song
|
||||
{
|
||||
public string? Title { get; set; }
|
||||
public string? Artist { get; set; }
|
||||
public TimeSpan? Duration { get; set; }
|
||||
public string? Album { get; set; }
|
||||
public int CountOfComment { get; set; }
|
||||
public string Url { get; set; }
|
||||
|
||||
public Song(string title, string artist, int m, int s, string album, int countOfComment, int netEaseId)
|
||||
{
|
||||
Title = title;
|
||||
Artist = artist;
|
||||
Duration = new TimeSpan(0, m, s);
|
||||
Album = album;
|
||||
CountOfComment = countOfComment;
|
||||
Url = $"https://music.163.com/song?id={netEaseId}";
|
||||
}
|
||||
|
||||
public static List<string> Albums =>
|
||||
[
|
||||
"A.S.I.A",
|
||||
"饕餮人间",
|
||||
"七步咙咚呛",
|
||||
"大惊小怪",
|
||||
"The ONE",
|
||||
"以梦为马 (壮志骄阳版)",
|
||||
"emo了",
|
||||
"一眼万年",
|
||||
"冲刺吧",
|
||||
"爱的赏味期限",
|
||||
"COSMIC ANTHEM / 手紙",
|
||||
"世界晚安",
|
||||
"明年也要好好长大",
|
||||
"320万年前",
|
||||
"W.O.R.L.D."
|
||||
];
|
||||
|
||||
public static List<Song> Songs =>
|
||||
[
|
||||
new("好肚有肚(feat.李玲玉)", "熊猫堂ProducePandas", 2, 50, "A.S.I.A", 730, 1487039339),
|
||||
new("荒诞秀", "熊猫堂ProducePandas", 3, 15, "A.S.I.A", 639, 1487037601),
|
||||
new("长大", "熊猫堂ProducePandas", 4, 6, "A.S.I.A", 1114, 1487037690),
|
||||
new("招财猫(feat.纪粹希(G-Tracy))", "熊猫堂ProducePandas", 3, 37, "A.S.I.A", 361, 1487039632),
|
||||
new("千转", "熊猫堂ProducePandas", 4, 0, "A.S.I.A", 1115, 1477312398),
|
||||
new("辣辣辣", "熊猫堂ProducePandas", 3, 24, "A.S.I.A", 1873, 1465043716),
|
||||
new("碎碎念", "熊猫堂ProducePandas", 3, 25, "A.S.I.A", 676, 1474142064),
|
||||
new("盘他", "熊猫堂ProducePandas", 2, 16, "A.S.I.A", 365, 1481652786),
|
||||
new("Na Na Na", "熊猫堂ProducePandas", 3, 26, "A.S.I.A", 312, 1469022662),
|
||||
new("Indigo", "熊猫堂ProducePandas", 3, 15, "A.S.I.A", 137, 1487039517),
|
||||
new("饕餮人间", "熊猫堂ProducePandas", 3, 20, "饕餮人间", 1295, 1499584605),
|
||||
new("七步咙咚呛", "熊猫堂ProducePandas", 3, 10, "七步咙咚呛", 175, 1809095152),
|
||||
new("大惊小怪", "熊猫堂ProducePandas", 3, 32, "大惊小怪", 10420, 1847477425),
|
||||
new("工具人", "熊猫堂ProducePandas", 2, 46, "大惊小怪", 1135, 1847476499),
|
||||
new("以梦为马", "熊猫堂ProducePandas", 4, 19, "大惊小怪", 18361, 1836034373),
|
||||
new("以梦为马(Piano Version)", "熊猫堂ProducePandas", 3, 4, "大惊小怪", 570, 1847477423),
|
||||
new("The ONE", "熊猫堂ProducePandas", 2, 58, "The ONE", 1508, 1864329424),
|
||||
new("The ONE(日文版)", "熊猫堂ProducePandas", 2, 57, "The ONE", 385, 1864329429),
|
||||
new("以梦为马 (壮志骄阳版)", "熊猫堂ProducePandas", 4, 19, "以梦为马 (壮志骄阳版)", 161, 1865138896),
|
||||
new("New Horse", "熊猫堂ProducePandas", 2, 30, "emo了", 643, 1887021307),
|
||||
new("不例外", "熊猫堂ProducePandas", 3, 31, "emo了", 1818, 1887022665),
|
||||
new("满意", "熊猫堂ProducePandas", 4, 32, "emo了", 1081, 1882433472),
|
||||
new("就算与全世界为敌也要跟你在一起", "熊猫堂ProducePandas", 3, 32, "emo了", 2119, 1881759960),
|
||||
new("The ONE", "熊猫堂ProducePandas", 2, 58, "emo了", 67, 1887022648),
|
||||
new("口香糖", "熊猫堂ProducePandas", 3, 10, "emo了", 2181, 1885502254),
|
||||
new("Suuuuuuper Mario", "熊猫堂ProducePandas", 3, 32, "emo了", 1010, 1887021318),
|
||||
new("饕餮人间", "熊猫堂ProducePandas", 3, 22, "emo了", 109, 1887021320),
|
||||
new("以梦为马 (壮志骄阳版)", "熊猫堂ProducePandas", 4, 21, "emo了", 34, 1887022666),
|
||||
new("The ONE(日文版)", "熊猫堂ProducePandas", 2, 57, "emo了", 27, 1887022646),
|
||||
new("满意(DJheap九天版)", "熊猫堂ProducePandas", 4, 31, "emo了", 31, 1901605941),
|
||||
new("一眼万年", "熊猫堂ProducePandas", 3, 54, "一眼万年", 20, 1922599361),
|
||||
new("冲刺", "熊猫堂ProducePandas", 3, 49, "冲刺吧", 1006, 1932878194),
|
||||
new("滴答滴", "熊猫堂ProducePandas", 2, 30, "爱的赏味期限", 86, 1957515790),
|
||||
new("热带季风", "熊猫堂ProducePandas", 2, 45, "爱的赏味期限", 212, 1957514964),
|
||||
new("渣", "熊猫堂ProducePandas", 3, 28, "爱的赏味期限", 22, 1957514965),
|
||||
new("独特", "熊猫堂ProducePandas", 3, 33, "爱的赏味期限", 62, 1957514966),
|
||||
new("雨后", "熊猫堂ProducePandas", 4, 15, "爱的赏味期限", 23, 1957514967),
|
||||
new("然后然后", "熊猫堂ProducePandas", 3, 50, "爱的赏味期限", 108, 1957514968),
|
||||
new("丢", "熊猫堂ProducePandas", 3, 26, "爱的赏味期限", 30, 1957515792),
|
||||
new("热带疾风(FACEVOID桃心连哥 Remix)", "熊猫堂ProducePandas", 3, 23, "爱的赏味期限", 55, 1957515793),
|
||||
new("COSMIC ANTHEM -Japanese Ver.-", "熊猫堂ProducePandas", 3, 11, "COSMIC ANTHEM / 手紙", 0, 1977171493),
|
||||
new("手紙 (「長大-You Raise Me Up-」-Japanese Ver.-)", "熊猫堂ProducePandas", 4, 11, "COSMIC ANTHEM / 手紙", 0,
|
||||
1977171494),
|
||||
new("COSMIC ANTHEM -Chinese Ver.-", "熊猫堂ProducePandas", 3, 31, "COSMIC ANTHEM / 手紙", 0, 1977172202),
|
||||
new("世界晚安", "熊猫堂ProducePandas", 2, 59, "世界晚安", 652, 1985063377),
|
||||
new("世界晚安(泰文版)", "熊猫堂ProducePandas", 2, 59, "世界晚安", 134, 1987842504),
|
||||
new("世界晚安(钢琴版)", "熊猫堂ProducePandas", 3, 2, "世界晚安", 76, 1990475933),
|
||||
new("世界晚安(泰文钢琴版)", "熊猫堂ProducePandas", 3, 2, "世界晚安", 29, 1990475934),
|
||||
new("世界晚安(DJ沈念版)", "熊猫堂ProducePandas", 3, 9, "世界晚安", 34, 2014263184),
|
||||
new("世界晚安(钢琴配乐)", "熊猫堂ProducePandas", 2, 59, "世界晚安", 11, 2014263185),
|
||||
new("明年也要好好长大", "熊猫堂ProducePandas", 3, 12, "明年也要好好长大", 0, 2010515162),
|
||||
new("320万年前(DJ沈念版)", "熊猫堂ProducePandas", 3, 21, "320万年前", 8, 2055888636),
|
||||
new("320万年前", "熊猫堂ProducePandas", 3, 7, "W.O.R.L.D.", 329, 2049770469),
|
||||
new("隐德来希", "熊猫堂ProducePandas", 3, 3, "W.O.R.L.D.", 594, 2061317924),
|
||||
new("孔明", "熊猫堂ProducePandas", 3, 59, "W.O.R.L.D.", 91, 2063175274),
|
||||
new("锦鲤卟噜噜", "熊猫堂ProducePandas", 3, 5, "W.O.R.L.D.", 67, 2059208262),
|
||||
new("指鹿为马", "熊猫堂ProducePandas", 3, 12, "W.O.R.L.D.", 74, 2063175272),
|
||||
new("热带季风Remix", "熊猫堂ProducePandas", 3, 22, "W.O.R.L.D.", 23, 2063173319),
|
||||
new("加州梦境", "熊猫堂ProducePandas", 2, 56, "W.O.R.L.D.", 1662, 2063173324),
|
||||
new("渐近自由", "熊猫堂ProducePandas", 4, 19, "W.O.R.L.D.", 124, 2063173321),
|
||||
new("世界所有的烂漫", "熊猫堂ProducePandas", 3, 30, "W.O.R.L.D.", 335, 2053388775)
|
||||
];
|
||||
}
|
||||
|
||||
public partial class SongViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty] private string? _title;
|
||||
[ObservableProperty] private string? _artist;
|
||||
[ObservableProperty] private string? _album;
|
||||
[ObservableProperty] private int _countOfComment;
|
||||
[ObservableProperty] private bool? _isSelected;
|
||||
}
|
||||
@@ -1,363 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Models.TreeDataGrid;
|
||||
using Avalonia.Controls.Selection;
|
||||
using Avalonia.Threading;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Semi.Avalonia.Demo.ViewModels;
|
||||
|
||||
public partial class FilesPageViewModel : ObservableObject
|
||||
{
|
||||
public IList<string> Drives { get; }
|
||||
public HierarchicalTreeDataGridSource<FileNodeViewModel> Source { get; }
|
||||
[ObservableProperty] private string _selectedDrive;
|
||||
private string? _selectedPath;
|
||||
[ObservableProperty] private FileNodeViewModel? _root;
|
||||
|
||||
public string? SelectedPath
|
||||
{
|
||||
get => _selectedPath;
|
||||
set => SetSelectedPath(value);
|
||||
}
|
||||
|
||||
partial void OnSelectedDriveChanged(string value)
|
||||
{
|
||||
Root = new FileNodeViewModel(value, true, true);
|
||||
if (Source is not null)
|
||||
{
|
||||
Source.Items = [Root];
|
||||
}
|
||||
}
|
||||
|
||||
public FilesPageViewModel()
|
||||
{
|
||||
Drives = DriveInfo.GetDrives().Select(x => x.Name).ToList();
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
SelectedDrive = @"C:\";
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedDrive = Drives.FirstOrDefault() ?? "/";
|
||||
}
|
||||
|
||||
Source = new HierarchicalTreeDataGridSource<FileNodeViewModel>([])
|
||||
{
|
||||
Columns =
|
||||
{
|
||||
new CheckBoxColumn<FileNodeViewModel>(
|
||||
null,
|
||||
x => x.IsChecked,
|
||||
(o, v) => o.IsChecked = v,
|
||||
options: new CheckBoxColumnOptions<FileNodeViewModel>
|
||||
{
|
||||
CanUserResizeColumn = false,
|
||||
}),
|
||||
new HierarchicalExpanderColumn<FileNodeViewModel>(
|
||||
new TemplateColumn<FileNodeViewModel>(
|
||||
"Name",
|
||||
"FileNameCell",
|
||||
"FileNameEditCell",
|
||||
new GridLength(1, GridUnitType.Star),
|
||||
new TemplateColumnOptions<FileNodeViewModel>
|
||||
{
|
||||
CompareAscending = FileNodeViewModel.SortAscending(vm => vm.Name),
|
||||
CompareDescending = FileNodeViewModel.SortDescending(vm => vm.Name),
|
||||
IsTextSearchEnabled = true,
|
||||
TextSearchValueSelector = vm => vm.Name
|
||||
}),
|
||||
vm => vm.Children,
|
||||
vm => vm.HasChildren,
|
||||
vm => vm.IsExpanded),
|
||||
new TextColumn<FileNodeViewModel, long?>(
|
||||
"Size",
|
||||
vm => vm.Size,
|
||||
options: new TextColumnOptions<FileNodeViewModel>
|
||||
{
|
||||
CompareAscending = FileNodeViewModel.SortAscending(x => x.Size),
|
||||
CompareDescending = FileNodeViewModel.SortDescending(x => x.Size),
|
||||
}),
|
||||
new TextColumn<FileNodeViewModel, DateTimeOffset?>(
|
||||
"Modified",
|
||||
x => x.Modified,
|
||||
options: new TextColumnOptions<FileNodeViewModel>
|
||||
{
|
||||
CompareAscending = FileNodeViewModel.SortAscending(x => x.Modified),
|
||||
CompareDescending = FileNodeViewModel.SortDescending(x => x.Modified),
|
||||
}),
|
||||
}
|
||||
};
|
||||
Source.RowSelection!.SingleSelect = false;
|
||||
Source.RowSelection.SelectionChanged += SelectionChanged;
|
||||
}
|
||||
|
||||
private void SelectionChanged(object? sender, TreeSelectionModelSelectionChangedEventArgs<FileNodeViewModel> e)
|
||||
{
|
||||
var selectedPath = Source.RowSelection?.SelectedItem?.Path;
|
||||
this.SetProperty(ref _selectedPath, selectedPath, nameof(SelectedPath));
|
||||
|
||||
foreach (var i in e.DeselectedItems)
|
||||
Trace.WriteLine($"Deselected '{i?.Path}'");
|
||||
foreach (var i in e.SelectedItems)
|
||||
Trace.WriteLine($"Selected '{i?.Path}'");
|
||||
}
|
||||
private void SetSelectedPath(string? path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
Source.RowSelection!.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
var components = new Stack<string>();
|
||||
DirectoryInfo? d = null;
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
var f = new FileInfo(path);
|
||||
components.Push(f.Name);
|
||||
d = f.Directory;
|
||||
}
|
||||
else if (Directory.Exists(path))
|
||||
{
|
||||
d = new DirectoryInfo(path);
|
||||
}
|
||||
|
||||
while (d is not null)
|
||||
{
|
||||
components.Push(d.Name);
|
||||
d = d.Parent;
|
||||
}
|
||||
|
||||
var index = IndexPath.Unselected;
|
||||
|
||||
if (components.Count > 0)
|
||||
{
|
||||
var drive = components.Pop();
|
||||
var driveIndex = Drives.FindIndex(x => string.Equals(x, drive, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (driveIndex >= 0)
|
||||
SelectedDrive = Drives[driveIndex];
|
||||
|
||||
var node = Root;
|
||||
index = new IndexPath(0);
|
||||
|
||||
while (node is not null && components.Count > 0)
|
||||
{
|
||||
node.IsExpanded = true;
|
||||
|
||||
var component = components.Pop();
|
||||
var i = node.Children.FindIndex(x => string.Equals(x.Name, component, StringComparison.OrdinalIgnoreCase));
|
||||
node = i >= 0 ? node.Children[i] : null;
|
||||
index = i >= 0 ? index.Append(i) : default;
|
||||
}
|
||||
}
|
||||
|
||||
Source.Items = [Root!];
|
||||
Source.RowSelection!.SelectedIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class FileNodeViewModel : ObservableObject, IEditableObject
|
||||
{
|
||||
[ObservableProperty] private string _path;
|
||||
[ObservableProperty] private string _name;
|
||||
private string? _undoName;
|
||||
[ObservableProperty] private long? _size;
|
||||
[ObservableProperty] private DateTimeOffset? _modified;
|
||||
private FileSystemWatcher? _watcher;
|
||||
private ObservableCollection<FileNodeViewModel>? _children;
|
||||
[ObservableProperty] private bool _hasChildren = true;
|
||||
[ObservableProperty] private bool _isExpanded;
|
||||
|
||||
public FileNodeViewModel(string path, bool isDirectory, bool isRoot = false)
|
||||
{
|
||||
Path = path;
|
||||
Name = isRoot ? path : System.IO.Path.GetFileName(Path);
|
||||
IsExpanded = isRoot;
|
||||
IsDirectory = isDirectory;
|
||||
HasChildren = isDirectory;
|
||||
|
||||
if (!isDirectory)
|
||||
{
|
||||
var info = new FileInfo(path);
|
||||
Size = info.Length;
|
||||
Modified = info.LastWriteTimeUtc;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsChecked { get; set; }
|
||||
public bool IsDirectory { get; }
|
||||
public IReadOnlyList<FileNodeViewModel> Children => _children ??= LoadChildren();
|
||||
|
||||
private ObservableCollection<FileNodeViewModel> LoadChildren()
|
||||
{
|
||||
if (!IsDirectory)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
var options = new EnumerationOptions { IgnoreInaccessible = true };
|
||||
var result = new ObservableCollection<FileNodeViewModel>();
|
||||
|
||||
foreach (var d in Directory.EnumerateDirectories(Path, "*", options))
|
||||
{
|
||||
result.Add(new FileNodeViewModel(d, true));
|
||||
}
|
||||
|
||||
foreach (var f in Directory.EnumerateFiles(Path, "*", options))
|
||||
{
|
||||
result.Add(new FileNodeViewModel(f, false));
|
||||
}
|
||||
|
||||
_watcher = new FileSystemWatcher
|
||||
{
|
||||
Path = Path,
|
||||
NotifyFilter = NotifyFilters.FileName | NotifyFilters.Size | NotifyFilters.LastWrite,
|
||||
};
|
||||
|
||||
_watcher.Changed += OnChanged;
|
||||
_watcher.Created += OnCreated;
|
||||
_watcher.Deleted += OnDeleted;
|
||||
_watcher.Renamed += OnRenamed;
|
||||
_watcher.EnableRaisingEvents = true;
|
||||
|
||||
if (result.Count == 0)
|
||||
HasChildren = false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Comparison<FileNodeViewModel?> SortAscending<T>(Func<FileNodeViewModel, T> selector)
|
||||
{
|
||||
return (x, y) =>
|
||||
{
|
||||
if (x is null && y is null)
|
||||
return 0;
|
||||
else if (x is null)
|
||||
return -1;
|
||||
else if (y is null)
|
||||
return 1;
|
||||
if (x.IsDirectory == y.IsDirectory)
|
||||
return Comparer<T>.Default.Compare(selector(x), selector(y));
|
||||
else if (x.IsDirectory)
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
};
|
||||
}
|
||||
|
||||
public static Comparison<FileNodeViewModel?> SortDescending<T>(Func<FileNodeViewModel, T> selector)
|
||||
{
|
||||
return (x, y) =>
|
||||
{
|
||||
if (x is null && y is null)
|
||||
return 0;
|
||||
else if (x is null)
|
||||
return 1;
|
||||
else if (y is null)
|
||||
return -1;
|
||||
if (x.IsDirectory == y.IsDirectory)
|
||||
return Comparer<T>.Default.Compare(selector(y), selector(x));
|
||||
else if (x.IsDirectory)
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
};
|
||||
}
|
||||
|
||||
void IEditableObject.BeginEdit() => _undoName = Name;
|
||||
void IEditableObject.CancelEdit() => Name = _undoName ?? string.Empty;
|
||||
void IEditableObject.EndEdit() => _undoName = null;
|
||||
|
||||
private void OnChanged(object sender, FileSystemEventArgs e)
|
||||
{
|
||||
if (e.ChangeType == WatcherChangeTypes.Changed && File.Exists(e.FullPath))
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
foreach (var child in _children!)
|
||||
{
|
||||
if (child.Path == e.FullPath)
|
||||
{
|
||||
if (!child.IsDirectory)
|
||||
{
|
||||
var info = new FileInfo(e.FullPath);
|
||||
child.Size = info.Length;
|
||||
child.Modified = info.LastWriteTimeUtc;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCreated(object sender, FileSystemEventArgs e)
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
var node = new FileNodeViewModel(
|
||||
e.FullPath,
|
||||
File.GetAttributes(e.FullPath).HasFlag(FileAttributes.Directory));
|
||||
_children!.Add(node);
|
||||
});
|
||||
}
|
||||
|
||||
private void OnDeleted(object sender, FileSystemEventArgs e)
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
for (var i = 0; i < _children!.Count; ++i)
|
||||
{
|
||||
if (_children[i].Path == e.FullPath)
|
||||
{
|
||||
_children.RemoveAt(i);
|
||||
Debug.WriteLine($"Removed {e.FullPath}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void OnRenamed(object sender, RenamedEventArgs e)
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
foreach (var child in _children!)
|
||||
{
|
||||
if (child.Path == e.OldFullPath)
|
||||
{
|
||||
child.Path = e.FullPath;
|
||||
child.Name = e.Name ?? string.Empty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
internal static class ListExtensions
|
||||
{
|
||||
public static int FindIndex<T>(this IEnumerable<T> source, Func<T, bool> predicate)
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var item in source)
|
||||
{
|
||||
if (predicate(item))
|
||||
return i;
|
||||
i++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Models.TreeDataGrid;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Semi.Avalonia.Demo.ViewModels;
|
||||
|
||||
public class SongsPageViewModel : ObservableObject
|
||||
{
|
||||
public FlatTreeDataGridSource<SongViewModel> Songs { get; }
|
||||
|
||||
public SongsPageViewModel()
|
||||
{
|
||||
var songs = new ObservableCollection<SongViewModel>(Song.Songs.Select(a => new SongViewModel()
|
||||
{
|
||||
Title = a.Title,
|
||||
Artist = a.Artist,
|
||||
Album = a.Album,
|
||||
CountOfComment = a.CountOfComment,
|
||||
IsSelected = false
|
||||
}));
|
||||
|
||||
Songs = new FlatTreeDataGridSource<SongViewModel>(songs)
|
||||
{
|
||||
Columns =
|
||||
{
|
||||
new CheckBoxColumn<SongViewModel>(
|
||||
"IsSelected",
|
||||
a => a.IsSelected,
|
||||
(model, b) => { model.IsSelected = b; },
|
||||
new GridLength(108, GridUnitType.Pixel)),
|
||||
new TextColumn<SongViewModel, string>(
|
||||
"Title",
|
||||
a => a.Title,
|
||||
(o, a) => o.Title = a,
|
||||
new GridLength(6, GridUnitType.Star)),
|
||||
new TextColumn<SongViewModel, string>("Artist",
|
||||
a => a.Artist,
|
||||
(o, a) => o.Artist = a,
|
||||
new GridLength(6, GridUnitType.Star)),
|
||||
new TemplateColumn<SongViewModel>("Album",
|
||||
"AlbumCell",
|
||||
"AlbumEditCell",
|
||||
new GridLength(6, GridUnitType.Star)),
|
||||
new TemplateColumn<SongViewModel>(
|
||||
"Comments",
|
||||
"CommentsCell",
|
||||
"CommentsEditCell",
|
||||
new GridLength(6, GridUnitType.Star)),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Semi.Avalonia.Demo.ViewModels;
|
||||
|
||||
public class TreeDataGridDemoViewModel : ObservableObject
|
||||
{
|
||||
public SongsPageViewModel SongsContext { get; } = new();
|
||||
public FilesPageViewModel FilesContext { get; } = new();
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Avalonia;
|
||||
using Avalonia.Collections;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Semi.Avalonia.Tokens;
|
||||
|
||||
namespace Semi.Avalonia.Demo.ViewModels;
|
||||
|
||||
public partial class VariablesDemoViewModel : ObservableObject
|
||||
{
|
||||
public DataGridCollectionView GridData { get; set; }
|
||||
[ObservableProperty] private string _searchText = string.Empty;
|
||||
|
||||
public VariablesDemoViewModel()
|
||||
{
|
||||
IResourceDictionary dictionary = new Variables();
|
||||
foreach (var token in Tokens)
|
||||
{
|
||||
if (token.ResourceKey is not null && dictionary.TryGetValue(token.ResourceKey, out var value))
|
||||
{
|
||||
token.Type = value?.GetType();
|
||||
token.Value = GetValueString(value);
|
||||
}
|
||||
}
|
||||
|
||||
GridData = new DataGridCollectionView(Tokens);
|
||||
GridData.GroupDescriptions.Add(new DataGridPathGroupDescription(nameof(VariableItem.Category)));
|
||||
}
|
||||
|
||||
private static string? GetValueString(object? value)
|
||||
{
|
||||
if (value is null) return string.Empty;
|
||||
|
||||
return value switch
|
||||
{
|
||||
double d => d.ToString(CultureInfo.InvariantCulture),
|
||||
CornerRadius c => c.IsUniform ? $"{c.TopLeft}" : c.ToString(),
|
||||
Thickness t => t.IsUniform ? $"{t.Left}" : t.ToString(),
|
||||
FontWeight fontWeight => Convert.ToInt32(fontWeight).ToString(),
|
||||
FontFamily fontFamily => fontFamily.FamilyNames.ToString(),
|
||||
_ => value.ToString()
|
||||
};
|
||||
}
|
||||
|
||||
partial void OnSearchTextChanged(string value)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
GridData.Filter = _ => true;
|
||||
GridData.Refresh();
|
||||
return;
|
||||
}
|
||||
|
||||
var search = value.Trim();
|
||||
GridData.Filter = item =>
|
||||
{
|
||||
if (item is not VariableItem variableItem) return false;
|
||||
return (variableItem.Category?.Contains(search, StringComparison.InvariantCultureIgnoreCase) ?? false) ||
|
||||
(variableItem.ResourceKey?.Contains(search, StringComparison.InvariantCultureIgnoreCase) ?? false) ||
|
||||
(variableItem.Value?.Contains(search, StringComparison.InvariantCultureIgnoreCase) ?? false) ||
|
||||
(variableItem.Type?.Name.Contains(search, StringComparison.InvariantCultureIgnoreCase) ?? false) ||
|
||||
(variableItem.Description?.Contains(search, StringComparison.InvariantCultureIgnoreCase) ?? false);
|
||||
};
|
||||
GridData.Refresh();
|
||||
}
|
||||
|
||||
private static List<VariableItem> Tokens { get; set; } =
|
||||
[
|
||||
new("Height", "SemiHeightControlSmall"),
|
||||
new("Height", "SemiHeightControlDefault"),
|
||||
new("Height", "SemiHeightControlLarge"),
|
||||
new("Icon Size", "SemiWidthIconExtraSmall"),
|
||||
new("Icon Size", "SemiWidthIconSmall"),
|
||||
new("Icon Size", "SemiWidthIconMedium"),
|
||||
new("Icon Size", "SemiWidthIconLarge"),
|
||||
new("Icon Size", "SemiWidthIconExtraLarge"),
|
||||
new("Border CornerRadius Spacing", "SemiBorderRadiusSpacingExtraSmall"),
|
||||
new("Border CornerRadius Spacing", "SemiBorderRadiusSpacingSmall"),
|
||||
new("Border CornerRadius Spacing", "SemiBorderRadiusSpacingMedium"),
|
||||
new("Border CornerRadius Spacing", "SemiBorderRadiusSpacingLarge"),
|
||||
new("Border CornerRadius Spacing", "SemiBorderRadiusSpacingFull"),
|
||||
new("Border CornerRadius", "SemiBorderRadiusExtraSmall"),
|
||||
new("Border CornerRadius", "SemiBorderRadiusSmall"),
|
||||
new("Border CornerRadius", "SemiBorderRadiusMedium"),
|
||||
new("Border CornerRadius", "SemiBorderRadiusLarge"),
|
||||
new("Border CornerRadius", "SemiBorderRadiusFull"),
|
||||
new("Border Spacing", "SemiBorderSpacing"),
|
||||
new("Border Spacing", "SemiBorderSpacingControl"),
|
||||
new("Border Spacing", "SemiBorderSpacingControlFocus"),
|
||||
new("Border Thickness", "SemiBorderThickness"),
|
||||
new("Border Thickness", "SemiBorderThicknessControl"),
|
||||
new("Border Thickness", "SemiBorderThicknessControlFocus"),
|
||||
new("Spacing", "SemiSpacingNone"),
|
||||
new("Spacing", "SemiSpacingSuperTight"),
|
||||
new("Spacing", "SemiSpacingExtraTight"),
|
||||
new("Spacing", "SemiSpacingTight"),
|
||||
new("Spacing", "SemiSpacingBaseTight"),
|
||||
new("Spacing", "SemiSpacingBase"),
|
||||
new("Spacing", "SemiSpacingBaseLoose"),
|
||||
new("Spacing", "SemiSpacingLoose"),
|
||||
new("Spacing", "SemiSpacingExtraLoose"),
|
||||
new("Spacing", "SemiSpacingSuperLoose"),
|
||||
new("Thickness", "SemiThicknessNone"),
|
||||
new("Thickness", "SemiThicknessSuperTight"),
|
||||
new("Thickness", "SemiThicknessExtraTight"),
|
||||
new("Thickness", "SemiThicknessTight"),
|
||||
new("Thickness", "SemiThicknessBaseTight"),
|
||||
new("Thickness", "SemiThicknessBase"),
|
||||
new("Thickness", "SemiThicknessBaseLoose"),
|
||||
new("Thickness", "SemiThicknessLoose"),
|
||||
new("Thickness", "SemiThicknessExtraLoose"),
|
||||
new("Thickness", "SemiThicknessSuperLoose"),
|
||||
new("FontSize", "SemiFontSizeSmall"),
|
||||
new("FontSize", "SemiFontSizeRegular"),
|
||||
new("FontSize", "SemiFontSizeHeader6"),
|
||||
new("FontSize", "SemiFontSizeHeader5"),
|
||||
new("FontSize", "SemiFontSizeHeader4"),
|
||||
new("FontSize", "SemiFontSizeHeader3"),
|
||||
new("FontSize", "SemiFontSizeHeader2"),
|
||||
new("FontSize", "SemiFontSizeHeader1"),
|
||||
new("FontWeight", "SemiFontWeightLight"),
|
||||
new("FontWeight", "SemiFontWeightRegular"),
|
||||
new("FontWeight", "SemiFontWeightBold"),
|
||||
new("FontFamily", "SemiFontFamilyRegular"),
|
||||
];
|
||||
}
|
||||
|
||||
public class VariableItem()
|
||||
{
|
||||
public string? Category { get; set; }
|
||||
public string? ResourceKey { get; set; }
|
||||
public Type? Type { get; set; }
|
||||
public string? Value { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
public VariableItem(string category, string resourceKey, string description = "") : this()
|
||||
{
|
||||
Category = category;
|
||||
ResourceKey = resourceKey;
|
||||
Description = description;
|
||||
}
|
||||
|
||||
public string CopyText =>
|
||||
$"""
|
||||
<StaticResource x:Key="" ResourceKey="{ResourceKey}" />
|
||||
""";
|
||||
}
|
||||
@@ -116,15 +116,15 @@
|
||||
<TabItem
|
||||
Theme="{DynamicResource CategoryTabItem}"
|
||||
Header="Resource Browser" />
|
||||
<TabItem Header="Palette">
|
||||
<pages:PaletteDemo />
|
||||
</TabItem>
|
||||
<TabItem Header="HighContrastTheme">
|
||||
<pages:HighContrastDemo />
|
||||
</TabItem>
|
||||
<TabItem Header="Variables">
|
||||
<pages:VariablesDemo />
|
||||
</TabItem>
|
||||
<!-- <TabItem Header="Palette"> -->
|
||||
<!-- <pages:PaletteDemo /> -->
|
||||
<!-- </TabItem> -->
|
||||
<!-- <TabItem Header="HighContrastTheme"> -->
|
||||
<!-- <pages:HighContrastDemo /> -->
|
||||
<!-- </TabItem> -->
|
||||
<!-- <TabItem Header="Variables"> -->
|
||||
<!-- <pages:VariablesDemo /> -->
|
||||
<!-- </TabItem> -->
|
||||
<TabItem Header="Icon">
|
||||
<pages:IconDemo />
|
||||
</TabItem>
|
||||
@@ -134,12 +134,12 @@
|
||||
<TabItem Header="ColorPicker">
|
||||
<pages:ColorPickerDemo />
|
||||
</TabItem>
|
||||
<TabItem Header="DataGrid">
|
||||
<pages:DataGridDemo />
|
||||
</TabItem>
|
||||
<TabItem Header="TreeDataGrid">
|
||||
<pages:TreeDataGridDemo />
|
||||
</TabItem>
|
||||
<!-- <TabItem Header="DataGrid"> -->
|
||||
<!-- <pages:DataGridDemo /> -->
|
||||
<!-- </TabItem> -->
|
||||
<!-- <TabItem Header="TreeDataGrid"> -->
|
||||
<!-- <pages:TreeDataGridDemo /> -->
|
||||
<!-- </TabItem> -->
|
||||
<TabItem
|
||||
Theme="{DynamicResource CategoryTabItem}"
|
||||
Header="Basic" />
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<PackageProjectUrl>https://github.com/irihitech/Semi.Avalonia</PackageProjectUrl>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<PackageIcon>irihi.png</PackageIcon>
|
||||
<PackageProjectUrl>https://github.com/irihitech/Semi.Avalonia</PackageProjectUrl>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
<AvaloniaVersion>11.3.7</AvaloniaVersion>
|
||||
<AvaloniaVersion>12.0.999-cibuild0061987-alpha</AvaloniaVersion>
|
||||
<DataGridVersion>11.3.7</DataGridVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
@@ -9,5 +9,6 @@
|
||||
<PackageVersion Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
|
||||
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="$(DataGridVersion)"/>
|
||||
<PackageVersion Include="Avalonia.Controls.TreeDataGrid" Version="11.1.1"/>
|
||||
<PackageVersion Include="Irihi.Avalonia.Shared" Version="0.4.0-nightly-20260206184422"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,8 +1,8 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:iri="https://irihi.tech/shared"
|
||||
xmlns:converters="using:Avalonia.Controls.Converters">
|
||||
<converters:CornerRadiusFilterConverter x:Key="LeftCornerRadiusFilterConverter" Filter="TopLeft, BottomLeft" />
|
||||
<converters:ToBrushConverter x:Key="ToBrushConverter" />
|
||||
|
||||
<ControlTheme x:Key="{x:Type ColorPicker}" TargetType="ColorPicker">
|
||||
@@ -16,11 +16,11 @@
|
||||
<Border
|
||||
Margin="1,1,0,1"
|
||||
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
|
||||
CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" />
|
||||
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}" />
|
||||
<Border
|
||||
Margin="1,1,0,1"
|
||||
Background="{TemplateBinding HsvColor, Converter={StaticResource ToBrushConverter}}"
|
||||
CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" />
|
||||
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}" />
|
||||
</Panel>
|
||||
</Template>
|
||||
</Setter>
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="using:Avalonia.Controls.Converters"
|
||||
xmlns:iri="https://irihi.tech/shared"
|
||||
xmlns:pc="using:Avalonia.Controls.Primitives.Converters">
|
||||
<pc:AccentColorConverter x:Key="AccentColorConverter" />
|
||||
<converters:CornerRadiusFilterConverter x:Key="LeftCornerRadiusFilterConverter" Filter="TopLeft, BottomLeft" />
|
||||
<converters:CornerRadiusFilterConverter x:Key="RightCornerRadiusFilterConverter" Filter="TopRight, BottomRight" />
|
||||
|
||||
<ControlTheme x:Key="{x:Type ColorPreviewer}" TargetType="ColorPreviewer">
|
||||
<Setter Property="Height" Value="{DynamicResource ColorPreviewerHeight}" />
|
||||
@@ -34,7 +32,7 @@
|
||||
Background="{TemplateBinding HsvColor,
|
||||
Converter={StaticResource AccentColorConverter},
|
||||
ConverterParameter='-2'}"
|
||||
CornerRadius="{TemplateBinding CornerRadius,Converter={StaticResource LeftCornerRadiusFilterConverter}}"
|
||||
CornerRadius="{TemplateBinding CornerRadius,Converter={iri:CornerRadiusMixerConverter Left}}"
|
||||
Tag="-2" />
|
||||
<Border
|
||||
Name="PART_AccentDecrement1Border"
|
||||
@@ -70,7 +68,7 @@
|
||||
Background="{TemplateBinding HsvColor,
|
||||
Converter={StaticResource AccentColorConverter},
|
||||
ConverterParameter='2'}"
|
||||
CornerRadius="{TemplateBinding CornerRadius,Converter={StaticResource RightCornerRadiusFilterConverter}}"
|
||||
CornerRadius="{TemplateBinding CornerRadius,Converter={iri:CornerRadiusMixerConverter Right}}"
|
||||
Tag="2" />
|
||||
</Grid>
|
||||
<!-- Preview color: Must be last for drop shadow Z-index -->
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
|
||||
<Version>11.3.7.2</Version>
|
||||
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 11.3.7.2</PackageReleaseNotes>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Version>12.0.0-nightly-20260210000416</Version>
|
||||
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 12.0.0-nightly-20260210000416</PackageReleaseNotes>
|
||||
<Title>Semi.Avalonia.ColorPicker</Title>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia.Controls.ColorPicker"/>
|
||||
<PackageReference Include="Irihi.Avalonia.Shared"/>
|
||||
<None Include="README.md" Pack="true" PackagePath="\"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
x:Class="Semi.Avalonia.SemiPopupAnimations"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:Semi.Avalonia.Converters">
|
||||
xmlns:semi="https://irihi.tech/semi">
|
||||
<Style Selector="Popup LayoutTransformControl#PART_LayoutTransform">
|
||||
<Setter Property="RenderTransformOrigin" Value="{Binding $parent[Popup].Placement, Converter={x:Static converters:PlacementToRenderTransformOriginConverter.Instance}}" />
|
||||
<Setter Property="RenderTransformOrigin" Value="{Binding $parent[Popup].Placement, Converter={semi:PlacementToRenderTransformOriginConverter}}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="Popup[IsOpen=True] LayoutTransformControl#PART_LayoutTransform">
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:iri="https://irihi.tech/shared">
|
||||
<Design.PreviewWith>
|
||||
<StackPanel Margin="20" Spacing="20">
|
||||
<TextBox Text="Hello" />
|
||||
<AutoCompleteBox Width="100" />
|
||||
<AutoCompleteBox Width="100" PlaceholderText="Hello" />
|
||||
</StackPanel>
|
||||
</Design.PreviewWith>
|
||||
<ControlTheme x:Key="{x:Type AutoCompleteBox}" TargetType="AutoCompleteBox">
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="PlaceholderForeground" Value="{DynamicResource TextBoxPlaceholderForeground}" />
|
||||
<Setter Property="MinHeight" Value="{DynamicResource AutoCompleteBoxDefaultHeight}" />
|
||||
<Setter Property="MaxDropDownHeight" Value="{DynamicResource AutoCompleteMaxDropdownHeight}" />
|
||||
<Setter Property="Template">
|
||||
@@ -19,11 +21,13 @@
|
||||
Name="PART_TextBox"
|
||||
VerticalAlignment="Stretch"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
ClearSelectionOnLostFocus="{TemplateBinding ClearSelectionOnLostFocus}"
|
||||
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
|
||||
Theme="{DynamicResource NonErrorTextBox}"
|
||||
InnerLeftContent="{TemplateBinding InnerLeftContent}"
|
||||
InnerRightContent="{TemplateBinding InnerRightContent}"
|
||||
Watermark="{TemplateBinding Watermark}" />
|
||||
PlaceholderForeground="{TemplateBinding PlaceholderForeground}"
|
||||
PlaceholderText="{TemplateBinding PlaceholderText}" />
|
||||
<Popup
|
||||
Name="PART_Popup"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
@@ -54,44 +58,13 @@
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^.Bordered">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="AutoCompleteBox">
|
||||
<Panel>
|
||||
<TextBox
|
||||
Name="PART_TextBox"
|
||||
VerticalAlignment="Stretch"
|
||||
MinHeight="0"
|
||||
Classes="Bordered"
|
||||
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
|
||||
Watermark="{TemplateBinding Watermark}" />
|
||||
<Popup
|
||||
Name="PART_Popup"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
InheritsTransform="True"
|
||||
IsLightDismissEnabled="True"
|
||||
PlacementTarget="{TemplateBinding}">
|
||||
<Border
|
||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="{DynamicResource AutoCompleteBoxPopupMargin}"
|
||||
Padding="{DynamicResource AutoCompleteBoxPopupPadding}"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{DynamicResource AutoCompleteBoxPopupBackground}"
|
||||
BorderBrush="{DynamicResource AutoCompleteBoxPopupBorderBrush}"
|
||||
BorderThickness="{DynamicResource AutoCompleteBoxPopupBorderThickness}"
|
||||
BoxShadow="{DynamicResource AutoCompleteBoxPopupBoxShadow}"
|
||||
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}">
|
||||
<ListBox
|
||||
Name="PART_SelectingItemsControl"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
ItemTemplate="{TemplateBinding ItemTemplate}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ScrollViewer.IsScrollChainingEnabled="False" />
|
||||
</Border>
|
||||
</Popup>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
<Style Selector="^ /template/ TextBox#PART_TextBox">
|
||||
<Setter Property="MinHeight" Value="0" />
|
||||
<Setter Property="iri:ClassHelper.Classes" Value="Bordered" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ ListBox#PART_SelectingItemsControl">
|
||||
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="False" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Large">
|
||||
<Setter Property="MinHeight" Value="{DynamicResource AutoCompleteBoxLargeHeight}" />
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<ControlTheme x:Key="{x:Type CalendarDatePicker}" TargetType="CalendarDatePicker">
|
||||
<Setter Property="Background" Value="{DynamicResource CalendarDatePickerBackground}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerForeground}" />
|
||||
<Setter Property="PlaceholderForeground" Value="{DynamicResource TextBoxPlaceholderForeground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{DynamicResource CalendarDatePickerBorderThickness}" />
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource CalendarDatePickerCornerRadius}" />
|
||||
@@ -52,8 +53,9 @@
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Theme="{DynamicResource NonErrorTextBox}"
|
||||
UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
|
||||
Watermark="{TemplateBinding Watermark}">
|
||||
UseFloatingPlaceholder="{TemplateBinding UseFloatingPlaceholder}"
|
||||
PlaceholderForeground="{TemplateBinding PlaceholderForeground}"
|
||||
PlaceholderText="{TemplateBinding PlaceholderText}">
|
||||
<TextBox.Styles>
|
||||
<Style Selector="TextBox#PART_TextBox:pointerover /template/ Border#PART_ContentPresenterBorder">
|
||||
<!-- By default the TextBox has its own focused state, override this to disable it here -->
|
||||
|
||||
@@ -50,21 +50,33 @@
|
||||
Data="{StaticResource WindowExpandGlyph}"
|
||||
Foreground="{Binding $parent[Button].Foreground}" />
|
||||
</Button>
|
||||
<Button Name="PART_MinimizeButton" Theme="{StaticResource CaptionButton}">
|
||||
<Button
|
||||
Name="PART_MinimizeButton"
|
||||
Theme="{StaticResource CaptionButton}"
|
||||
AutomationProperties.Name="Minimize"
|
||||
Win32Properties.NonClientHitTestResult="MinButton">
|
||||
<PathIcon
|
||||
Name="PART_MinimizeButtonIcon"
|
||||
Theme="{StaticResource InnerPathIcon}"
|
||||
Data="{StaticResource WindowMinimizeGlyph}"
|
||||
Foreground="{Binding $parent[Button].Foreground}" />
|
||||
</Button>
|
||||
<Button Name="PART_RestoreButton" Theme="{StaticResource CaptionButton}">
|
||||
<Button
|
||||
Name="PART_RestoreButton"
|
||||
Theme="{StaticResource CaptionButton}"
|
||||
AutomationProperties.Name="Maximize"
|
||||
Win32Properties.NonClientHitTestResult="MaxButton">
|
||||
<PathIcon
|
||||
Name="PART_RestoreButtonIcon"
|
||||
Theme="{StaticResource InnerPathIcon}"
|
||||
Data="{StaticResource WindowMaximizeGlyph}"
|
||||
Foreground="{Binding $parent[Button].Foreground}" />
|
||||
</Button>
|
||||
<Button Name="PART_CloseButton" Theme="{StaticResource CaptionButton}">
|
||||
<Button
|
||||
Name="PART_CloseButton"
|
||||
Theme="{StaticResource CaptionButton}"
|
||||
AutomationProperties.Name="Close"
|
||||
Win32Properties.NonClientHitTestResult="Close">
|
||||
<PathIcon
|
||||
Name="PART_CloseButtonIcon"
|
||||
Theme="{StaticResource InnerPathIcon}"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converter="clr-namespace:Semi.Avalonia.Converters">
|
||||
xmlns:semi="https://irihi.tech/semi">
|
||||
<Design.PreviewWith>
|
||||
<StackPanel Spacing="20" Width="800" Height="800">
|
||||
<StackPanel.Styles>
|
||||
@@ -197,8 +197,8 @@
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
ItemContainerTheme="{DynamicResource CarouselIndicatorDotListBoxItem}"
|
||||
ItemsSource="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemToObjectConverter}}"
|
||||
IsVisible="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemVisibleConverter}}"
|
||||
ItemsSource="{TemplateBinding ItemCount, Converter={x:Static semi:ItemConverter.ItemToObjectConverter}}"
|
||||
IsVisible="{TemplateBinding ItemCount, Converter={x:Static semi:ItemConverter.ItemVisibleConverter}}"
|
||||
SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
@@ -213,7 +213,7 @@
|
||||
Theme="{DynamicResource CarouselButton}"
|
||||
Margin="{DynamicResource CarouselButtonMargin}"
|
||||
Foreground="{DynamicResource CarouselButtonForeground}"
|
||||
IsVisible="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemVisibleConverter}}"
|
||||
IsVisible="{TemplateBinding ItemCount, Converter={x:Static semi:ItemConverter.ItemVisibleConverter}}"
|
||||
Command="{Binding $parent[Carousel].Previous}" />
|
||||
<Button
|
||||
Grid.Row="0"
|
||||
@@ -222,7 +222,7 @@
|
||||
Theme="{DynamicResource CarouselButton}"
|
||||
Margin="{DynamicResource CarouselButtonMargin}"
|
||||
Foreground="{DynamicResource CarouselButtonForeground}"
|
||||
IsVisible="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemVisibleConverter}}"
|
||||
IsVisible="{TemplateBinding ItemCount, Converter={x:Static semi:ItemConverter.ItemVisibleConverter}}"
|
||||
Command="{Binding $parent[Carousel].Next}"
|
||||
RenderTransform="rotate(180deg)" />
|
||||
</Grid>
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Text="{TemplateBinding Text, Mode=TwoWay}"
|
||||
Watermark="{TemplateBinding PlaceholderText}"
|
||||
PlaceholderText="{TemplateBinding PlaceholderText}"
|
||||
IsVisible="{TemplateBinding IsEditable}" />
|
||||
|
||||
<Button
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="20">
|
||||
<StackPanel Margin="20">
|
||||
<DatePickerPresenter />
|
||||
</Border>
|
||||
<DatePicker Width="500" />
|
||||
</StackPanel>
|
||||
</Design.PreviewWith>
|
||||
<ControlTheme x:Key="{x:Type DatePickerPresenter}" TargetType="DatePickerPresenter">
|
||||
<Setter Property="Width" Value="296" />
|
||||
@@ -141,6 +142,7 @@
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="MinHeight" Value="{DynamicResource DateTimePickerButtonDefaultHeight}" />
|
||||
<Setter Property="MinWidth" Value="296" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="DatePicker">
|
||||
<DataValidationErrors>
|
||||
@@ -152,8 +154,8 @@
|
||||
Name="PART_FlyoutButton"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Width="298"
|
||||
MinWidth="298"
|
||||
MinWidth="{TemplateBinding MinWidth}"
|
||||
MaxWidth="{TemplateBinding MaxWidth}"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
|
||||
5
src/Semi.Avalonia/Controls/GroupBox.axaml
Normal file
5
src/Semi.Avalonia/Controls/GroupBox.axaml
Normal file
@@ -0,0 +1,5 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<StaticResource x:Key="{x:Type GroupBox}" ResourceKey="GroupBox"/>
|
||||
</ResourceDictionary>
|
||||
@@ -1,7 +1,7 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls">
|
||||
xmlns:iri="https://irihi.tech/shared">
|
||||
<Design.PreviewWith>
|
||||
<StackPanel Spacing="20">
|
||||
<HeaderedContentControl
|
||||
@@ -23,7 +23,6 @@
|
||||
</HeaderedContentControl>
|
||||
</StackPanel>
|
||||
</Design.PreviewWith>
|
||||
<converters:MarginMultiplierConverter x:Key="SeparatorBorderMultiplier" Top="True" Indent="1" />
|
||||
|
||||
<ControlTheme x:Key="{x:Type HeaderedContentControl}" TargetType="HeaderedContentControl">
|
||||
<Setter Property="Padding" Value="3" />
|
||||
@@ -97,7 +96,7 @@
|
||||
Name="SeparatorBorder"
|
||||
Grid.Row="1"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource SeparatorBorderMultiplier}}">
|
||||
BorderThickness="{TemplateBinding BorderThickness, Converter={iri:ThicknessMixerConverter Top}}">
|
||||
<Border.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<TemplateBinding Property="Header" Converter="{x:Static ObjectConverters.IsNotNull}" />
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="using:Semi.Avalonia.Converters"
|
||||
xmlns:dialogs="clr-namespace:Avalonia.Dialogs;assembly=Avalonia.Dialogs"
|
||||
xmlns:internal="clr-namespace:Avalonia.Dialogs.Internal;assembly=Avalonia.Dialogs"
|
||||
xmlns:iri="https://irihi.tech/shared"
|
||||
xmlns:dialogs="using:Avalonia.Dialogs"
|
||||
xmlns:internal="using:Avalonia.Dialogs.Internal"
|
||||
xmlns:cvt="using:Avalonia.Controls.Converters">
|
||||
<Design.PreviewWith>
|
||||
<Border
|
||||
@@ -14,11 +14,11 @@
|
||||
</Border>
|
||||
</Design.PreviewWith>
|
||||
|
||||
<converters:KeyToPathConverter x:Key="Icons">
|
||||
<iri:ResourceConverter x:Key="Icons">
|
||||
<StreamGeometry x:Key="Icon_Folder">M19,20H4C2.89,20 2,19.1 2,18V6C2,4.89 2.89,4 4,4H10L12,6H19A2,2 0 0,1 21,8H21L4,8V18L6.14,10H23.21L20.93,18.5C20.7,19.37 19.92,20 19,20Z</StreamGeometry>
|
||||
<StreamGeometry x:Key="Icon_File">M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M15,18V16H6V18H15M18,14V12H6V14H18Z</StreamGeometry>
|
||||
<StreamGeometry x:Key="Icon_Volume">M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M12,4A6,6 0 0,0 6,10C6,13.31 8.69,16 12.1,16L11.22,13.77C10.95,13.29 11.11,12.68 11.59,12.4L12.45,11.9C12.93,11.63 13.54,11.79 13.82,12.27L15.74,14.69C17.12,13.59 18,11.9 18,10A6,6 0 0,0 12,4M12,9A1,1 0 0,1 13,10A1,1 0 0,1 12,11A1,1 0 0,1 11,10A1,1 0 0,1 12,9M7,18A1,1 0 0,0 6,19A1,1 0 0,0 7,20A1,1 0 0,0 8,19A1,1 0 0,0 7,18M12.09,13.27L14.58,19.58L17.17,18.08L12.95,12.77L12.09,13.27Z</StreamGeometry>
|
||||
</converters:KeyToPathConverter>
|
||||
</iri:ResourceConverter>
|
||||
<ControlTheme x:Key="{x:Type dialogs:ManagedFileChooser}" TargetType="dialogs:ManagedFileChooser">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate x:DataType="internal:ManagedFileChooserViewModel" TargetType="dialogs:ManagedFileChooser">
|
||||
@@ -77,7 +77,7 @@
|
||||
<TextBox
|
||||
IsVisible="{Binding !SelectingFolder}"
|
||||
Text="{Binding FileName}"
|
||||
Watermark="{DynamicResource STRING_CHOOSER_FILE_NAME}" />
|
||||
PlaceholderText="{DynamicResource STRING_CHOOSER_FILE_NAME}" />
|
||||
</DockPanel>
|
||||
<CheckBox
|
||||
VerticalAlignment="Center"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource NumericUpDownCornerRadius}" />
|
||||
<Setter Property="MinHeight" Value="{DynamicResource NumericUpDownDefaultHeight}" />
|
||||
<Setter Property="PlaceholderForeground" Value="{DynamicResource TextBoxPlaceholderForeground}" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="NumericUpDown">
|
||||
<DataValidationErrors>
|
||||
@@ -38,7 +39,8 @@
|
||||
Theme="{DynamicResource NonErrorTextBox}"
|
||||
InnerLeftContent="{TemplateBinding InnerLeftContent}"
|
||||
InnerRightContent="{TemplateBinding InnerRightContent}"
|
||||
Watermark="{TemplateBinding Watermark}" />
|
||||
PlaceholderForeground="{TemplateBinding PlaceholderForeground}"
|
||||
PlaceholderText="{TemplateBinding PlaceholderText}" />
|
||||
</ButtonSpinner>
|
||||
</DataValidationErrors>
|
||||
</ControlTemplate>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="using:Avalonia.Controls.Converters"
|
||||
xmlns:semiConverters="clr-namespace:Semi.Avalonia.Converters">
|
||||
xmlns:semi="https://irihi.tech/semi"
|
||||
xmlns:converters="using:Avalonia.Controls.Converters">
|
||||
<Design.PreviewWith>
|
||||
<StackPanel Margin="20" Spacing="20">
|
||||
<ProgressBar
|
||||
@@ -338,8 +338,6 @@
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<semiConverters:PositionToAngleConverter x:Key="AngleConverter" />
|
||||
|
||||
<ControlTheme x:Key="ProgressRing" TargetType="ProgressBar">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ProgressBarIndicatorBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ProgressBarBackground}" />
|
||||
@@ -365,8 +363,7 @@
|
||||
StrokeJoin="Round"
|
||||
StrokeLineCap="Round"
|
||||
StrokeThickness="{Binding BorderThickness.Left, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
SweepAngle="{TemplateBinding Percentage,
|
||||
Converter={StaticResource AngleConverter}}" />
|
||||
SweepAngle="{TemplateBinding Percentage,Converter={semi:PositionToAngleConverter}}" />
|
||||
<Arc
|
||||
Name="IndeterminateIndicator"
|
||||
Opacity="0"
|
||||
@@ -376,8 +373,7 @@
|
||||
StrokeJoin="Round"
|
||||
StrokeLineCap="Round"
|
||||
StrokeThickness="{Binding BorderThickness.Left, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
SweepAngle="{TemplateBinding Percentage,
|
||||
Converter={StaticResource AngleConverter}}" />
|
||||
SweepAngle="{TemplateBinding Percentage,Converter={semi:PositionToAngleConverter}}" />
|
||||
<TextBlock
|
||||
Name="PART_ProgressText"
|
||||
HorizontalAlignment="Center"
|
||||
@@ -443,4 +439,4 @@
|
||||
</Style.Animations>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary>
|
||||
@@ -1,7 +1,6 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="using:Avalonia.Controls.Converters">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Design.PreviewWith>
|
||||
<StackPanel>
|
||||
<ScrollBar Width="200" Orientation="Horizontal" />
|
||||
@@ -54,6 +53,7 @@
|
||||
MinWidth="{StaticResource ScrollBarThickness}"
|
||||
VerticalAlignment="Center"
|
||||
Focusable="False"
|
||||
AutomationProperties.Name="Column left"
|
||||
Theme="{StaticResource ScrollBarRepeatButton}">
|
||||
<PathIcon
|
||||
Theme="{StaticResource InnerPathIcon}"
|
||||
@@ -76,6 +76,7 @@
|
||||
VerticalAlignment="Stretch"
|
||||
CornerRadius="0"
|
||||
Focusable="False"
|
||||
AutomationProperties.Name="Page left"
|
||||
Theme="{StaticResource ScrollBarRepeatButton}" />
|
||||
</Track.DecreaseButton>
|
||||
<Track.IncreaseButton>
|
||||
@@ -86,9 +87,10 @@
|
||||
VerticalAlignment="Stretch"
|
||||
CornerRadius="0"
|
||||
Focusable="False"
|
||||
AutomationProperties.Name="Page right"
|
||||
Theme="{StaticResource ScrollBarRepeatButton}" />
|
||||
</Track.IncreaseButton>
|
||||
<Thumb Name="thumb" />
|
||||
<Thumb Name="thumb" AutomationProperties.Name="Position" />
|
||||
</Track>
|
||||
<RepeatButton
|
||||
Name="PART_LineDownButton"
|
||||
@@ -97,6 +99,7 @@
|
||||
VerticalAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Focusable="False"
|
||||
AutomationProperties.Name="Column right"
|
||||
Theme="{DynamicResource ScrollBarRepeatButton}">
|
||||
<PathIcon
|
||||
Theme="{DynamicResource InnerPathIcon}"
|
||||
@@ -124,6 +127,7 @@
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Focusable="False"
|
||||
AutomationProperties.Name="Line up"
|
||||
Theme="{StaticResource ScrollBarRepeatButton}">
|
||||
<PathIcon
|
||||
Theme="{StaticResource InnerPathIcon}"
|
||||
@@ -147,6 +151,7 @@
|
||||
VerticalAlignment="Stretch"
|
||||
CornerRadius="0"
|
||||
Focusable="False"
|
||||
AutomationProperties.Name="Page up"
|
||||
Theme="{StaticResource ScrollBarRepeatButton}" />
|
||||
</Track.DecreaseButton>
|
||||
<Track.IncreaseButton>
|
||||
@@ -157,9 +162,10 @@
|
||||
VerticalAlignment="Stretch"
|
||||
CornerRadius="0"
|
||||
Focusable="False"
|
||||
AutomationProperties.Name="Page down"
|
||||
Theme="{StaticResource ScrollBarRepeatButton}" />
|
||||
</Track.IncreaseButton>
|
||||
<Thumb Name="thumb" />
|
||||
<Thumb Name="thumb" AutomationProperties.Name="Position" />
|
||||
</Track>
|
||||
<RepeatButton
|
||||
Name="PART_LineDownButton"
|
||||
@@ -168,6 +174,7 @@
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Focusable="False"
|
||||
AutomationProperties.Name="Line down"
|
||||
Theme="{StaticResource ScrollBarRepeatButton}">
|
||||
<PathIcon
|
||||
Theme="{StaticResource InnerPathIcon}"
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<MenuFlyout x:Key="SelectableTextBlockContextFlyout" Placement="Bottom">
|
||||
<MenuFlyout
|
||||
x:Key="SelectableTextBlockContextFlyout"
|
||||
ShowMode="{OnFormFactor Desktop=Standard, Mobile=Transient}"
|
||||
Placement="Bottom">
|
||||
<MenuItem
|
||||
Command="{Binding $parent[SelectableTextBlock].Copy}"
|
||||
Header="{DynamicResource STRING_MENU_COPY}"
|
||||
|
||||
@@ -92,11 +92,12 @@
|
||||
VerticalAlignment="Bottom"
|
||||
Fill="{DynamicResource SliderTickForeground}"
|
||||
IsVisible="False"
|
||||
Maximum="{TemplateBinding Slider.Maximum}"
|
||||
Minimum="{TemplateBinding Slider.Minimum}"
|
||||
Orientation="{TemplateBinding Slider.Orientation}"
|
||||
Maximum="{TemplateBinding Maximum}"
|
||||
Minimum="{TemplateBinding Minimum}"
|
||||
Orientation="{TemplateBinding Orientation}"
|
||||
Placement="Top"
|
||||
TickFrequency="{TemplateBinding Slider.TickFrequency}"
|
||||
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
|
||||
TickFrequency="{TemplateBinding TickFrequency}"
|
||||
Ticks="{TemplateBinding Ticks}" />
|
||||
<TickBar
|
||||
Name="BottomTickBar"
|
||||
@@ -106,11 +107,12 @@
|
||||
VerticalAlignment="Top"
|
||||
Fill="{DynamicResource SliderTickForeground}"
|
||||
IsVisible="False"
|
||||
Maximum="{TemplateBinding Slider.Maximum}"
|
||||
Minimum="{TemplateBinding Slider.Minimum}"
|
||||
Orientation="{TemplateBinding Slider.Orientation}"
|
||||
Maximum="{TemplateBinding Maximum}"
|
||||
Minimum="{TemplateBinding Minimum}"
|
||||
Orientation="{TemplateBinding Orientation}"
|
||||
Placement="Bottom"
|
||||
TickFrequency="{TemplateBinding Slider.TickFrequency}"
|
||||
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
|
||||
TickFrequency="{TemplateBinding TickFrequency}"
|
||||
Ticks="{TemplateBinding Ticks}" />
|
||||
<Track
|
||||
Name="PART_Track"
|
||||
@@ -169,11 +171,12 @@
|
||||
HorizontalAlignment="Right"
|
||||
Fill="{DynamicResource SliderTickForeground}"
|
||||
IsVisible="False"
|
||||
Maximum="{TemplateBinding Slider.Maximum}"
|
||||
Minimum="{TemplateBinding Slider.Minimum}"
|
||||
Orientation="{TemplateBinding Slider.Orientation}"
|
||||
Maximum="{TemplateBinding Maximum}"
|
||||
Minimum="{TemplateBinding Minimum}"
|
||||
Orientation="{TemplateBinding Orientation}"
|
||||
Placement="Left"
|
||||
TickFrequency="{TemplateBinding Slider.TickFrequency}"
|
||||
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
|
||||
TickFrequency="{TemplateBinding TickFrequency}"
|
||||
Ticks="{TemplateBinding Ticks}" />
|
||||
<TickBar
|
||||
Name="RightTickBar"
|
||||
@@ -183,11 +186,12 @@
|
||||
HorizontalAlignment="Left"
|
||||
Fill="{DynamicResource SliderTickForeground}"
|
||||
IsVisible="False"
|
||||
Maximum="{TemplateBinding Slider.Maximum}"
|
||||
Minimum="{TemplateBinding Slider.Minimum}"
|
||||
Orientation="{TemplateBinding Slider.Orientation}"
|
||||
Maximum="{TemplateBinding Maximum}"
|
||||
Minimum="{TemplateBinding Minimum}"
|
||||
Orientation="{TemplateBinding Orientation}"
|
||||
Placement="Right"
|
||||
TickFrequency="{TemplateBinding Slider.TickFrequency}"
|
||||
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
|
||||
TickFrequency="{TemplateBinding TickFrequency}"
|
||||
Ticks="{TemplateBinding Ticks}" />
|
||||
<Track
|
||||
Name="PART_Track"
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:iri="https://irihi.tech/shared">
|
||||
<Design.PreviewWith>
|
||||
<StackPanel Width="500" Height="500" Margin="20" Spacing="8">
|
||||
<SplitButton
|
||||
Theme="{DynamicResource SolidSplitButton}"
|
||||
Theme="{DynamicResource OutlineSplitButton}"
|
||||
Classes="Danger"
|
||||
CornerRadius="12"
|
||||
Content="Hello" />
|
||||
<ToggleSplitButton
|
||||
IsChecked="True"
|
||||
@@ -73,47 +76,40 @@
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="SplitButton">
|
||||
<Border
|
||||
BackgroundSizing="OuterBorderEdge"
|
||||
ClipToBounds="True"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<DockPanel>
|
||||
<Button
|
||||
Name="PART_SecondaryButton"
|
||||
Padding="4,0"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="0"
|
||||
DockPanel.Dock="Right"
|
||||
Theme="{DynamicResource SemiSplitButtonElement}">
|
||||
<PathIcon
|
||||
Theme="{DynamicResource InnerPathIcon}"
|
||||
Data="{DynamicResource SplitButtonIconGlyph}"
|
||||
Foreground="{Binding $parent[Button].Foreground}" />
|
||||
</Button>
|
||||
<Rectangle
|
||||
Name="SeparatorBorder"
|
||||
Width="{DynamicResource SplitButtonSeparatorWidth}"
|
||||
VerticalAlignment="Stretch"
|
||||
DockPanel.Dock="Right"
|
||||
Fill="Transparent"
|
||||
StrokeThickness="0" />
|
||||
<Button
|
||||
Name="PART_PrimaryButton"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Command="{TemplateBinding Command}"
|
||||
CommandParameter="{TemplateBinding CommandParameter}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
CornerRadius="0"
|
||||
FontFamily="{TemplateBinding FontFamily}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="{TemplateBinding FontWeight}"
|
||||
Theme="{DynamicResource SemiSplitButtonElement}" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<Grid
|
||||
ColumnDefinitions="*,Auto"
|
||||
ColumnSpacing="{DynamicResource SplitButtonSeparatorWidth}">
|
||||
<Button
|
||||
Name="PART_PrimaryButton"
|
||||
Grid.Column="0"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Command="{TemplateBinding Command}"
|
||||
CommandParameter="{TemplateBinding CommandParameter}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}"
|
||||
FontFamily="{TemplateBinding FontFamily}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="{TemplateBinding FontWeight}"
|
||||
Theme="{DynamicResource SemiSplitButtonElement}" />
|
||||
<Button
|
||||
Name="PART_SecondaryButton"
|
||||
Grid.Column="1"
|
||||
Padding="0"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
MinWidth="{Binding $self.MinHeight}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Right}}"
|
||||
Theme="{DynamicResource SemiSplitButtonElement}">
|
||||
<PathIcon
|
||||
Theme="{DynamicResource InnerPathIcon}"
|
||||
Data="{DynamicResource SplitButtonIconGlyph}"
|
||||
Foreground="{Binding $parent[Button].Foreground}" />
|
||||
</Button>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:CompileBindings="True">
|
||||
<ControlTheme x:Key="{x:Type SplitView}" TargetType="SplitView">
|
||||
<Setter Property="OpenPaneLength" Value="{DynamicResource SplitViewOpenPaneThemeLength}" />
|
||||
<Setter Property="CompactPaneLength" Value="{DynamicResource SplitViewCompactPaneThemeLength}" />
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<MenuFlyout x:Key="DefaultTextBoxContextFlyout" Placement="Bottom">
|
||||
<MenuFlyout
|
||||
x:Key="DefaultTextBoxContextFlyout"
|
||||
ShowMode="{OnFormFactor Desktop=Standard, Mobile=Transient}"
|
||||
Placement="Bottom">
|
||||
<MenuItem
|
||||
Command="{Binding $parent[TextBox].Cut}"
|
||||
Header="{DynamicResource STRING_MENU_CUT}"
|
||||
@@ -21,6 +24,7 @@
|
||||
|
||||
<ControlTheme x:Key="{x:Type TextBox}" TargetType="TextBox">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextBoxForeground}" />
|
||||
<Setter Property="PlaceholderForeground" Value="{DynamicResource TextBoxPlaceholderForeground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource TextBoxDefaultBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxDefaultBorderBrush}" />
|
||||
<Setter Property="SelectionBrush" Value="{DynamicResource TextBoxSelectionBackground}" />
|
||||
@@ -66,8 +70,8 @@
|
||||
Name="PART_Watermark"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Opacity="0.5"
|
||||
Text="{TemplateBinding Watermark}"
|
||||
Foreground="{TemplateBinding PlaceholderForeground}"
|
||||
Text="{TemplateBinding PlaceholderText}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}"
|
||||
TextWrapping="{TemplateBinding TextWrapping}">
|
||||
<TextBlock.IsVisible>
|
||||
@@ -254,6 +258,7 @@
|
||||
|
||||
<ControlTheme x:Key="NonErrorTextBox" TargetType="TextBox">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextBoxForeground}" />
|
||||
<Setter Property="PlaceholderForeground" Value="{DynamicResource TextBoxPlaceholderForeground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource TextBoxDefaultBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxDefaultBorderBrush}" />
|
||||
<Setter Property="SelectionBrush" Value="{DynamicResource TextBoxSelectionBackground}" />
|
||||
@@ -300,7 +305,8 @@
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Opacity="0.5"
|
||||
Text="{TemplateBinding Watermark}"
|
||||
Foreground="{TemplateBinding PlaceholderForeground}"
|
||||
Text="{TemplateBinding PlaceholderText}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}"
|
||||
TextWrapping="{TemplateBinding TextWrapping}">
|
||||
<TextBlock.IsVisible>
|
||||
@@ -487,6 +493,7 @@
|
||||
|
||||
<ControlTheme x:Key="LooklessTextBox" TargetType="TextBox">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextBoxForeground}" />
|
||||
<Setter Property="PlaceholderForeground" Value="{DynamicResource TextBoxPlaceholderForeground}" />
|
||||
<Setter Property="SelectionBrush" Value="{DynamicResource TextBoxSelectionBackground}" />
|
||||
<Setter Property="SelectionForegroundBrush" Value="{DynamicResource TextBoxSelectionForeground}" />
|
||||
<Setter Property="CaretBrush" Value="{DynamicResource TextBoxTextCaretBrush}" />
|
||||
@@ -520,7 +527,8 @@
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Opacity="0.5"
|
||||
Text="{TemplateBinding Watermark}"
|
||||
Foreground="{TemplateBinding PlaceholderForeground}"
|
||||
Text="{TemplateBinding PlaceholderText}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}"
|
||||
TextWrapping="{TemplateBinding TextWrapping}">
|
||||
<TextBlock.IsVisible>
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="20">
|
||||
<StackPanel Margin="20">
|
||||
<TimePickerPresenter />
|
||||
</Border>
|
||||
<TimePicker UseSeconds="True" Width="500" />
|
||||
</StackPanel>
|
||||
</Design.PreviewWith>
|
||||
<ControlTheme x:Key="{x:Type TimePickerPresenter}" TargetType="TimePickerPresenter">
|
||||
<Setter Property="Width" Value="242" />
|
||||
@@ -163,6 +164,7 @@
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="MinHeight" Value="{DynamicResource DateTimePickerButtonDefaultHeight}" />
|
||||
<Setter Property="MinWidth" Value="242" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<DataValidationErrors>
|
||||
@@ -174,8 +176,8 @@
|
||||
Name="PART_FlyoutButton"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Width="242"
|
||||
MinWidth="242"
|
||||
MinWidth="{TemplateBinding MinWidth}"
|
||||
MaxWidth="{TemplateBinding MaxWidth}"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
|
||||
@@ -16,12 +16,14 @@
|
||||
<Border
|
||||
Name="PART_Background"
|
||||
Background="{TemplateBinding Background}"
|
||||
IsHitTestVisible="False" />
|
||||
IsHitTestVisible="False"
|
||||
Win32Properties.NonClientHitTestResult="Caption" />
|
||||
<CaptionButtons
|
||||
Name="PART_CaptionButtons"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{TemplateBinding Foreground}" />
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Win32Properties.NonClientHitTestResult="Client" />
|
||||
</Panel>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:Semi.Avalonia.Converters">
|
||||
xmlns:converters="using:Avalonia.Controls.Converters">
|
||||
|
||||
<Design.PreviewWith>
|
||||
<StackPanel
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<ResourceInclude Source="Expander.axaml" />
|
||||
<ResourceInclude Source="FlyoutPresenter.axaml" />
|
||||
<ResourceInclude Source="GridSplitter.axaml" />
|
||||
<ResourceInclude Source="GroupBox.axaml" />
|
||||
<ResourceInclude Source="HeaderedContentControl.axaml" />
|
||||
<ResourceInclude Source="HyperlinkButton.axaml" />
|
||||
<ResourceInclude Source="ItemsControl.axaml" />
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Avalonia;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Metadata;
|
||||
|
||||
namespace Semi.Avalonia.Converters;
|
||||
|
||||
public class KeyToPathConverter: IValueConverter
|
||||
{
|
||||
[Content]
|
||||
public IDictionary<string, object?> Resources { get; } = new Dictionary<string, object?>();
|
||||
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if(value is string s && Resources.TryGetValue(s, out var v))
|
||||
return v;
|
||||
return AvaloniaProperty.UnsetValue;
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -2,56 +2,36 @@ using System;
|
||||
using System.Globalization;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Data.Converters;
|
||||
using Irihi.Avalonia.Shared.Converters;
|
||||
|
||||
namespace Semi.Avalonia.Converters;
|
||||
|
||||
public class PlacementToRenderTransformOriginConverter: IValueConverter
|
||||
public class PlacementToRenderTransformOriginConverter : MarkupValueConverter
|
||||
{
|
||||
public static PlacementToRenderTransformOriginConverter Instance { get; } = new PlacementToRenderTransformOriginConverter();
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
public override object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is not PlacementMode p)
|
||||
{
|
||||
return new RelativePoint(0.5, 0.5, RelativeUnit.Relative);
|
||||
}
|
||||
switch (p)
|
||||
{
|
||||
case PlacementMode.Bottom:
|
||||
return new RelativePoint(0.5, 0.0, RelativeUnit.Relative);
|
||||
case PlacementMode.Left:
|
||||
return new RelativePoint(1.0, 0.5, RelativeUnit.Relative);
|
||||
case PlacementMode.Right:
|
||||
return new RelativePoint(0.0, 0.5, RelativeUnit.Relative);
|
||||
case PlacementMode.Top:
|
||||
return new RelativePoint(0.5, 1.0, RelativeUnit.Relative);
|
||||
case PlacementMode.Pointer:
|
||||
return new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
case PlacementMode.Center:
|
||||
case PlacementMode.AnchorAndGravity:
|
||||
return new RelativePoint(0.5, 0.5, RelativeUnit.Relative);
|
||||
case PlacementMode.BottomEdgeAlignedLeft:
|
||||
return new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
case PlacementMode.BottomEdgeAlignedRight:
|
||||
return new RelativePoint(1.0, 0.0, RelativeUnit.Relative);
|
||||
case PlacementMode.LeftEdgeAlignedTop:
|
||||
return new RelativePoint(1.0, 1.0, RelativeUnit.Relative);
|
||||
case PlacementMode.LeftEdgeAlignedBottom:
|
||||
return new RelativePoint(1.0, 0.0, RelativeUnit.Relative);
|
||||
case PlacementMode.RightEdgeAlignedTop:
|
||||
return new RelativePoint(0.0, 1.0, RelativeUnit.Relative);
|
||||
case PlacementMode.RightEdgeAlignedBottom:
|
||||
return new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
case PlacementMode.TopEdgeAlignedLeft:
|
||||
return new RelativePoint(0.0, 1.0, RelativeUnit.Relative);
|
||||
case PlacementMode.TopEdgeAlignedRight:
|
||||
return new RelativePoint(1.0, 1.0, RelativeUnit.Relative);
|
||||
}
|
||||
return new RelativePoint(0.5, 0.5, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return p switch
|
||||
{
|
||||
PlacementMode.Bottom => new RelativePoint(0.5, 0.0, RelativeUnit.Relative),
|
||||
PlacementMode.Left => new RelativePoint(1.0, 0.5, RelativeUnit.Relative),
|
||||
PlacementMode.Right => new RelativePoint(0.0, 0.5, RelativeUnit.Relative),
|
||||
PlacementMode.Top => new RelativePoint(0.5, 1.0, RelativeUnit.Relative),
|
||||
PlacementMode.Pointer => new RelativePoint(0.0, 0.0, RelativeUnit.Relative),
|
||||
PlacementMode.Center or PlacementMode.AnchorAndGravity => new RelativePoint(0.5, 0.5, RelativeUnit.Relative),
|
||||
PlacementMode.BottomEdgeAlignedLeft => new RelativePoint(0.0, 0.0, RelativeUnit.Relative),
|
||||
PlacementMode.BottomEdgeAlignedRight => new RelativePoint(1.0, 0.0, RelativeUnit.Relative),
|
||||
PlacementMode.LeftEdgeAlignedTop => new RelativePoint(1.0, 1.0, RelativeUnit.Relative),
|
||||
PlacementMode.LeftEdgeAlignedBottom => new RelativePoint(1.0, 0.0, RelativeUnit.Relative),
|
||||
PlacementMode.RightEdgeAlignedTop => new RelativePoint(0.0, 1.0, RelativeUnit.Relative),
|
||||
PlacementMode.RightEdgeAlignedBottom => new RelativePoint(0.0, 0.0, RelativeUnit.Relative),
|
||||
PlacementMode.TopEdgeAlignedLeft => new RelativePoint(0.0, 1.0, RelativeUnit.Relative),
|
||||
PlacementMode.TopEdgeAlignedRight => new RelativePoint(1.0, 1.0, RelativeUnit.Relative),
|
||||
_ => new RelativePoint(0.5, 0.5, RelativeUnit.Relative)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,18 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Avalonia.Data.Converters;
|
||||
using Irihi.Avalonia.Shared.Converters;
|
||||
|
||||
namespace Semi.Avalonia.Converters;
|
||||
|
||||
public class PositionToAngleConverter: IValueConverter
|
||||
public class PositionToAngleConverter : MarkupValueConverter
|
||||
{
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
public override object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is double d)
|
||||
{
|
||||
return d * 3.6;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return value is double d ? d * 3.6 : 0;
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
public override object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is double d)
|
||||
{
|
||||
return d / 3.6;
|
||||
}
|
||||
return 0;
|
||||
return value is double d ? d / 3.6 : 0;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Avalonia;
|
||||
using Avalonia.Data.Converters;
|
||||
|
||||
namespace Semi.Avalonia.Converters;
|
||||
|
||||
public class TreeViewItemIndentConverter : IMultiValueConverter
|
||||
{
|
||||
public static readonly TreeViewItemIndentConverter Instance = new();
|
||||
|
||||
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (values.Count > 1 && values[0] is int level && values[1] is double indent)
|
||||
{
|
||||
return new Thickness(indent * level, 0, 0, 0);
|
||||
}
|
||||
|
||||
return new Thickness(0);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Avalonia.Metadata;
|
||||
|
||||
[assembly:XmlnsPrefix("https://irihi.tech/semi", "semi")]
|
||||
[assembly:XmlnsDefinition("https://irihi.tech/semi", "Semi.Avalonia")]
|
||||
[assembly: XmlnsPrefix("https://irihi.tech/semi", "semi")]
|
||||
[assembly: XmlnsDefinition("https://irihi.tech/semi", "Semi.Avalonia")]
|
||||
[assembly: XmlnsDefinition("https://irihi.tech/semi", "Semi.Avalonia.Converters")]
|
||||
@@ -1,14 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
|
||||
<Version>11.3.7.2</Version>
|
||||
<PackageReleaseNotes>Update to Semi.Avalonia 11.3.7.2</PackageReleaseNotes>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Version>12.0.0-nightly-20260210000416</Version>
|
||||
<PackageReleaseNotes>Update to Semi.Avalonia 12.0.0-nightly-20260210000416</PackageReleaseNotes>
|
||||
<Title>Semi.Avalonia</Title>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia"/>
|
||||
<PackageReference Include="Irihi.Avalonia.Shared"/>
|
||||
<None Include="README.md" Pack="true" PackagePath="\"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<StaticResource x:Key="TextBoxPressedBackground" ResourceKey="SemiColorFill2" />
|
||||
<StaticResource x:Key="TextBoxFocusBorderBrush" ResourceKey="SemiColorPrimary" />
|
||||
<StaticResource x:Key="TextBoxForeground" ResourceKey="SemiColorText0" />
|
||||
<StaticResource x:Key="TextBoxPlaceholderForeground" ResourceKey="SemiColorText2" />
|
||||
<StaticResource x:Key="TextBoxInnerForeground" ResourceKey="SemiColorText2" />
|
||||
<StaticResource x:Key="TextBoxDisabledBackground" ResourceKey="SemiColorDisabledFill" />
|
||||
<StaticResource x:Key="TextBoxDisabledForeground" ResourceKey="SemiColorDisabledText" />
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<StaticResource x:Key="TextBoxPressedBackground" ResourceKey="SemiColorHighlightText" />
|
||||
<StaticResource x:Key="TextBoxFocusBorderBrush" ResourceKey="SemiColorHighlight" />
|
||||
<StaticResource x:Key="TextBoxForeground" ResourceKey="SemiColorWindowText" />
|
||||
<StaticResource x:Key="TextBoxPlaceholderForeground" ResourceKey="SemiColorWindowText" />
|
||||
<StaticResource x:Key="TextBoxInnerForeground" ResourceKey="SemiColorWindowText" />
|
||||
<StaticResource x:Key="TextBoxDisabledBackground" ResourceKey="SemiColorWindow" />
|
||||
<StaticResource x:Key="TextBoxDisabledForeground" ResourceKey="SemiColorGrayText" />
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<StaticResource x:Key="TextBoxPressedBackground" ResourceKey="SemiColorFill2" />
|
||||
<StaticResource x:Key="TextBoxFocusBorderBrush" ResourceKey="SemiColorPrimary" />
|
||||
<StaticResource x:Key="TextBoxForeground" ResourceKey="SemiColorText0" />
|
||||
<StaticResource x:Key="TextBoxPlaceholderForeground" ResourceKey="SemiColorText2" />
|
||||
<StaticResource x:Key="TextBoxInnerForeground" ResourceKey="SemiColorText2" />
|
||||
<StaticResource x:Key="TextBoxDisabledBackground" ResourceKey="SemiColorDisabledFill" />
|
||||
<StaticResource x:Key="TextBoxDisabledForeground" ResourceKey="SemiColorDisabledText" />
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
<StaticResource x:Key="TextBoxSmallHeight" ResourceKey="SemiHeightControlSmall" />
|
||||
<StaticResource x:Key="TextBoxLargeHeight" ResourceKey="SemiHeightControlLarge" />
|
||||
<StaticResource x:Key="TextBoxDefaultCornerRadius" ResourceKey="SemiBorderRadiusSmall" />
|
||||
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 8 0</Thickness>
|
||||
<Thickness x:Key="TextBoxInnerRightContentPadding">8 0 0 0</Thickness>
|
||||
<Thickness x:Key="TextBoxContentPadding">8 0</Thickness>
|
||||
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 12 0</Thickness>
|
||||
<Thickness x:Key="TextBoxInnerRightContentPadding">12 0 0 0</Thickness>
|
||||
<Thickness x:Key="TextBoxContentPadding">12 0</Thickness>
|
||||
<StaticResource x:Key="TextBoxBorderThickness" ResourceKey="SemiBorderThicknessControl" />
|
||||
<Thickness x:Key="TextBoxTextAreaContentPadding">12 5</Thickness>
|
||||
<x:Double x:Key="TextBoxTextAreaHeight">90</x:Double>
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
<FontWeight x:Key="SemiFontWeightRegular">400</FontWeight> <!-- 字重 - 常规 -->
|
||||
<FontWeight x:Key="SemiFontWeightBold">600</FontWeight> <!-- 字重 - 粗 -->
|
||||
<FontFamily x:Key="SemiFontFamilyRegular">
|
||||
Inter, -apple-system, BlinkMacSystemFont, PingFang SC,
|
||||
fonts:Inter#Inter, Inter, -apple-system, BlinkMacSystemFont, PingFang SC,
|
||||
Microsoft YaHei, Segoe UI, Hiragino Sans GB, Helvetica Neue,
|
||||
Helvetica, Arial, sans-serif
|
||||
</FontFamily>
|
||||
|
||||
Reference in New Issue
Block a user