This commit is contained in:
Tung Huynh 2021-02-05 02:00:21 -08:00
Родитель 53d9a3e4df
Коммит 275a87e4f8
2 изменённых файлов: 36 добавлений и 4 удалений

Просмотреть файл

@ -84,6 +84,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
};
private RichSuggestBox _rsb;
private RichSuggestBox _tsb;
public RichSuggestBoxPage()
{
@ -107,9 +108,21 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
this._rsb.SuggestionsRequested += this.SuggestingBox_OnSuggestionsRequested;
}
if (control.FindChildByName("TokenListView") is ListView tls)
if (control.FindChildByName("PlainTextSuggestingBox") is RichSuggestBox tsb)
{
tls.ItemsSource = this._rsb?.Tokens;
this._tsb = tsb;
this._tsb.SuggestionChosen += this.SuggestingBox_OnSuggestionChosen;
this._tsb.SuggestionsRequested += this.SuggestingBox_OnSuggestionsRequested;
}
if (control.FindChildByName("TokenListView1") is ListView tls1)
{
tls1.ItemsSource = this._rsb?.Tokens;
}
if (control.FindChildByName("TokenListView2") is ListView tls2)
{
tls2.ItemsSource = this._tsb?.Tokens;
}
}

Просмотреть файл

@ -40,20 +40,39 @@
<Grid Margin="40">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="250" />
<RowDefinition Height="Auto" />
<RowDefinition Height="250" />
</Grid.RowDefinitions>
<controls:RichSuggestBox x:Name="SuggestingBox"
MaxHeight="400"
HorizontalAlignment="Stretch"
Header="RichSuggestBox:"
Header="Rich suggest box sample"
ItemTemplateSelector="{StaticResource SuggestionTemplateSelector}"
Prefixes="@#" />
<ListView x:Name="TokenListView"
<ListView x:Name="TokenListView1"
Grid.Row="1"
Margin="0,16,0,0"
HorizontalAlignment="Stretch"
ItemTemplate="{StaticResource TokenTemplate}" />
<controls:RichSuggestBox x:Name="PlainTextSuggestingBox"
Grid.Row="2"
MaxHeight="400"
HorizontalAlignment="Stretch"
Header="Plain text only suggest box sample"
DisabledFormattingAccelerators="All"
ClipboardCopyFormat="PlainText"
ClipboardPasteFormat="PlainText"
ItemTemplateSelector="{StaticResource SuggestionTemplateSelector}"
Prefixes="@#" />
<ListView x:Name="TokenListView2"
Grid.Row="3"
Margin="0,16,0,0"
HorizontalAlignment="Stretch"
ItemTemplate="{StaticResource TokenTemplate}" />
</Grid>
</Page>