-
Notifications
You must be signed in to change notification settings - Fork 39
/
TokenViewItemsSourceSample.xaml
35 lines (34 loc) · 1.76 KB
/
TokenViewItemsSourceSample.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!-- 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. -->
<Page x:Class="TokenViewExperiment.Samples.TokenViewItemsSourceSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:labs="using:CommunityToolkit.Labs.WinUI"
xmlns:local="using:TokenViewExperiment.Samples"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<StackPanel Orientation="Vertical"
Spacing="12">
<labs:TokenView x:Name="TokenView"
CanRemoveTokens="{x:Bind CanRemoveTokens, Mode=OneWay}"
ItemsSource="{x:Bind MyDataSet, Mode=OneWay}"
SelectedIndex="1"
SelectionMode="Single">
<labs:TokenView.ItemTemplate>
<DataTemplate x:DataType="local:MyDataModel">
<Grid>
<TextBlock Margin="16,0,16,0"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind Name}" />
</Grid>
</DataTemplate>
</labs:TokenView.ItemTemplate>
</labs:TokenView>
<TextBlock Margin="0,0,12,0"
VerticalAlignment="Center">
<Run Text="Selected:" />
<Run FontWeight="SemiBold"
Text="{Binding SelectedItem.Name, ElementName=TokenView, FallbackValue='None'}" />
</TextBlock>
</StackPanel>
</Page>