diff --git a/samples/ControlCatalog/Converter/FlexDemoNumberToThicknessConverter.cs b/samples/ControlCatalog/Converter/FlexDemoNumberToThicknessConverter.cs new file mode 100644 index 0000000000..c5c3e0e2ed --- /dev/null +++ b/samples/ControlCatalog/Converter/FlexDemoNumberToThicknessConverter.cs @@ -0,0 +1,24 @@ +using System; +using System.Globalization; +using Avalonia; +using Avalonia.Data.Converters; + +namespace ControlCatalog.Converter +{ + internal sealed class FlexDemoNumberToThicknessConverter : IValueConverter + { + public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + { + if (value is int x && targetType.IsAssignableFrom(typeof(Thickness))) + { + var y = 16 + 2 * ((x * 5) % 9); + return new Thickness(2 * y, y); + } + + throw new NotSupportedException(); + } + + public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => + throw new NotSupportedException(); + } +} diff --git a/samples/ControlCatalog/MainView.xaml b/samples/ControlCatalog/MainView.xaml index adea1b90fc..ca7f4ba303 100644 --- a/samples/ControlCatalog/MainView.xaml +++ b/samples/ControlCatalog/MainView.xaml @@ -128,6 +128,9 @@ + + + diff --git a/samples/ControlCatalog/Pages/FlexPage.axaml b/samples/ControlCatalog/Pages/FlexPage.axaml new file mode 100644 index 0000000000..0da7a86c9e --- /dev/null +++ b/samples/ControlCatalog/Pages/FlexPage.axaml @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +