Search code examples
c#wpfdevexpress

How to transfer what I clicked to ListBoxEdit and bind to selectedAllitems ComboboxEdit


how to transfer what I selected to ListBoxEdit to ComboBoxEdit WPF C #

How can i do this? code below

<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>

Solution

  • did it myself, but I will share it with you

     combo.Items.Add(List.SelectedItem);//combo this ComboBoxEdit
                combo.DisplayMember = "Value";
                combo.SelectedItems.Add(List.SelectedItem);//List this ListBoxEdit