From 859793b12241d17314006663af8ebd395fcb7bf6 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sun, 30 Jan 2022 18:46:45 -0500 Subject: [PATCH] Merge pull request #7475 from wieslawsoltes/ViewboxPageXamlOnly [ControlCatalog] Set ComboBox items from xaml on ViewboxPage --- samples/ControlCatalog/Pages/ViewboxPage.xaml | 22 +++++++++++++++---- .../ControlCatalog/Pages/ViewboxPage.xaml.cs | 19 ---------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/samples/ControlCatalog/Pages/ViewboxPage.xaml b/samples/ControlCatalog/Pages/ViewboxPage.xaml index 81e5046636..e7e3007d35 100644 --- a/samples/ControlCatalog/Pages/ViewboxPage.xaml +++ b/samples/ControlCatalog/Pages/ViewboxPage.xaml @@ -1,5 +1,6 @@ @@ -12,8 +13,8 @@ + Stretch="{Binding #StretchSelector.SelectedItem, FallbackValue={x:Static Stretch.Uniform}}" + StretchDirection="{Binding #StretchDirectionSelector.SelectedItem, FallbackValue={x:Static StretchDirection.Both}}"> @@ -25,9 +26,22 @@ - + + + Uniform + UniformToFill + Fill + None + + - + + + Both + DownOnly + UpOnly + + diff --git a/samples/ControlCatalog/Pages/ViewboxPage.xaml.cs b/samples/ControlCatalog/Pages/ViewboxPage.xaml.cs index 94b3f3ea14..12b5086e12 100644 --- a/samples/ControlCatalog/Pages/ViewboxPage.xaml.cs +++ b/samples/ControlCatalog/Pages/ViewboxPage.xaml.cs @@ -1,6 +1,5 @@ using Avalonia.Controls; using Avalonia.Markup.Xaml; -using Avalonia.Media; namespace ControlCatalog.Pages { @@ -9,24 +8,6 @@ namespace ControlCatalog.Pages public ViewboxPage() { InitializeComponent(); - - var stretchSelector = this.FindControl("StretchSelector"); - - stretchSelector.Items = new[] - { - Stretch.Uniform, Stretch.UniformToFill, Stretch.Fill, Stretch.None - }; - - stretchSelector.SelectedIndex = 0; - - var stretchDirectionSelector = this.FindControl("StretchDirectionSelector"); - - stretchDirectionSelector.Items = new[] - { - StretchDirection.Both, StretchDirection.DownOnly, StretchDirection.UpOnly - }; - - stretchDirectionSelector.SelectedIndex = 0; } private void InitializeComponent()