chore: add avalonia Label demo.
This commit is contained in:
1 parent
528f3eaf95
commit
c78e8545b8
9 files changed
+164
-22
No files matched your search
@@ -11,12 +11,16 @@
|
||||
<AssemblyName>HandyControlDemo</AssemblyName>
|
||||
<RootNamespace>HandyControlDemo</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Data\DemoInfo.json" />
|
||||
<None Remove="Resources\Img\cloud.png" />
|
||||
<None Remove="Resources\Img\icon.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Data\DemoInfo.json" />
|
||||
<AvaloniaResource Include="Resources\Img\cloud.png" />
|
||||
<AvaloniaResource Include="Resources\Img\icon.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -31,14 +35,6 @@
|
||||
<ProjectReference Include="..\HandyControl_Avalonia\HandyControl_Avalonia.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Resources\Img\cloud.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Data\DemoInfo.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Lang.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
@@ -53,9 +49,4 @@
|
||||
<LastGenOutput>Lang.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Resources\Themes\Basic\Geometries.xaml" />
|
||||
<AvaloniaXaml Include="Resources\Themes\Basic\Geometries.xaml" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,7 +0,0 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<MergeResourceInclude Source="Brushes.axaml" />
|
||||
<MergeResourceInclude Source="Geometries.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,5 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converter="clr-namespace:HandyControlDemo.Tools.Converter">
|
||||
<converter:StringRepeatConverter x:Key="StringRepeatConverter" />
|
||||
</ResourceDictionary>
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Geometry x:Key="NewGeometry">M512 0h1216a512 512 0 1 1 0 1024H512A512 512 0 1 1 512 0zM420.16 311.04V768h74.88V433.92h2.56l228.48 334.08h72.96V311.04h-75.52v329.6h-2.56l-225.92-329.6h-74.88z m468.48 0V768h340.48v-64h-265.6V565.76h239.36v-64h-239.36V375.04h254.72v-64h-329.6z m369.28 0l131.2 456.96h80l89.6-343.68h2.56l88.96 343.68h79.36l131.84-456.96h-84.48l-85.76 347.52h-2.56l-90.24-347.52h-77.44l-90.24 347.52h-2.56l-85.76-347.52h-84.48z</Geometry>
|
||||
@@ -3,7 +3,9 @@
|
||||
<Styles.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<MergeResourceInclude Source="Basic/Basic.axaml" />
|
||||
<MergeResourceInclude Source="/Resources/Themes/Basic/Brushes.axaml" />
|
||||
<MergeResourceInclude Source="/Resources/Themes/Basic/Geometries.axaml" />
|
||||
<MergeResourceInclude Source="/Resources/Themes/Basic/Converters.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Styles.Resources>
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using Avalonia.Data.Converters;
|
||||
|
||||
namespace HandyControlDemo.Tools.Converter;
|
||||
|
||||
public class StringRepeatConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is not string strValue)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var builder = new StringBuilder();
|
||||
int num;
|
||||
|
||||
switch (parameter)
|
||||
{
|
||||
case string numStr:
|
||||
{
|
||||
if (!int.TryParse(numStr, out num))
|
||||
{
|
||||
return strValue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case int intValue:
|
||||
num = intValue;
|
||||
break;
|
||||
default:
|
||||
return strValue;
|
||||
}
|
||||
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
builder.Append(strValue);
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
x:Class="HandyControlDemo.UserControl.LabelDemo">
|
||||
<hc:UniformSpacingPanel Margin="32"
|
||||
Spacing="32"
|
||||
ChildWrapping="Wrap">
|
||||
<hc:UniformSpacingPanel Spacing="5"
|
||||
Orientation="Vertical">
|
||||
<Label Content="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle" />
|
||||
<Label Content="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle"
|
||||
Theme="{StaticResource LabelDanger}" />
|
||||
<Label Content="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle"
|
||||
Theme="{StaticResource LabelInfo}" />
|
||||
<Label Content="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle"
|
||||
Theme="{StaticResource LabelPrimary}" />
|
||||
<Label Content="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle"
|
||||
Theme="{StaticResource LabelSuccess}" />
|
||||
<Label Content="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle"
|
||||
Theme="{StaticResource LabelWarning}" />
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="5"
|
||||
Orientation="Vertical">
|
||||
<Label Content="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle"
|
||||
Theme="{StaticResource LabelDefault.Small}" />
|
||||
<Label Content="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle"
|
||||
Theme="{StaticResource LabelDanger.Small}" />
|
||||
<Label Content="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle"
|
||||
Theme="{StaticResource LabelInfo.Small}" />
|
||||
<Label Content="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle"
|
||||
Theme="{StaticResource LabelPrimary.Small}" />
|
||||
<Label Content="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle"
|
||||
Theme="{StaticResource LabelSuccess.Small}" />
|
||||
<Label Content="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle"
|
||||
Theme="{StaticResource LabelWarning.Small}" />
|
||||
</hc:UniformSpacingPanel>
|
||||
</hc:UniformSpacingPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace HandyControlDemo.UserControl;
|
||||
|
||||
public partial class LabelDemo : Avalonia.Controls.UserControl
|
||||
{
|
||||
public LabelDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user