-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
164 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
src/Avalonia/HandyControlDemo_Avalonia/Resources/Themes/Basic/Basic.axaml
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
src/Avalonia/HandyControlDemo_Avalonia/Resources/Themes/Basic/Converters.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
2 changes: 1 addition & 1 deletion
2
...ia/Resources/Themes/Basic/Geometries.xaml → ...a/Resources/Themes/Basic/Geometries.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/Avalonia/HandyControlDemo_Avalonia/Tools/Converter/StringRepeatConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/Avalonia/HandyControlDemo_Avalonia/UserControl/Styles/LabelDemo.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
9 changes: 9 additions & 0 deletions
9
src/Avalonia/HandyControlDemo_Avalonia/UserControl/Styles/LabelDemo.axaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace HandyControlDemo.UserControl; | ||
|
||
public partial class LabelDemo : Avalonia.Controls.UserControl | ||
{ | ||
public LabelDemo() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters