diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Layout/ExpanderPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/Layout/ExpanderPage.xaml index d35402431..d5c0547b0 100644 --- a/src/Wpf.Ui.Gallery/Views/Pages/Layout/ExpanderPage.xaml +++ b/src/Wpf.Ui.Gallery/Views/Pages/Layout/ExpanderPage.xaml @@ -18,19 +18,36 @@ + HeaderText="An Expander with text in the header and content areas"> + - + + + + + + + + + diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Layout/ExpanderPage.xaml.cs b/src/Wpf.Ui.Gallery/Views/Pages/Layout/ExpanderPage.xaml.cs index 5dbf69feb..478d13620 100644 --- a/src/Wpf.Ui.Gallery/Views/Pages/Layout/ExpanderPage.xaml.cs +++ b/src/Wpf.Ui.Gallery/Views/Pages/Layout/ExpanderPage.xaml.cs @@ -1,9 +1,11 @@ -// This Source Code Form is subject to the terms of the MIT License. +// This Source Code Form is subject to the terms of the MIT License. // If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT. // Copyright (C) Leszek Pomianowski and WPF UI Contributors. // All Rights Reserved. +using System.Windows.Controls; using Wpf.Ui.Controls; +using Wpf.Ui.Gallery.Controls; using Wpf.Ui.Gallery.ControlsLookup; using Wpf.Ui.Gallery.ViewModels.Pages.Layout; @@ -19,4 +21,55 @@ public ExpanderPage(ExpanderViewModel viewModel) } public ExpanderViewModel ViewModel { get; } + + private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + var comboBox = (ComboBox)sender; + string selectedText = (string)((ComboBoxItem)comboBox.SelectedValue).Content; + ExpandDirection direction = Enum.Parse(selectedText); + + Expander1.SetCurrentValue(Expander.ExpandDirectionProperty, direction); + + switch (direction) + { + case ExpandDirection.Down: + Expander1.SetCurrentValue(HorizontalAlignmentProperty, HorizontalAlignment.Left); + Expander1.SetCurrentValue(VerticalAlignmentProperty, VerticalAlignment.Top); + + ControlExample1.SetCurrentValue(ControlExample.XamlCodeProperty, """ + + """); + + break; + case ExpandDirection.Up: + Expander1.SetCurrentValue(HorizontalAlignmentProperty, HorizontalAlignment.Left); + Expander1.SetCurrentValue(VerticalAlignmentProperty, VerticalAlignment.Bottom); + + ControlExample1.SetCurrentValue(ControlExample.XamlCodeProperty, """ + + """); + + break; + case ExpandDirection.Left: + Expander1.SetCurrentValue(HorizontalAlignmentProperty, HorizontalAlignment.Right); + Expander1.SetCurrentValue(VerticalAlignmentProperty, VerticalAlignment.Top); + + ControlExample1.SetCurrentValue(ControlExample.XamlCodeProperty, """ + + """); + + break; + case ExpandDirection.Right: + Expander1.SetCurrentValue(HorizontalAlignmentProperty, HorizontalAlignment.Left); + Expander1.SetCurrentValue(VerticalAlignmentProperty, VerticalAlignment.Top); + + ControlExample1.SetCurrentValue(ControlExample.XamlCodeProperty, """ + + """); + + break; + default: + break; + } + } } diff --git a/src/Wpf.Ui/Controls/Expander/Expander.xaml b/src/Wpf.Ui/Controls/Expander/Expander.xaml index f7d41e0ab..fb79a5eb1 100644 --- a/src/Wpf.Ui/Controls/Expander/Expander.xaml +++ b/src/Wpf.Ui/Controls/Expander/Expander.xaml @@ -11,17 +11,55 @@ + xmlns:system="clr-namespace:System;assembly=System.Runtime"> 11,11,11,11 1 16.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -29,6 +67,7 @@ @@ -47,10 +86,36 @@ x:Name="ControlChevronIcon" FontSize="{StaticResource ExpanderChevronSize}" Foreground="{TemplateBinding Foreground}" - Symbol="ChevronDown24" /> + RenderTransformOrigin="0.5, 0.5" + Symbol="ChevronDown24"> + + + + + + + + + + + + + + + + + + + + + + + + + @@ -100,20 +165,11 @@ - - - - - - - - - + - + - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +