|
| 1 | +<Page x:Class="WinUI.TableView.SampleApp.Pages.ColumnSizingPage" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | + xmlns:controls="using:WinUI.TableView.SampleApp.Controls" |
| 5 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 6 | + xmlns:local="using:WinUI.TableView.SampleApp" |
| 7 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 8 | + xmlns:tv="using:WinUI.TableView" |
| 9 | + xmlns:ui="using:CommunityToolkit.WinUI" |
| 10 | + d:DataContext="{d:DesignInstance Type=local:ExampleViewModel}" |
| 11 | + mc:Ignorable="d" |
| 12 | + DataContextChanged="OnDataContextChanged"> |
| 13 | + |
| 14 | + <Grid> |
| 15 | + <controls:SamplePresenter Description="This sample demonstrates the different ways a column can be sized." |
| 16 | + Header="Column Sizing"> |
| 17 | + <controls:SamplePresenter.Example> |
| 18 | + <tv:TableView x:Name="tableView" |
| 19 | + ItemsSource="{Binding Items}" /> |
| 20 | + </controls:SamplePresenter.Example> |
| 21 | + <controls:SamplePresenter.Options> |
| 22 | + <StackPanel Spacing="16" |
| 23 | + MinWidth="200"> |
| 24 | + <ComboBox x:Name="columnAutoWidthMode" |
| 25 | + HorizontalAlignment="Stretch" |
| 26 | + Header="Column Auto Width Mode" |
| 27 | + SelectedItem="{Binding ColumnAutoWidthMode, Mode=TwoWay, ElementName=tableView}" |
| 28 | + ItemsSource="{ui:EnumValues Type=tv:TableViewColumnAutoWidthMode}" /> |
| 29 | + </StackPanel> |
| 30 | + </controls:SamplePresenter.Options> |
| 31 | + <controls:SamplePresenter.Xaml> |
| 32 | + <x:String xml:space="preserve"> |
| 33 | +<tv:TableView ItemsSource="{Binding Items}" |
| 34 | + ColumnAutoWidthMode="$(ColumnAutoWidthMode)"/> |
| 35 | + </x:String> |
| 36 | + </controls:SamplePresenter.Xaml> |
| 37 | + <controls:SamplePresenter.Substitutions> |
| 38 | + <controls:CodeSubstitution Key="ColumnAutoWidthMode" |
| 39 | + Value="{x:Bind columnAutoWidthMode.SelectedItem, Mode=OneWay}" /> |
| 40 | + </controls:SamplePresenter.Substitutions> |
| 41 | + </controls:SamplePresenter> |
| 42 | + </Grid> |
| 43 | +</Page> |
0 commit comments