|
| 1 | +<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. --> |
| 2 | +<Page x:Class="RibbonExperiment.Samples.RibbonCustomSample" |
| 3 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 4 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 5 | + xmlns:controls="using:CommunityToolkit.WinUI.Controls" |
| 6 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 7 | + xmlns:local="using:RibbonExperiment.Samples" |
| 8 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 9 | + mc:Ignorable="d"> |
| 10 | + |
| 11 | + <!-- |
| 12 | + TODO: The generic.xaml file from the code project is not imported when the sample is loaded in the gallery app. |
| 13 | + As a mitigation, we are manually importing the style dictionary here. |
| 14 | + --> |
| 15 | + <Page.Resources> |
| 16 | + <ResourceDictionary Source="ms-appx:///CommunityToolkit.WinUI.Controls.Ribbon/RibbonStyle.xaml" /> |
| 17 | + </Page.Resources> |
| 18 | + |
| 19 | + <StackPanel Spacing="16"> |
| 20 | + <StackPanel.Resources> |
| 21 | + <Style BasedOn="{StaticResource DefaultAppBarButtonStyle}" |
| 22 | + TargetType="AppBarButton"> |
| 23 | + <Setter Property="LabelPosition" Value="Collapsed" /> |
| 24 | + <Setter Property="Width" Value="48" /> |
| 25 | + <Setter Property="Margin" Value="4" /> |
| 26 | + <Setter Property="Height" Value="48" /> |
| 27 | + </Style> |
| 28 | + </StackPanel.Resources> |
| 29 | + |
| 30 | + <controls:Ribbon HorizontalAlignment="Stretch"> |
| 31 | + |
| 32 | + <controls:RibbonCollapsibleGroup AccessKey="AB" |
| 33 | + CollapsedAccessKey="AA" |
| 34 | + Label="Edit" |
| 35 | + Style="{StaticResource RibbonLeftCollapsibleGroupStyle}"> |
| 36 | + <controls:RibbonCollapsibleGroup.IconSource> |
| 37 | + <SymbolIconSource Symbol="Add" /> |
| 38 | + </controls:RibbonCollapsibleGroup.IconSource> |
| 39 | + |
| 40 | + <Grid> |
| 41 | + <Grid.ColumnDefinitions> |
| 42 | + <ColumnDefinition Width="Auto" /> |
| 43 | + <ColumnDefinition Width="Auto" /> |
| 44 | + <ColumnDefinition Width="Auto" /> |
| 45 | + </Grid.ColumnDefinitions> |
| 46 | + <Grid.RowDefinitions> |
| 47 | + <RowDefinition Height="*" /> |
| 48 | + <RowDefinition Height="*" /> |
| 49 | + </Grid.RowDefinitions> |
| 50 | + |
| 51 | + <AppBarButton Icon="Accept" /> |
| 52 | + <AppBarButton Grid.Column="1" |
| 53 | + Icon="Account" /> |
| 54 | + |
| 55 | + <AppBarButton Grid.Row="1" |
| 56 | + Icon="Add" /> |
| 57 | + <AppBarButton Grid.Row="1" |
| 58 | + Grid.Column="1" |
| 59 | + Icon="AddFriend" /> |
| 60 | + <AppBarButton Grid.RowSpan="2" |
| 61 | + Grid.Column="2" |
| 62 | + Icon="Admin" /> |
| 63 | + </Grid> |
| 64 | + </controls:RibbonCollapsibleGroup> |
| 65 | + |
| 66 | + <controls:RibbonCollapsibleGroup CollapsedAccessKey="B" |
| 67 | + Label="Text" |
| 68 | + Priority="1" |
| 69 | + Style="{StaticResource RibbonLeftCollapsibleGroupStyle}"> |
| 70 | + <controls:RibbonCollapsibleGroup.IconSource> |
| 71 | + <SymbolIconSource Symbol="Remove" /> |
| 72 | + </controls:RibbonCollapsibleGroup.IconSource> |
| 73 | + |
| 74 | + <Grid> |
| 75 | + <Grid.ColumnDefinitions> |
| 76 | + <ColumnDefinition Width="Auto" /> |
| 77 | + <ColumnDefinition Width="Auto" /> |
| 78 | + <ColumnDefinition Width="Auto" /> |
| 79 | + </Grid.ColumnDefinitions> |
| 80 | + <Grid.RowDefinitions> |
| 81 | + <RowDefinition Height="*" /> |
| 82 | + <RowDefinition Height="*" /> |
| 83 | + </Grid.RowDefinitions> |
| 84 | + |
| 85 | + <AppBarButton Icon="AllApps" /> |
| 86 | + <AppBarButton Grid.Column="1" |
| 87 | + Icon="Attach" /> |
| 88 | + <DropDownButton Grid.Column="2" |
| 89 | + Content="Color"> |
| 90 | + <DropDownButton.Flyout> |
| 91 | + <Flyout> |
| 92 | + <Border Width="200" |
| 93 | + Height="200" |
| 94 | + Background="Red" /> |
| 95 | + </Flyout> |
| 96 | + </DropDownButton.Flyout> |
| 97 | + </DropDownButton> |
| 98 | + |
| 99 | + <AppBarButton Grid.Row="1" |
| 100 | + Icon="GoToStart" /> |
| 101 | + <AppBarButton Grid.Row="1" |
| 102 | + Grid.Column="1" |
| 103 | + Icon="GlobalNavigationButton" /> |
| 104 | + <AppBarButton Grid.Row="1" |
| 105 | + Grid.Column="2" |
| 106 | + Icon="ClosePane" /> |
| 107 | + </Grid> |
| 108 | + </controls:RibbonCollapsibleGroup> |
| 109 | + |
| 110 | + <controls:RibbonGroup Label="Color"> |
| 111 | + <Button Content="Pick color" /> |
| 112 | + </controls:RibbonGroup> |
| 113 | + |
| 114 | + <controls:RibbonCollapsibleGroup CollapsedAccessKey="C" |
| 115 | + Label="Text"> |
| 116 | + <controls:RibbonCollapsibleGroup.IconSource> |
| 117 | + <SymbolIconSource Symbol="Font" /> |
| 118 | + </controls:RibbonCollapsibleGroup.IconSource> |
| 119 | + |
| 120 | + <Grid> |
| 121 | + <Grid.ColumnDefinitions> |
| 122 | + <ColumnDefinition Width="Auto" /> |
| 123 | + <ColumnDefinition Width="Auto" /> |
| 124 | + <ColumnDefinition Width="Auto" /> |
| 125 | + <ColumnDefinition Width="Auto" /> |
| 126 | + </Grid.ColumnDefinitions> |
| 127 | + <Grid.RowDefinitions> |
| 128 | + <RowDefinition Height="*" /> |
| 129 | + <RowDefinition Height="*" /> |
| 130 | + </Grid.RowDefinitions> |
| 131 | + |
| 132 | + <AppBarButton Grid.RowSpan="2" |
| 133 | + VerticalAlignment="Center" |
| 134 | + Icon="Font" /> |
| 135 | + <AppBarButton Grid.Column="1" |
| 136 | + Icon="AlignLeft" /> |
| 137 | + <AppBarButton Grid.Column="2" |
| 138 | + Icon="AlignCenter" /> |
| 139 | + <AppBarButton Grid.Column="3" |
| 140 | + Icon="AlignRight" /> |
| 141 | + <AppBarButton Grid.Row="1" |
| 142 | + Grid.Column="1" |
| 143 | + Icon="FontIncrease" /> |
| 144 | + <AppBarButton Grid.Row="1" |
| 145 | + Grid.Column="2" |
| 146 | + Icon="FontDecrease" /> |
| 147 | + <AppBarButton Grid.Row="1" |
| 148 | + Grid.Column="3" |
| 149 | + Icon="FontColor" /> |
| 150 | + </Grid> |
| 151 | + </controls:RibbonCollapsibleGroup> |
| 152 | + |
| 153 | + <controls:RibbonCollapsibleGroup CollapsedAccessKey="G" |
| 154 | + Label="Advanced" |
| 155 | + Priority="5" |
| 156 | + RequestedWidths="400,200,300"> |
| 157 | + <controls:RibbonCollapsibleGroup.IconSource> |
| 158 | + <SymbolIconSource Symbol="AllApps" /> |
| 159 | + </controls:RibbonCollapsibleGroup.IconSource> |
| 160 | + <GridView Height="96" |
| 161 | + MaxWidth="400" |
| 162 | + HorizontalAlignment="Stretch" |
| 163 | + VerticalAlignment="Center" |
| 164 | + BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" |
| 165 | + BorderThickness="1" |
| 166 | + ScrollViewer.HorizontalScrollBarVisibility="Disabled" |
| 167 | + ScrollViewer.HorizontalScrollMode="Disabled" |
| 168 | + ScrollViewer.VerticalScrollBarVisibility="Auto"> |
| 169 | + <GridView.ItemTemplate> |
| 170 | + <DataTemplate> |
| 171 | + <TextBlock Width="24" |
| 172 | + Height="24" |
| 173 | + HorizontalTextAlignment="Center" |
| 174 | + Text="{Binding}" /> |
| 175 | + </DataTemplate> |
| 176 | + </GridView.ItemTemplate> |
| 177 | + <GridView.Items> |
| 178 | + <x:Double>1</x:Double> |
| 179 | + <x:Double>2</x:Double> |
| 180 | + <x:Double>3</x:Double> |
| 181 | + <x:Double>4</x:Double> |
| 182 | + <x:Double>5</x:Double> |
| 183 | + <x:Double>6</x:Double> |
| 184 | + <x:Double>7</x:Double> |
| 185 | + <x:Double>8</x:Double> |
| 186 | + <x:Double>9</x:Double> |
| 187 | + <x:Double>10</x:Double> |
| 188 | + <x:Double>11</x:Double> |
| 189 | + <x:Double>12</x:Double> |
| 190 | + <x:Double>13</x:Double> |
| 191 | + <x:Double>14</x:Double> |
| 192 | + </GridView.Items> |
| 193 | + </GridView> |
| 194 | + </controls:RibbonCollapsibleGroup> |
| 195 | + |
| 196 | + <controls:RibbonCollapsibleGroup CollapsedAccessKey="E" |
| 197 | + Label="Commands" |
| 198 | + Priority="2" |
| 199 | + Style="{StaticResource RibbonRightCollapsibleGroupStyle}"> |
| 200 | + <controls:RibbonCollapsibleGroup.IconSource> |
| 201 | + <SymbolIconSource Symbol="Library" /> |
| 202 | + </controls:RibbonCollapsibleGroup.IconSource> |
| 203 | + |
| 204 | + <Grid> |
| 205 | + <Grid.ColumnDefinitions> |
| 206 | + <ColumnDefinition Width="Auto" /> |
| 207 | + <ColumnDefinition Width="Auto" /> |
| 208 | + <ColumnDefinition Width="Auto" /> |
| 209 | + <ColumnDefinition Width="Auto" /> |
| 210 | + <ColumnDefinition Width="Auto" /> |
| 211 | + </Grid.ColumnDefinitions> |
| 212 | + <Grid.RowDefinitions> |
| 213 | + <RowDefinition Height="*" /> |
| 214 | + <RowDefinition Height="*" /> |
| 215 | + </Grid.RowDefinitions> |
| 216 | + |
| 217 | + <AppBarButton Icon="Accept" /> |
| 218 | + <AppBarButton Grid.Column="1" |
| 219 | + Icon="Favorite" /> |
| 220 | + <AppBarButton Grid.Column="2" |
| 221 | + Icon="Filter" /> |
| 222 | + <AppBarButton Grid.Column="3" |
| 223 | + Icon="Find" /> |
| 224 | + <AppBarButton Grid.Column="4" |
| 225 | + Icon="Flag" /> |
| 226 | + |
| 227 | + <AppBarButton Grid.Row="1" |
| 228 | + Icon="Folder" /> |
| 229 | + <AppBarButton Grid.Row="1" |
| 230 | + Grid.Column="1" |
| 231 | + Icon="Font" /> |
| 232 | + <AppBarButton Grid.Row="1" |
| 233 | + Grid.Column="2" |
| 234 | + Icon="FontColor" /> |
| 235 | + <AppBarButton Grid.Row="1" |
| 236 | + Grid.Column="3" |
| 237 | + Icon="FontDecrease" /> |
| 238 | + <AppBarButton Grid.Row="1" |
| 239 | + Grid.Column="4" |
| 240 | + Icon="FontIncrease" /> |
| 241 | + </Grid> |
| 242 | + </controls:RibbonCollapsibleGroup> |
| 243 | + |
| 244 | + <controls:RibbonGroup Label="Options" |
| 245 | + Style="{StaticResource RibbonRightGroupStyle}"> |
| 246 | + <AppBarButton Icon="Setting" /> |
| 247 | + </controls:RibbonGroup> |
| 248 | + </controls:Ribbon> |
| 249 | + </StackPanel> |
| 250 | +</Page> |
0 commit comments