From 8e116adc1f9db2fb7d133ff9c2f5603588f63b79 Mon Sep 17 00:00:00 2001 From: Vincent Gromfeld Date: Tue, 21 May 2024 17:12:25 +0200 Subject: [PATCH 1/8] Add ribbon control --- components/Ribbon/OpenSolution.bat | 3 + components/Ribbon/samples/Assets/Ribbon.png | Bin 0 -> 2216 bytes components/Ribbon/samples/Dependencies.props | 31 ++ .../Ribbon/samples/Ribbon.Samples.csproj | 18 + components/Ribbon/samples/Ribbon.md | 74 ++++ .../Ribbon/samples/RibbonCustomSample.xaml | 241 +++++++++++ .../Ribbon/samples/RibbonCustomSample.xaml.cs | 16 + ...munityToolkit.WinUI.Controls.Ribbon.csproj | 17 + components/Ribbon/src/Dependencies.props | 31 ++ components/Ribbon/src/DoubleList.cs | 44 ++ components/Ribbon/src/MultiTarget.props | 9 + components/Ribbon/src/Ribbon.cs | 201 +++++++++ .../Ribbon/src/RibbonCollapsibleGroup.cs | 273 ++++++++++++ components/Ribbon/src/RibbonGroup.cs | 51 +++ components/Ribbon/src/RibbonPanel.cs | 136 ++++++ components/Ribbon/src/RibbonStyle.xaml | 406 ++++++++++++++++++ components/Ribbon/src/Themes/Generic.xaml | 8 + .../Ribbon/tests/Ribbon.Tests.projitems | 23 + components/Ribbon/tests/Ribbon.Tests.shproj | 13 + components/Ribbon/tests/RibbonTestClass.cs | 43 ++ components/Ribbon/tests/RibbonTestPage.xaml | 15 + .../Ribbon/tests/RibbonTestPage.xaml.cs | 10 + tooling | 2 +- 23 files changed, 1664 insertions(+), 1 deletion(-) create mode 100644 components/Ribbon/OpenSolution.bat create mode 100644 components/Ribbon/samples/Assets/Ribbon.png create mode 100644 components/Ribbon/samples/Dependencies.props create mode 100644 components/Ribbon/samples/Ribbon.Samples.csproj create mode 100644 components/Ribbon/samples/Ribbon.md create mode 100644 components/Ribbon/samples/RibbonCustomSample.xaml create mode 100644 components/Ribbon/samples/RibbonCustomSample.xaml.cs create mode 100644 components/Ribbon/src/CommunityToolkit.WinUI.Controls.Ribbon.csproj create mode 100644 components/Ribbon/src/Dependencies.props create mode 100644 components/Ribbon/src/DoubleList.cs create mode 100644 components/Ribbon/src/MultiTarget.props create mode 100644 components/Ribbon/src/Ribbon.cs create mode 100644 components/Ribbon/src/RibbonCollapsibleGroup.cs create mode 100644 components/Ribbon/src/RibbonGroup.cs create mode 100644 components/Ribbon/src/RibbonPanel.cs create mode 100644 components/Ribbon/src/RibbonStyle.xaml create mode 100644 components/Ribbon/src/Themes/Generic.xaml create mode 100644 components/Ribbon/tests/Ribbon.Tests.projitems create mode 100644 components/Ribbon/tests/Ribbon.Tests.shproj create mode 100644 components/Ribbon/tests/RibbonTestClass.cs create mode 100644 components/Ribbon/tests/RibbonTestPage.xaml create mode 100644 components/Ribbon/tests/RibbonTestPage.xaml.cs diff --git a/components/Ribbon/OpenSolution.bat b/components/Ribbon/OpenSolution.bat new file mode 100644 index 000000000..814a56d4b --- /dev/null +++ b/components/Ribbon/OpenSolution.bat @@ -0,0 +1,3 @@ +@ECHO OFF + +powershell ..\..\tooling\ProjectHeads\GenerateSingleSampleHeads.ps1 -componentPath %CD% %* \ No newline at end of file diff --git a/components/Ribbon/samples/Assets/Ribbon.png b/components/Ribbon/samples/Assets/Ribbon.png new file mode 100644 index 0000000000000000000000000000000000000000..8435bcaa9fc371ca8e92db07ae596e0d57c8b9b0 GIT binary patch literal 2216 zcmV;Z2v_%sP);M1&0drDELIAGL9O(c600d`2O+f$vv5yP=YKs(Je9p7&Ka&|n*ecc!Pix~iV~>Yi6*wXL?Fq6O}_ef#!O2;q#X&d1-r zFW&c8*L5NOYWz*lA^xUE>kGNx-uL6v^z@vr)V_TA(vQ#Yoo1$I^Fv;IKkA`?U*Z6OoBe{XX@DLpL{F3+>RV2oP732rn@P@98F ziH~#f`tA7f<8t}(<$sLlUkdm_STvOKGYXY{9St3tGiu1>duN9F9aTe*kTXOCkoLYj zr)5cJP?i}f+kBoB8b~Q1rbJi`730DXGLx}aCV-6tC522QjZs)X03S%#=jXopQNe7G z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uE%QV$RY7$1cP-aqS07(jX4W{bFHp!#3m}TTAaaF3L~n9Q)s^3xP5nw5 zM&HvBw5z{TbdA3!8Di)wIs`5S;W!fVdWDbiH|P}wlVfDMuB&#@so4j+uC6L7Q#M38 z*q?Pnc_gqfql3rn?qh)V@~B|(78+7U zKOCcocD&A`ELB-^?%cVvanNF%vtSH&^_LVuBqdkprWDoUyaLCf$s5zvc?rH#NGXk= qmFA_t_5FR}!i7I&wXL?Ful)xU?DJJ%Hwu*i0000 + + + + + + + + + + + + + + + + + + + + + diff --git a/components/Ribbon/samples/Ribbon.Samples.csproj b/components/Ribbon/samples/Ribbon.Samples.csproj new file mode 100644 index 000000000..082bdb735 --- /dev/null +++ b/components/Ribbon/samples/Ribbon.Samples.csproj @@ -0,0 +1,18 @@ + + + + + Ribbon + + + + + + + + + + PreserveNewest + + + diff --git a/components/Ribbon/samples/Ribbon.md b/components/Ribbon/samples/Ribbon.md new file mode 100644 index 000000000..7b90d0f0e --- /dev/null +++ b/components/Ribbon/samples/Ribbon.md @@ -0,0 +1,74 @@ +--- +title: Ribbon +author: vgromfeld +description: An office like ribbon. +keywords: Ribbon, Control +dev_langs: + - csharp +category: Controls +subcategory: Layout +experimental: true +discussion-id: 0 +issue-id: 0 +icon: Assets/Ribbon.png +--- + + + +# Ribbon + +An Office like Ribbon control which displays groups of commands. If there is not enough space to display all the groups, +some of them can be collapsed based on a priority order. + +> [!Sample RibbonCustomSample] + +## RibbonGroup + +A basic group displayed in a Ribbon. +It mostly adds a *label* to some content and will not collapse if there is not enough space available. + +### Label +The label of the group. + +### Content +The content of the group. + +## RibbonCollapsibleGroup + +A `RibbonGroup` which can be collapsed if its content does not fit in the available Ribbon's space. +When collapsed, the group is displayed as a single icon button. Clicking on this button opens +a flyout containing the group's content. + +### IconSource +The icon to display when the group is collapsed. + +### AutoCloseflyout +Set to true to automatically close the overflow flyout if one interactive element is clicked. +Note that the logic to detect the click is very basic. It will request the flyout to close +for all the handled pointer released events. It assumes that if the pointer has been handled +something reacted to it. It works well for buttons or check boxes but does not work for text +or combo boxes. + +### Priority +The priority of the group. +The group with the lower priority will be the first one to be collapsed. + +### CollapsedAccessKey +The access key to access the collapsed button and open the flyout when the group is collapsed. + +### RequestedWidths + +The list of requested widths for the group. +If null or empty, the group will automatically use the size of its content. +If set, the group will use the smallest provided width fitting in the ribbon. +This is useful if the group contains a variable size control which can adjust +its width (like a GridView with several items). + +### State +The state of the group (collapsed or visible). This property is used by the `RibbonPanel`. + +## RibbonPanel + +The inner panel of the Ribbon control. It displays the groups inside the `Ribbon` and +automatically collapse the `CollapsibleGroup` elements based on their priority order if +there is not enough space available. diff --git a/components/Ribbon/samples/RibbonCustomSample.xaml b/components/Ribbon/samples/RibbonCustomSample.xaml new file mode 100644 index 000000000..44acc0ae8 --- /dev/null +++ b/components/Ribbon/samples/RibbonCustomSample.xaml @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +