diff --git a/samples/ControlCatalog/ControlCatalog.csproj b/samples/ControlCatalog/ControlCatalog.csproj index cff0bb4e92..7bbff55907 100644 --- a/samples/ControlCatalog/ControlCatalog.csproj +++ b/samples/ControlCatalog/ControlCatalog.csproj @@ -9,9 +9,9 @@ %(Filename) - + Designer - + diff --git a/samples/ControlCatalog/DecoratedWindow.xaml.cs b/samples/ControlCatalog/DecoratedWindow.xaml.cs index eccfaca60f..bb87d982ba 100644 --- a/samples/ControlCatalog/DecoratedWindow.xaml.cs +++ b/samples/ControlCatalog/DecoratedWindow.xaml.cs @@ -1,53 +1,45 @@ -using Avalonia; using Avalonia.Controls; -using Avalonia.Markup.Xaml; -using System; using Avalonia.Input; namespace ControlCatalog { - public class DecoratedWindow : Window + public partial class DecoratedWindow : Window { public DecoratedWindow() { - this.InitializeComponent(); - } - - void SetupSide(string name, StandardCursorType cursor, WindowEdge edge) - { - var ctl = this.Get(name); - ctl.Cursor = new Cursor(cursor); - ctl.PointerPressed += (i, e) => - { - if (WindowState == WindowState.Normal) - BeginResizeDrag(edge, e); - }; - } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - this.Get("TitleBar").PointerPressed += (i, e) => + InitializeComponent(); + TitleBar.PointerPressed += (i, e) => { BeginMoveDrag(e); }; - SetupSide("Left", StandardCursorType.LeftSide, WindowEdge.West); - SetupSide("Right", StandardCursorType.RightSide, WindowEdge.East); - SetupSide("Top", StandardCursorType.TopSide, WindowEdge.North); - SetupSide("Bottom", StandardCursorType.BottomSide, WindowEdge.South); - SetupSide("TopLeft", StandardCursorType.TopLeftCorner, WindowEdge.NorthWest); - SetupSide("TopRight", StandardCursorType.TopRightCorner, WindowEdge.NorthEast); - SetupSide("BottomLeft", StandardCursorType.BottomLeftCorner, WindowEdge.SouthWest); - SetupSide("BottomRight", StandardCursorType.BottomRightCorner, WindowEdge.SouthEast); - this.Get - - - "; - var mfxt = this.Get("MenuFlyoutXamlText"); + var mfxt = this.MenuFlyoutXamlText; mfxt.Text = ""; - var afxt = this.Get("AttachedFlyoutXamlText"); + var afxt = this.AttachedFlyoutXamlText; afxt.Text = "\n" + " \n" + " \n" + @@ -63,7 +59,7 @@ namespace ControlCatalog.Pages "\n\n In DoubleTapped handler:\n" + "FlyoutBase.ShowAttachedFlyout(AttachedFlyoutPanel);"; - var sfxt = this.Get("SharedFlyoutXamlText"); + var sfxt = this.SharedFlyoutXamlText; sfxt.Text = "Declare a flyout in Resources:\n" + "\n" + " \n" + diff --git a/samples/ControlCatalog/Pages/GesturePage.cs b/samples/ControlCatalog/Pages/GesturePage.cs index 9164384eae..c480b512b4 100644 --- a/samples/ControlCatalog/Pages/GesturePage.cs +++ b/samples/ControlCatalog/Pages/GesturePage.cs @@ -1,75 +1,61 @@ using System; -using System.Numerics; using Avalonia; using Avalonia.Controls; using Avalonia.Input; using Avalonia.LogicalTree; -using Avalonia.Markup.Xaml; using Avalonia.Rendering.Composition; using Avalonia.Utilities; namespace ControlCatalog.Pages { - public class GesturePage : UserControl + public partial class GesturePage : UserControl { private bool _isInit; private double _currentScale; public GesturePage() { - this.InitializeComponent(); - } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); + InitializeComponent(); } protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) { base.OnAttachedToVisualTree(e); - if(_isInit) + if (_isInit) { return; } _isInit = true; - SetPullHandlers(this.Find("TopPullZone"), false); - SetPullHandlers(this.Find("BottomPullZone"), true); - SetPullHandlers(this.Find("RightPullZone"), true); - SetPullHandlers(this.Find("LeftPullZone"), false); + SetPullHandlers(TopPullZone, false); + SetPullHandlers(BottomPullZone, true); + SetPullHandlers(RightPullZone, true); + SetPullHandlers(LeftPullZone, false); - var image = this.Get("PinchImage"); + var image = PinchImage; SetPinchHandlers(image); - var reset = this.Get