From 1223fb1ef579013ba0594062b51635a35b3aee8c Mon Sep 17 00:00:00 2001 From: robloo Date: Mon, 1 Mar 2021 23:42:11 -0500 Subject: [PATCH 01/22] Rename 'Expanding' to 'Expanded' --- dev/Expander/Expander.cpp | 6 +++--- dev/Expander/Expander.h | 2 +- dev/Expander/Expander.idl | 4 ++-- dev/Generated/Expander.properties.cpp | 10 +++++----- dev/Generated/Expander.properties.h | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dev/Expander/Expander.cpp b/dev/Expander/Expander.cpp index a2f22bf3cd..1546aeb7db 100644 --- a/dev/Expander/Expander.cpp +++ b/dev/Expander/Expander.cpp @@ -91,9 +91,9 @@ void Expander::OnContentSizeChanged(const winrt::IInspectable&, const winrt::Siz } -void Expander::RaiseExpandingEvent(const winrt::Expander& container) +void Expander::RaiseExpandedEvent(const winrt::Expander& container) { - m_expandingEventSource(*this, nullptr); + m_expandedEventSource(*this, nullptr); } void Expander::RaiseCollapsedEvent(const winrt::Expander& container) @@ -105,7 +105,7 @@ void Expander::OnIsExpandedPropertyChanged(const winrt::DependencyPropertyChange { if (IsExpanded()) { - RaiseExpandingEvent(*this); + RaiseExpandedEvent(*this); } else { diff --git a/dev/Expander/Expander.h b/dev/Expander/Expander.h index 01879908c4..efc374f2af 100644 --- a/dev/Expander/Expander.h +++ b/dev/Expander/Expander.h @@ -26,7 +26,7 @@ class Expander : void OnApplyTemplate(); - void RaiseExpandingEvent(const winrt::Expander& container); + void RaiseExpandedEvent(const winrt::Expander& container); void RaiseCollapsedEvent(const winrt::Expander& container); void OnIsExpandedPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args); diff --git a/dev/Expander/Expander.idl b/dev/Expander/Expander.idl index 04744fbbec..c1b57e6a97 100644 --- a/dev/Expander/Expander.idl +++ b/dev/Expander/Expander.idl @@ -27,7 +27,7 @@ unsealed runtimeclass Expander : Windows.UI.Xaml.Controls.ContentControl [MUX_PROPERTY_CHANGED_CALLBACK(TRUE)] ExpandDirection ExpandDirection{ get; set; }; - event Windows.Foundation.TypedEventHandler Expanding; + event Windows.Foundation.TypedEventHandler Expanded; event Windows.Foundation.TypedEventHandler Collapsed; [MUX_PROPERTY_NEEDS_DP_FIELD] @@ -52,7 +52,7 @@ enum ExpandDirection [MUX_PUBLIC] [default_interface] [webhosthidden] -runtimeclass ExpanderExpandingEventArgs +runtimeclass ExpanderExpandedEventArgs { } diff --git a/dev/Generated/Expander.properties.cpp b/dev/Generated/Expander.properties.cpp index db76982530..4ad32a5b4c 100644 --- a/dev/Generated/Expander.properties.cpp +++ b/dev/Generated/Expander.properties.cpp @@ -22,7 +22,7 @@ GlobalDependencyProperty ExpanderProperties::s_TemplateSettingsProperty{ nullptr ExpanderProperties::ExpanderProperties() : m_collapsedEventSource{static_cast(this)} - , m_expandingEventSource{static_cast(this)} + , m_expandedEventSource{static_cast(this)} { EnsureProperties(); } @@ -211,12 +211,12 @@ void ExpanderProperties::Collapsed(winrt::event_token const& token) m_collapsedEventSource.remove(token); } -winrt::event_token ExpanderProperties::Expanding(winrt::TypedEventHandler const& value) +winrt::event_token ExpanderProperties::Expanded(winrt::TypedEventHandler const& value) { - return m_expandingEventSource.add(value); + return m_expandedEventSource.add(value); } -void ExpanderProperties::Expanding(winrt::event_token const& token) +void ExpanderProperties::Expanded(winrt::event_token const& token) { - m_expandingEventSource.remove(token); + m_expandedEventSource.remove(token); } diff --git a/dev/Generated/Expander.properties.h b/dev/Generated/Expander.properties.h index 70534be0e3..b28adb4e5f 100644 --- a/dev/Generated/Expander.properties.h +++ b/dev/Generated/Expander.properties.h @@ -43,11 +43,11 @@ class ExpanderProperties winrt::event_token Collapsed(winrt::TypedEventHandler const& value); void Collapsed(winrt::event_token const& token); - winrt::event_token Expanding(winrt::TypedEventHandler const& value); - void Expanding(winrt::event_token const& token); + winrt::event_token Expanded(winrt::TypedEventHandler const& value); + void Expanded(winrt::event_token const& token); event_source> m_collapsedEventSource; - event_source> m_expandingEventSource; + event_source> m_expandedEventSource; static void EnsureProperties(); static void ClearProperties(); From 363c732069c5c2f050a2a7a58c59671e0611b12d Mon Sep 17 00:00:00 2001 From: robloo Date: Mon, 1 Mar 2021 23:42:32 -0500 Subject: [PATCH 02/22] Ensure Expanded/Collapsed fire after state is applied --- dev/Expander/Expander.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/Expander/Expander.cpp b/dev/Expander/Expander.cpp index 1546aeb7db..2facc11aad 100644 --- a/dev/Expander/Expander.cpp +++ b/dev/Expander/Expander.cpp @@ -103,6 +103,8 @@ void Expander::RaiseCollapsedEvent(const winrt::Expander& container) void Expander::OnIsExpandedPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& /*args*/) { + UpdateExpandState(true); + if (IsExpanded()) { RaiseExpandedEvent(*this); @@ -111,7 +113,6 @@ void Expander::OnIsExpandedPropertyChanged(const winrt::DependencyPropertyChange { RaiseCollapsedEvent(*this); } - UpdateExpandState(true); } void Expander::OnExpandDirectionPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& /*args*/) From 17c6d857bb5c89e8b00df88619848b34d9ec1481 Mon Sep 17 00:00:00 2001 From: robloo Date: Tue, 2 Mar 2021 00:26:07 -0500 Subject: [PATCH 03/22] Remove MaxWidth set in the default style --- dev/Expander/Expander.xaml | 9 ++++----- dev/Expander/TestUI/ExpanderPage.xaml | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/dev/Expander/Expander.xaml b/dev/Expander/Expander.xaml index 6d52bf384c..50bc6700c7 100644 --- a/dev/Expander/Expander.xaml +++ b/dev/Expander/Expander.xaml @@ -23,14 +23,13 @@ - - - - + + + @@ -147,7 +146,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -73,7 +73,16 @@ + + + + This expander stretches along with its content + + + Content + + - + From 1f80b685225517a0a8ca6096b8f177875b165fcf Mon Sep 17 00:00:00 2001 From: robloo Date: Tue, 2 Mar 2021 00:40:03 -0500 Subject: [PATCH 04/22] Make the expander properly size to content The header and content container elements should always be stretched to give child controls maximum available area. --- dev/Expander/Expander.xaml | 4 +++- dev/Expander/TestUI/ExpanderPage.xaml | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dev/Expander/Expander.xaml b/dev/Expander/Expander.xaml index 50bc6700c7..2e605d2e6d 100644 --- a/dev/Expander/Expander.xaml +++ b/dev/Expander/Expander.xaml @@ -141,7 +141,7 @@ Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" - HorizontalAlignment="{TemplateBinding HorizontalAlignment}" + HorizontalAlignment="Stretch" IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" /> @@ -156,6 +156,8 @@ MinHeight="{TemplateBinding MinHeight}" MinWidth="{TemplateBinding MinWidth}" MaxWidth="{TemplateBinding MaxWidth}" + HorizontalAlignment="Stretch" + VerticalAlignment="Stretch" Padding="{StaticResource ExpanderContentPadding}"> Content - + This is a toggle button in the header - Content. This is long content to test wrapping on the content section, this content should be wrapping. + Content. This is long content to test wrapping on the content section, this content should be wrapping after the control expands to max width. From 66bf68f22a665b1236e606ba6f62c28d8d13a198 Mon Sep 17 00:00:00 2001 From: robloo Date: Tue, 2 Mar 2021 14:52:08 -0500 Subject: [PATCH 05/22] Remove Stretch content alignment (use Center default) This aligns with the default Button style --- dev/Expander/Expander.xaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/dev/Expander/Expander.xaml b/dev/Expander/Expander.xaml index 2e605d2e6d..d76ab0eb06 100644 --- a/dev/Expander/Expander.xaml +++ b/dev/Expander/Expander.xaml @@ -28,8 +28,6 @@ - - From 0ad7bc5ddcaac645480aa70450b0dfa61060a633 Mon Sep 17 00:00:00 2001 From: robloo Date: Tue, 2 Mar 2021 14:52:24 -0500 Subject: [PATCH 06/22] Add Center VerticalAlignment This aligns with the default Button style --- dev/Expander/Expander.xaml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/Expander/Expander.xaml b/dev/Expander/Expander.xaml index d76ab0eb06..420d2e12d8 100644 --- a/dev/Expander/Expander.xaml +++ b/dev/Expander/Expander.xaml @@ -28,6 +28,7 @@ + From ee209e1e311bb13d55e293eb06d2f9976bc72a18 Mon Sep 17 00:00:00 2001 From: robloo Date: Tue, 2 Mar 2021 15:01:13 -0500 Subject: [PATCH 07/22] Remove Min/MaxWidth from intermediate controls These should follow the layout root (parent grid) sizing. --- dev/Expander/Expander.xaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dev/Expander/Expander.xaml b/dev/Expander/Expander.xaml index 420d2e12d8..cc87459277 100644 --- a/dev/Expander/Expander.xaml +++ b/dev/Expander/Expander.xaml @@ -131,8 +131,6 @@ BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" MinHeight="{TemplateBinding MinHeight}" - MinWidth="{TemplateBinding MinWidth}" - MaxWidth="{TemplateBinding MaxWidth}" contract7Present:CornerRadius="{TemplateBinding CornerRadius}" IsEnabled="{TemplateBinding IsEnabled}" Padding="{TemplateBinding Padding}" @@ -153,8 +151,6 @@ BorderBrush="{ThemeResource ExpanderDropDownBorderBrush}" BorderThickness="{StaticResource ExpanderDropdownDownBorderThickness}" MinHeight="{TemplateBinding MinHeight}" - MinWidth="{TemplateBinding MinWidth}" - MaxWidth="{TemplateBinding MaxWidth}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Padding="{StaticResource ExpanderContentPadding}"> From 0c58a25795740848a7cda7f0ac3bc6d828a227b8 Mon Sep 17 00:00:00 2001 From: robloo Date: Tue, 2 Mar 2021 15:04:07 -0500 Subject: [PATCH 08/22] Update Expander test page --- dev/Expander/TestUI/ExpanderPage.xaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/Expander/TestUI/ExpanderPage.xaml b/dev/Expander/TestUI/ExpanderPage.xaml index 3d89b58e65..d6b00b674a 100644 --- a/dev/Expander/TestUI/ExpanderPage.xaml +++ b/dev/Expander/TestUI/ExpanderPage.xaml @@ -29,7 +29,7 @@ - + @@ -74,12 +74,12 @@ - + This expander stretches along with its content - Content + Right Content From 25e8c59acb8fe3089cae3a09dae18fbb3cc0f148 Mon Sep 17 00:00:00 2001 From: robloo Date: Tue, 2 Mar 2021 16:10:12 -0500 Subject: [PATCH 09/22] Add fixed-height Expander example --- dev/Expander/TestUI/ExpanderPage.xaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dev/Expander/TestUI/ExpanderPage.xaml b/dev/Expander/TestUI/ExpanderPage.xaml index d6b00b674a..ed6383d731 100644 --- a/dev/Expander/TestUI/ExpanderPage.xaml +++ b/dev/Expander/TestUI/ExpanderPage.xaml @@ -82,6 +82,16 @@ Right Content + + + + This expander sets a fixed height + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec id lacinia tellus. Integer eu mollis leo, ornare ultricies neque. Sed diam lectus, varius sed justo vel, malesuada condimentum lorem. Proin porttitor quis enim a facilisis. Suspendisse vehicula imperdiet egestas. Suspendisse imperdiet, ipsum in commodo cursus, mi nisl volutpat nulla, in interdum mi nulla a nulla. Cras feugiat odio ac eros ullamcorper suscipit. Praesent ultricies ligula eget efficitur tristique. Donec imperdiet ultrices dolor sollicitudin bibendum. In hac habitasse platea dictumst. Fusce vel lacinia purus. Sed tempor est sed suscipit luctus. Aenean laoreet tellus vitae efficitur scelerisque. Sed suscipit risus ac nisl rhoncus hendrerit. + + + From 585b15cde724efc309a3ed6e2852fb49584af97a Mon Sep 17 00:00:00 2001 From: robloo Date: Tue, 2 Mar 2021 18:43:13 -0500 Subject: [PATCH 10/22] Stretch header content --- dev/Expander/Expander.xaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/Expander/Expander.xaml b/dev/Expander/Expander.xaml index cc87459277..392d77e2bc 100644 --- a/dev/Expander/Expander.xaml +++ b/dev/Expander/Expander.xaml @@ -135,10 +135,12 @@ IsEnabled="{TemplateBinding IsEnabled}" Padding="{TemplateBinding Padding}" Style="{StaticResource ExpanderHeaderDownStyle}" + HorizontalAlignment="Stretch" + HorizontalContentAlignment="Stretch" + VerticalContentAlignment="Stretch" Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" - HorizontalAlignment="Stretch" IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" /> From 21c73eb44f53cdfbc8f21bf031af4ee3bf723a99 Mon Sep 17 00:00:00 2001 From: robloo Date: Tue, 2 Mar 2021 18:48:35 -0500 Subject: [PATCH 11/22] Standardize resource names --- dev/Expander/Expander.xaml | 8 ++++---- dev/Expander/Expander_themeresources.xaml | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dev/Expander/Expander.xaml b/dev/Expander/Expander.xaml index 392d77e2bc..e7ab00faff 100644 --- a/dev/Expander/Expander.xaml +++ b/dev/Expander/Expander.xaml @@ -108,7 +108,7 @@ - + @@ -147,11 +147,11 @@ - - + + @@ -42,8 +42,8 @@ - - + + @@ -67,8 +67,8 @@ - - + + @@ -92,8 +92,8 @@ 48 16 16,0,0,0 - 1,0,1,1 - 1,1,1,0 + 1,0,1,1 + 1,1,1,0