如何将我单击的内容传输到 ListBoxEdit 并绑定到 selectedAllitems ComboboxEdit
How to transfer what I clicked to ListBoxEdit and bind to selectedAllitems ComboboxEdit
如何将我选择的ListBoxEdit 转移到ComboBoxEdit WPF C#
我该怎么做?
下面的代码
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ReportPrint"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" x:Class="ReportPrint.ComboList"
mc:Ignorable="d" Width="200" Height="23" Name="k">
<Grid Margin="0">
<dxe:ComboBoxEdit x:Name="combo" HorizontalAlignment="Left" VerticalAlignment="Top" Width="200" Height="23" PopupOpening="ComboBoxEdit_PopupOpening" AutoComplete="False" GotFocus="combo_GotFocus" ItemsSource="{Binding ElementName=checkedListBoxEditStyleSettings}" SelectedItem="{Binding ElementName=checkedListBoxEditStyleSettings, Mode=OneWay}" EditValue="{Binding ElementName=checkedListBoxEditStyleSettings, Mode=OneWay}" >
<dxe:ComboBoxEdit.StyleSettings>
<dxe:TokenComboBoxStyleSettings x:Name="tokenComboBoxStyleSettings"/>
</dxe:ComboBoxEdit.StyleSettings>
</dxe:ComboBoxEdit>
<dxe:ListBoxEdit x:Name="List" HorizontalAlignment="Left" Height="102" VerticalAlignment="Top" Visibility="Hidden" PreviewMouseWheel="List_PreviewMouseWheel" Margin="0,23,-40,-102" >
<dxe:ListBoxEdit.StyleSettings>
<dxe:CheckedListBoxEditStyleSettings x:Name="checkedListBoxEditStyleSettings"/>
</dxe:ListBoxEdit.StyleSettings>
</dxe:ListBoxEdit>
</Grid>
</UserControl>
自己做的,但我会与你分享
combo.Items.Add(List.SelectedItem);//combo this ComboBoxEdit
combo.DisplayMember = "Value";
combo.SelectedItems.Add(List.SelectedItem);//List this ListBoxEdit
如何将我选择的ListBoxEdit 转移到ComboBoxEdit WPF C#
我该怎么做? 下面的代码
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ReportPrint"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" x:Class="ReportPrint.ComboList"
mc:Ignorable="d" Width="200" Height="23" Name="k">
<Grid Margin="0">
<dxe:ComboBoxEdit x:Name="combo" HorizontalAlignment="Left" VerticalAlignment="Top" Width="200" Height="23" PopupOpening="ComboBoxEdit_PopupOpening" AutoComplete="False" GotFocus="combo_GotFocus" ItemsSource="{Binding ElementName=checkedListBoxEditStyleSettings}" SelectedItem="{Binding ElementName=checkedListBoxEditStyleSettings, Mode=OneWay}" EditValue="{Binding ElementName=checkedListBoxEditStyleSettings, Mode=OneWay}" >
<dxe:ComboBoxEdit.StyleSettings>
<dxe:TokenComboBoxStyleSettings x:Name="tokenComboBoxStyleSettings"/>
</dxe:ComboBoxEdit.StyleSettings>
</dxe:ComboBoxEdit>
<dxe:ListBoxEdit x:Name="List" HorizontalAlignment="Left" Height="102" VerticalAlignment="Top" Visibility="Hidden" PreviewMouseWheel="List_PreviewMouseWheel" Margin="0,23,-40,-102" >
<dxe:ListBoxEdit.StyleSettings>
<dxe:CheckedListBoxEditStyleSettings x:Name="checkedListBoxEditStyleSettings"/>
</dxe:ListBoxEdit.StyleSettings>
</dxe:ListBoxEdit>
</Grid>
</UserControl>
自己做的,但我会与你分享
combo.Items.Add(List.SelectedItem);//combo this ComboBoxEdit
combo.DisplayMember = "Value";
combo.SelectedItems.Add(List.SelectedItem);//List this ListBoxEdit