diff --git a/samples/ControlCatalog/MainWindow.xaml b/samples/ControlCatalog/MainWindow.xaml index 7029273a84..80b239d0be 100644 --- a/samples/ControlCatalog/MainWindow.xaml +++ b/samples/ControlCatalog/MainWindow.xaml @@ -2,5 +2,10 @@ Title="Avalonia Control Gallery" Icon="resm:ControlCatalog.Assets.test_icon.ico?assembly=ControlCatalog" xmlns:local="clr-namespace:ControlCatalog"> + + + - \ No newline at end of file + diff --git a/samples/ControlCatalog/MainWindow.xaml.cs b/samples/ControlCatalog/MainWindow.xaml.cs index e620a77e52..0de248c5ba 100644 --- a/samples/ControlCatalog/MainWindow.xaml.cs +++ b/samples/ControlCatalog/MainWindow.xaml.cs @@ -13,6 +13,7 @@ namespace ControlCatalog this.AttachDevTools(); //Renderer.DrawFps = true; //Renderer.DrawDirtyRects = Renderer.DrawFps = true; + DataContext = this; } private void InitializeComponent() @@ -24,5 +25,14 @@ namespace ControlCatalog theme.TryGetResource("Button", out _); AvaloniaXamlLoader.Load(this); } + + private double _proportion; + + public double Proportion + { + get { return _proportion; } + set { _proportion = value; } + } + } } diff --git a/samples/ControlCatalog/MyControl.cs b/samples/ControlCatalog/MyControl.cs new file mode 100644 index 0000000000..1ea59560c9 --- /dev/null +++ b/samples/ControlCatalog/MyControl.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Avalonia; +using Avalonia.Controls; + +namespace ControlCatalog +{ + public class MyControl : Control + { + public static readonly AttachedProperty ProportionProperty = + AvaloniaProperty.RegisterAttached("Proportion", double.NaN); + + /// + /// Gets the value of the Proportion attached property on the specified control. + /// + /// The control. + /// The Proportion attached property. + public static double GetProportion(IControl control) + { + return control.GetValue(ProportionProperty); + } + + /// + /// Sets the value of the Proportion attached property on the specified control. + /// + /// The control. + /// The value of the Dock property. + public static void SetProportion(IControl control, double value) + { + control.SetValue(ProportionProperty, value); + } + } +}