Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/expander #3492

Merged
merged 51 commits into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
12e49c6
Add a stub Expander project
alexhinz Oct 5, 2020
157fdeb
Add in inner loop props for Expander
alexhinz Oct 5, 2020
c9aa3a7
Add IsExpanded property
alexhinz Oct 6, 2020
1c3f5dc
Add initial properties of the expander control.
edsernams Oct 6, 2020
e6c22e1
Add Expanded and Collapsed events to the Expander.
edsernams Oct 6, 2020
7c9784a
Add ExpanderAutomationPeer.
edsernams Oct 7, 2020
6b58141
Add initial xaml of the expander and appropiate test on TestUI.
edsernams Oct 8, 2020
6f9e241
Make Expander inherit from ContentControl instead of Control.
edsernams Oct 9, 2020
fa0703f
Make Expander keyboard focusable and expandable/collapsable via space…
edsernams Oct 12, 2020
dfd874d
Add ExpandDirection stubs to Expander.cpp and make parent expanders n…
edsernams Oct 12, 2020
d40b5de
Raise expanding and collapsed events and make expanders automation pr…
edsernams Oct 13, 2020
84a55b2
Basic partial support for up/down/left/right
alexhinz Oct 14, 2020
319359a
Ensure expansion doesn't animate upon first transition
alexhinz Oct 15, 2020
bbe4eec
Apply Horizontal/VerticalContentAlignment to content
alexhinz Oct 15, 2020
d59ab8b
Add basic Expand/Collapse interaction tests.
edsernams Oct 16, 2020
d00cb30
Add RaiseExpandCollapseAutomationEvent to ExpanderAutomationPeer::Exp…
edsernams Oct 16, 2020
34b1595
Set the peer of the expander's toggle button's to expander's.
edsernams Oct 16, 2020
68bc096
Announce expand/collapse on expander's expansion events.
edsernams Oct 16, 2020
f721f0d
Make sure that the toggle button peer's event source can be either th…
edsernams Oct 16, 2020
260ee1f
Add ExpanderExpandingEventArgs & ExpanderCollapsedEventArgs.
edsernams Oct 16, 2020
d1d3c95
Implement logic for correct touch/pointer/keyboard focus modes on Exp…
edsernams Oct 21, 2020
b8abb85
Add GetPeerFromPointCore to address focus issues with touch + narrator.
edsernams Oct 21, 2020
9e2ae0b
Simplify GetPeerFromPointCore logic.
edsernams Oct 22, 2020
0b6295d
Update the test infra to account for the test app having a different …
StephenLPeters Oct 1, 2020
8e1c504
Refactor expander tests.
edsernams Oct 23, 2020
886872e
Refactor expander tests.
edsernams Oct 23, 2020
4d95a09
Fix tests.
edsernams Oct 24, 2020
e2df11e
Refactor expander tests.
edsernams Oct 24, 2020
79d8a7a
Remove left/right logic and add events source custom test for expanders.
edsernams Oct 26, 2020
90a6262
Commenting out events source custom test because of test infra bug.
edsernams Oct 26, 2020
53b7434
Merge origin/master.
edsernams Oct 26, 2020
f6b01f0
Remove unneccessary code.
edsernams Oct 27, 2020
c719010
Change ExpanderExpandingEventArgs/CollapsedEventArgs
edsernams Oct 27, 2020
e29e26f
Remove ExpanderExpandingEventArgs/CollapsedEventArgs classes.
edsernams Oct 27, 2020
4c3975b
Add IsEnabled template binding to Expander.xaml.
edsernams Oct 27, 2020
b24ed5f
Merge master into feature/expander.
edsernams Oct 27, 2020
4241e74
Fix build not passing due to bad merge.
edsernams Oct 28, 2020
aa7de67
Remove old Expander project identifier (804CD8D0-F381-4E1B-A5FD-E9D7C…
edsernams Oct 29, 2020
ffcb53e
Remove unused identifiers off MUXControlsInnerLoop.sln.
edsernams Oct 29, 2020
1ce7329
Remove repeated IDs from MuxControlsInnerLoop.sln as well.
edsernams Oct 29, 2020
556411e
Reorder IDs from MuxControlsInnerLoop.sln.
edsernams Oct 29, 2020
d80afea
Merge branch 'master' of https://github.com/microsoft/microsoft-ui-xa…
edsernams Oct 29, 2020
941fa34
Add missing EndProject tag to MUXControls.sln.
edsernams Oct 29, 2020
ebc695b
Add and expose new resources.
edsernams Oct 29, 2020
b2207f5
Merge branch 'master' of https://github.com/microsoft/microsoft-ui-xa…
edsernams Oct 29, 2020
97653f3
Update dev/Expander/Expander.xaml
ranjeshj Oct 30, 2020
304344c
Sync header tab logic with the one set to the expander control.
edsernams Oct 30, 2020
ab8d115
Merge changes from feature/expander into feature/expander.
edsernams Oct 30, 2020
228a119
Add HeaderStyle and HeaderStyleSelector to the idl.
edsernams Oct 30, 2020
ba4dbc8
Add ExpanderHeaderUpStyle, remove HeaderStyle and remove feature expa…
edsernams Oct 30, 2020
8304b7b
Update Expander.idl
ranjeshj Nov 2, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions FeatureAreas.props
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@
<FeatureProgressRingEnabled>true</FeatureProgressRingEnabled>
<FeatureRadialGradientBrushEnabled>true</FeatureRadialGradientBrushEnabled>
<FeatureInfoBarEnabled>true</FeatureInfoBarEnabled>
<FeatureExpanderEnabled>true</FeatureExpanderEnabled>
<FeaturePagerControlEnabled>true</FeaturePagerControlEnabled>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions InnerLoopAreas.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@

<!-- Note that after modifying the file, you will need to close and reopen the solution -->
<!-- for changes to be picked up correctly by Visual Studio and MSBUILD -->
<FeatureExpanderEnabled>true</FeatureExpanderEnabled>
ejserna marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>
</Project>
18 changes: 18 additions & 0 deletions MUXControls.sln
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,14 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "PagerControl_InteractionTes
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "PagerControl_APITests", "dev\PagerControl\APITests\PagerControl_APITests.shproj", "{CB2352E2-D633-41A3-8CDC-B28731A4C490}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Expander", "Expander", "{84BB4F12-73FD-4E4A-8724-C2C060DF5E82}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Expander", "dev\Expander\Expander.vcxitems", "{EC3B6F65-32C6-4BC8-8902-EE0B397E2787}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Expander_TestUI", "dev\Expander\TestUI\Expander_TestUI.shproj", "{50C1F1D3-20AA-49A8-9E4C-CF4E5811A1D8}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Expander_InteractionTests", "dev\Expander\InteractionTests\Expander_InteractionTests.shproj", "{D6DF4AB9-FACC-4E51-8C57-6B1F96919365}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "InfoBar", "InfoBar", "{CEFD707F-6686-4CF4-8D4C-B5FECD50D739}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InfoBar", "dev\InfoBar\InfoBar.vcxitems", "{CCC102B7-F5EF-479D-94F1-008D189448B1}"
Expand Down Expand Up @@ -742,6 +750,7 @@ Global
dev\CalendarDatePicker\CalendarDatePicker.vcxitems*{4da91b32-6723-4377-9287-ca403ef00ce4}*SharedItemsImports = 9
dev\PagerControl\InteractionTests\PagerControl_InteractionTests.projitems*{4f64c819-664f-436a-bcdb-8ab3019b9dd5}*SharedItemsImports = 13
dev\Materials\Reveal\APITests\Reveal_APITests.projitems*{5049ea6c-88ce-4ed5-8692-947eec9e52bc}*SharedItemsImports = 13
dev\Expander\TestUI\Expander_TestUI.projitems*{50c1f1d3-20aa-49a8-9e4c-cf4e5811a1d8}*SharedItemsImports = 13
dev\RadioMenuFlyoutItem\TestUI\RadioMenuFlyoutItem_TestUI.projitems*{50e838a2-a886-46c9-ab0b-a57f510ce643}*SharedItemsImports = 13
dev\PersonPicture\APITests\PersonPicture_APITests.projitems*{5243ef2c-f250-48bd-b633-39cc2a0a38aa}*SharedItemsImports = 13
dev\PullToRefresh\TestUI\PTR_TestUI.projitems*{549c8eb7-e099-4eab-a1f6-faa3fa79b9e0}*SharedItemsImports = 13
Expand Down Expand Up @@ -811,6 +820,7 @@ Global
dev\DatePicker\DatePicker.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\DropDownButton\DropDownButton.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\Effects\Microsoft.UI.Composition.Effects.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\Expander\Expander.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\FlipView\FlipView.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\IconSource\IconSource.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\InfoBar\InfoBar.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
Expand Down Expand Up @@ -886,6 +896,7 @@ Global
dev\Interactions\SliderInteraction\SliderInteraction.vcxitems*{d097a4d5-6b61-424d-99f0-f335eff41665}*SharedItemsImports = 9
dev\TabView\InteractionTests\TabView_InteractionTests.projitems*{d1e297b4-5e5b-4807-8624-4141c817a98a}*SharedItemsImports = 13
dev\MenuFlyout\MenuFlyout.vcxitems*{d5c2b2a0-50af-4ace-939d-17d1ed79fd6f}*SharedItemsImports = 9
dev\Expander\InteractionTests\Expander_InteractionTests.projitems*{d6df4ab9-facc-4e51-8c57-6b1f96919365}*SharedItemsImports = 13
dev\IconSource\APITests\IconSource_APITests.projitems*{d73627e9-564c-4a72-a12d-f6c82f17ad0d}*SharedItemsImports = 13
dev\SplitView\TestUI\SplitView_TestUI.projitems*{d8cea3b7-0012-4f74-b50f-b46e9a93c979}*SharedItemsImports = 13
dev\DropDownButton\InteractionTests\DropDownButton_InteractionTests.projitems*{d9ac3716-5608-40d0-999f-26f4b544be33}*SharedItemsImports = 13
Expand Down Expand Up @@ -914,6 +925,7 @@ Global
dev\ContentDialog\TestUI\ContentDialog_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\DatePicker\TestUI\DatePicker_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\DropDownButton\TestUI\DropDownButton_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\Expander\TestUI\Expander_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\FlipView\TestUI\FlipView_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\IconSource\APITests\IconSource_APITests.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\InfoBar\TestUI\InfoBar_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
Expand Down Expand Up @@ -981,6 +993,7 @@ Global
dev\NavigationView\NavigationView_ApiTests\NavigationView_ApiTests.projitems*{e98f3da3-3c00-4f2e-bf3b-2d2ad9d176bc}*SharedItemsImports = 13
dev\ColorPicker\APITests\ColorPicker_APITests.projitems*{e9ac4938-ec2a-46d3-85bf-27316db8cc4d}*SharedItemsImports = 13
test\MUXControls.Test\MUXControls.Test.Shared.projitems*{e9fc52cd-519a-41bb-8092-523ffa9d5617}*SharedItemsImports = 13
dev\Expander\Expander.vcxitems*{ec3b6f65-32c6-4bc8-8902-ee0b397e2787}*SharedItemsImports = 9
dev\AutoSuggestBox\InteractionTests\AutoSuggestBox_InteractionTests.projitems*{ed3e2182-d259-4dc0-b7bb-9b4219762f4c}*SharedItemsImports = 13
dev\PullToRefresh\RefreshVisualizer\RefreshVisualizer.vcxitems*{ed7dba65-8f09-44f3-8d25-7bb5a7a89609}*SharedItemsImports = 9
dev\TreeView\TreeView.vcxitems*{eeb38379-3a5c-439f-bb5e-535d75f2b6c1}*SharedItemsImports = 9
Expand Down Expand Up @@ -1009,6 +1022,7 @@ Global
dev\ContentDialog\TestUI\ContentDialog_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\DatePicker\TestUI\DatePicker_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\DropDownButton\TestUI\DropDownButton_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\Expander\TestUI\Expander_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\FlipView\TestUI\FlipView_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\IconSource\APITests\IconSource_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\InfoBar\TestUI\InfoBar_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
Expand Down Expand Up @@ -1687,6 +1701,10 @@ Global
{DB2DBB48-C807-4F7C-943E-385E77DF7BDE} = {C0215617-A17B-45DB-9CDA-C46C0923DA55}
{6B4C9F2E-6A2C-48AD-944B-49B9E9BF028D} = {C0215617-A17B-45DB-9CDA-C46C0923DA55}
{10183D43-1785-443E-AEB7-C426FDF14964} = {05CB5DBD-A481-4DFF-B1A3-642F049D165C}
{84BB4F12-73FD-4E4A-8724-C2C060DF5E82} = {67599AD5-51EC-44CB-85CE-B60CD8CBA270}
{EC3B6F65-32C6-4BC8-8902-EE0B397E2787} = {84BB4F12-73FD-4E4A-8724-C2C060DF5E82}
{50C1F1D3-20AA-49A8-9E4C-CF4E5811A1D8} = {84BB4F12-73FD-4E4A-8724-C2C060DF5E82}
{D6DF4AB9-FACC-4E51-8C57-6B1F96919365} = {84BB4F12-73FD-4E4A-8724-C2C060DF5E82}
{11DC7B03-88FB-4985-BF77-2BB3A13C75A8} = {67599AD5-51EC-44CB-85CE-B60CD8CBA270}
{AB3261A7-9A8D-4A27-AEA2-3AAC0419C889} = {11DC7B03-88FB-4985-BF77-2BB3A13C75A8}
{225C4174-3141-49B8-ADE2-C7D3408D5103} = {11DC7B03-88FB-4985-BF77-2BB3A13C75A8}
Expand Down
18 changes: 18 additions & 0 deletions MUXControlsInnerLoop.sln
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,14 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "PagerControl_InteractionTes
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "PagerControl_APITests", "dev\PagerControl\APITests\PagerControl_APITests.shproj", "{CB2352E2-D633-41A3-8CDC-B28731A4C490}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Expander", "Expander", "{93FAB536-1139-4FD1-B0BF-97C0C6FAB378}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Expander", "dev\Expander\Expander.vcxitems", "{EC3B6F65-32C6-4BC8-8902-EE0B397E2787}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Expander_TestUI", "dev\Expander\TestUI\Expander_TestUI.shproj", "{50C1F1D3-20AA-49A8-9E4C-CF4E5811A1D8}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Expander_InteractionTests", "dev\Expander\InteractionTests\Expander_InteractionTests.shproj", "{D6DF4AB9-FACC-4E51-8C57-6B1F96919365}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "InfoBar", "InfoBar", "{1AD0CB4F-47F0-432B-8D4F-CE33FA3EB8A9}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InfoBar", "dev\InfoBar\InfoBar.vcxitems", "{CCC102B7-F5EF-479D-94F1-008D189448B1}"
Expand Down Expand Up @@ -554,6 +562,7 @@ Global
dev\CalendarDatePicker\CalendarDatePicker.vcxitems*{4da91b32-6723-4377-9287-ca403ef00ce4}*SharedItemsImports = 9
dev\PagerControl\InteractionTests\PagerControl_InteractionTests.projitems*{4f64c819-664f-436a-bcdb-8ab3019b9dd5}*SharedItemsImports = 13
dev\Materials\Reveal\APITests\Reveal_APITests.projitems*{5049ea6c-88ce-4ed5-8692-947eec9e52bc}*SharedItemsImports = 13
dev\Expander\TestUI\Expander_TestUI.projitems*{50c1f1d3-20aa-49a8-9e4c-cf4e5811a1d8}*SharedItemsImports = 13
dev\RadioMenuFlyoutItem\TestUI\RadioMenuFlyoutItem_TestUI.projitems*{50e838a2-a886-46c9-ab0b-a57f510ce643}*SharedItemsImports = 13
dev\PersonPicture\APITests\PersonPicture_APITests.projitems*{5243ef2c-f250-48bd-b633-39cc2a0a38aa}*SharedItemsImports = 13
dev\PullToRefresh\TestUI\PTR_TestUI.projitems*{549c8eb7-e099-4eab-a1f6-faa3fa79b9e0}*SharedItemsImports = 13
Expand Down Expand Up @@ -609,6 +618,7 @@ Global
dev\Common\Common.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\DropDownButton\DropDownButton.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\Effects\Microsoft.UI.Composition.Effects.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\Expander\Expander.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\IconSource\IconSource.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\InfoBar\InfoBar.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\Lights\Lights.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
Expand Down Expand Up @@ -649,13 +659,15 @@ Global
dev\Interactions\SliderInteraction\SliderInteraction.vcxitems*{d097a4d5-6b61-424d-99f0-f335eff41665}*SharedItemsImports = 9
dev\TabView\InteractionTests\TabView_InteractionTests.projitems*{d1e297b4-5e5b-4807-8624-4141c817a98a}*SharedItemsImports = 13
dev\MenuFlyout\MenuFlyout.vcxitems*{d5c2b2a0-50af-4ace-939d-17d1ed79fd6f}*SharedItemsImports = 9
dev\Expander\InteractionTests\Expander_InteractionTests.projitems*{d6df4ab9-facc-4e51-8c57-6b1f96919365}*SharedItemsImports = 13
dev\IconSource\APITests\IconSource_APITests.projitems*{d73627e9-564c-4a72-a12d-f6c82f17ad0d}*SharedItemsImports = 13
dev\DropDownButton\InteractionTests\DropDownButton_InteractionTests.projitems*{d9ac3716-5608-40d0-999f-26f4b544be33}*SharedItemsImports = 13
dev\AnimatedVisualPlayer\TestUI\AnimatedVisualPlayer_TestUI.projitems*{dbec0be4-ba3f-41c9-a303-af98201be6dc}*SharedItemsImports = 13
dev\PullToRefresh\RefreshContainer\TestUI\RefreshContainer_TestUI.projitems*{ddb468e4-7b64-4301-8fcb-1bebbb1e689f}*SharedItemsImports = 13
dev\TreeView\APITests\TreeView_APITests.projitems*{de885c66-929c-464e-bac4-3e076ec46483}*SharedItemsImports = 13
dev\Pivot\TestUI\Pivot_TestUI.projitems*{deb3fa60-e4a7-4735-89f2-363c7c56b428}*SharedItemsImports = 13
dev\CommonManaged\CommonManaged.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\Expander\TestUI\Expander_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\InfoBar\TestUI\InfoBar_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\NumberBox\APITests\NumberBox_APITests.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\NumberBox\TestUI\NumberBox_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
Expand All @@ -668,13 +680,15 @@ Global
dev\NavigationView\NavigationView_ApiTests\NavigationView_ApiTests.projitems*{e98f3da3-3c00-4f2e-bf3b-2d2ad9d176bc}*SharedItemsImports = 13
dev\ColorPicker\APITests\ColorPicker_APITests.projitems*{e9ac4938-ec2a-46d3-85bf-27316db8cc4d}*SharedItemsImports = 13
test\MUXControls.Test\MUXControls.Test.Shared.projitems*{e9fc52cd-519a-41bb-8092-523ffa9d5617}*SharedItemsImports = 13
dev\Expander\Expander.vcxitems*{ec3b6f65-32c6-4bc8-8902-ee0b397e2787}*SharedItemsImports = 9
dev\PullToRefresh\RefreshVisualizer\RefreshVisualizer.vcxitems*{ed7dba65-8f09-44f3-8d25-7bb5a7a89609}*SharedItemsImports = 9
dev\TreeView\TreeView.vcxitems*{eeb38379-3a5c-439f-bb5e-535d75f2b6c1}*SharedItemsImports = 9
dev\PullToRefresh\RefreshContainer\InteractionTests\RefreshContainer_InteractionTests.projitems*{f30fe0d3-2e44-405e-8519-ec3ab098c41f}*SharedItemsImports = 13
dev\InfoBar\InteractionTests\InfoBar_InteractionTests.projitems*{f470a64e-780e-45aa-abb7-73a8734e51d7}*SharedItemsImports = 13
dev\Materials\Acrylic\InteractionTests\AcrylicBrush_InteractionTests.projitems*{f601284a-00c1-49f9-99b3-70d45585f784}*SharedItemsImports = 13
dev\SplitButton\SplitButton.vcxitems*{faf114dd-af1f-4d9f-a511-354c19912aad}*SharedItemsImports = 9
dev\CommonManaged\CommonManaged.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\Expander\TestUI\Expander_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\InfoBar\TestUI\InfoBar_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\NumberBox\APITests\NumberBox_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\NumberBox\TestUI\NumberBox_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
Expand Down Expand Up @@ -1125,6 +1139,10 @@ Global
{990BBC65-1114-435D-B5CC-1EB8AAAD72DD} = {633B8D7A-3207-4BD3-8159-B65710AEA6FF}
{128E6F7A-578C-48DC-BD3F-750EC662C268} = {633B8D7A-3207-4BD3-8159-B65710AEA6FF}
{6F7831A4-48F8-41E8-A573-C567A1223CB5} = {05CB5DBD-A481-4DFF-B1A3-642F049D165C}
{93FAB536-1139-4FD1-B0BF-97C0C6FAB378} = {67599AD5-51EC-44CB-85CE-B60CD8CBA270}
{EC3B6F65-32C6-4BC8-8902-EE0B397E2787} = {93FAB536-1139-4FD1-B0BF-97C0C6FAB378}
{50C1F1D3-20AA-49A8-9E4C-CF4E5811A1D8} = {93FAB536-1139-4FD1-B0BF-97C0C6FAB378}
{D6DF4AB9-FACC-4E51-8C57-6B1F96919365} = {93FAB536-1139-4FD1-B0BF-97C0C6FAB378}
{E7C2104F-770D-4375-8D3A-D173F222273A} = {67599AD5-51EC-44CB-85CE-B60CD8CBA270}
{AB3261A7-9A8D-4A27-AEA2-3AAC0419C889} = {E7C2104F-770D-4375-8D3A-D173F222273A}
{225C4174-3141-49B8-ADE2-C7D3408D5103} = {E7C2104F-770D-4375-8D3A-D173F222273A}
Expand Down
138 changes: 138 additions & 0 deletions dev/Expander/Expander.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

#include "pch.h"
#include "common.h"
#include "Expander.h"
#include "RuntimeProfiler.h"
#include "ResourceAccessor.h"
#include "ExpanderAutomationPeer.h"
#include "Utils.h"
#include "winnls.h"

static constexpr auto c_expanderHeader = L"ExpanderHeader"sv;

Expander::Expander()
{
__RP_Marker_ClassById(RuntimeProfiler::ProfId_Expander);

SetDefaultStyleKey(this);
}

winrt::AutomationPeer Expander::OnCreateAutomationPeer()
{
return winrt::make<ExpanderAutomationPeer>(*this);
}

void Expander::OnApplyTemplate()
{
winrt::IControlProtected controlProtected{ *this };

if (auto toggleButton = GetTemplateChildT<winrt::Control>(c_expanderHeader, *this))
{
// We will do 2 things with the toggle button's peer:
// 1. Set the events source of the toggle button peer to
// the expander's automation peer. This is is because we
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"This is is because" Typo

// don't want to announce the toggle button's on/off property
// changes, but the expander's expander/collapse property changes
// (or on the events source that's set, if it's set) and
//
// 2. Set the expander's automation properties name to the
// toggleButton's in case the expander doesn't have one. This just follows
// what WPF does.
if (winrt::AutomationPeer toggleButtonPeer = winrt::FrameworkElementAutomationPeer::FromElement(toggleButton))
{
// 1. Set the events source of the toggle button peer to the expander's.
if (winrt::AutomationPeer expanderPeer = winrt::FrameworkElementAutomationPeer::FromElement(*this))
{
auto expanderEventsSource = expanderPeer.EventsSource() != nullptr ?
expanderPeer.EventsSource() :
expanderPeer;
toggleButtonPeer.EventsSource(expanderEventsSource);
}

// 2. If the expander doesn't have any AutomationProperties.Name set,
// we will try setting one based on the header. This is how
// WPF's expanders work.
if (winrt::AutomationProperties::GetName(*this).empty()
&& !toggleButtonPeer.GetNameCore().empty())
{
winrt::AutomationProperties::SetName(*this, toggleButtonPeer.GetNameCore());
}
}

// Finally, we are going to sync the tab stop of the expander control
// with the toggle button's, and take off the tab stop of the expander.
toggleButton.IsTabStop(IsTabStop());
IsTabStop(false);
}

UpdateExpandState(false);
UpdateExpandDirection(false);
ejserna marked this conversation as resolved.
Show resolved Hide resolved
}


void Expander::RaiseExpandingEvent(const winrt::Expander& container)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

container is never used, why is it here?

{
m_expandingEventSource(*this, nullptr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invoking an event without arguments??

}

void Expander::RaiseCollapsedEvent(const winrt::Expander& container)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

container is never used, why is it here?

{
m_collapsedEventSource(*this, nullptr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invoking an event without arguments??

}

void Expander::OnIsExpandedPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& /*args*/)
{
if (IsExpanded())
{
RaiseExpandingEvent(*this);
ejserna marked this conversation as resolved.
Show resolved Hide resolved
}
else
{
RaiseCollapsedEvent(*this);
}
UpdateExpandState(true);
}

void Expander::OnExpandDirectionPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& /*args*/)
{
UpdateExpandDirection(true);
}

void Expander::UpdateExpandDirection(bool useTransitions)
{
const auto direction = ExpandDirection();
switch (direction)
{
case winrt::ExpandDirection::Down:
winrt::VisualStateManager::GoToState(*this, L"Down", useTransitions);
break;
case winrt::ExpandDirection::Up:
winrt::VisualStateManager::GoToState(*this, L"Up", useTransitions);
break;
}
}

void Expander::UpdateExpandState(bool useTransitions)
{
const auto isExpanded = IsExpanded();
if (isExpanded)
{
winrt::VisualStateManager::GoToState(*this, L"Expanded", useTransitions);
}
else
{
winrt::VisualStateManager::GoToState(*this, L"Collapsed", useTransitions);
}

if (winrt::AutomationPeer peer = winrt::FrameworkElementAutomationPeer::FromElement(*this))
{
auto expanderPeer = peer.as<ExpanderAutomationPeer>();
expanderPeer->RaiseExpandCollapseAutomationEvent(
isExpanded ?
winrt::ExpandCollapseState::Expanded :
winrt::ExpandCollapseState::Collapsed
);
}
}
Loading