-
Notifications
You must be signed in to change notification settings - Fork 278
MultiSelectionSearchComboBox
闫驚鏵(Jinhua Yan) edited this page Apr 16, 2023
·
2 revisions
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Button Content="获取选中"
VerticalAlignment="Bottom"
HorizontalAlignment="Center"
Click="Button_Click"
Margin="0,20,0,0"
Style="{StaticResource SuccessPrimaryButton}"/>
<UniformGrid Columns="2" Rows="2" Grid.Row="1">
<wd:MultiSelectionSearchComboBox
VerticalContentAlignment="Center"
HorizontalAlignment="Center"
ItemsSource="{Binding Drawings}"
DisplayMemberPath="Number"
SelectedValuePath="Index"
Width="200" Delimiter=","
IsSelectAllActive="True">
<wd:MultiSelectionSearchComboBox.DataContext>
<vm:DrawingExampleVM/>
</wd:MultiSelectionSearchComboBox.DataContext>
</wd:MultiSelectionSearchComboBox>
<wd:MultiSelectionSearchComboBox
Name="MyMultiSelectionSearchComboBox2"
VerticalContentAlignment="Center"
HorizontalAlignment="Center"
ItemsSource="{Binding Drawings}"
DisplayMemberPath="Number"
SelectedValuePath="Index"
Width="200" Delimiter="^"
IsSelectAllActive="True"
wd:ElementHelper.Watermark="MultiSelectionSearchComboBox"
SearchWatermark="请输入搜索内容">
<wd:MultiSelectionSearchComboBox.DataContext>
<vm:DrawingExampleVM/>
</wd:MultiSelectionSearchComboBox.DataContext>
</wd:MultiSelectionSearchComboBox>
</UniformGrid>
</Grid>
private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
{
WPFDevelopers.Controls.MessageBox.Show($"{MyMultiSelectionSearchComboBox2.Text} \r\n总共选中:{MyMultiSelectionSearchComboBox2.SelectedItems.Count} 条","选中内容",MessageBoxButton.OK,MessageBoxImage.Information);
}