Articles in this section
Category / Section

How to display Multi Column data information in ComboBoxAdv?

1 min read

In ComboBoxAdv, there is no direct option to show multiple column information in the ComboBoxItemAdv and it can be achieved by editing the ComboBoxItemAdv template using ItemTemplate property of the ComboBoxAdv. 

 

The following code demonstrates the same.

Code Example: [XAML]

<sf:ChromelessWindow.DataContext>
        <local:ViewModel/>
    </sf:ChromelessWindow.DataContext>
    <Window.Resources>
        <DataTemplate x:Key="ComboBoxMultiColumnTemplate" >
            <Border x:Name="Bd" CornerRadius="0" SnapsToDevicePixels="true" VerticalAlignment="Center" HorizontalAlignment="Center">
                <Grid >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition  />
                        <ColumnDefinition  />
                    </Grid.ColumnDefinitions>
                    <TextBlock Name="column1" Text="{Binding Path=SalesDistrictName}" FontSize="14"   Margin="0,0,5,0"  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"  />
                    <TextBlock Name="column2" Text="{Binding Path=SalesRepresentativeName}" FontSize="14" Grid.Column="1"  Margin="5,0,0,0"  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                </Grid>
            </Border>
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <sf:ComboBoxAdv Height="50" Width="250" ItemsSource="{Binding ModelList}"  VerticalContentAlignment="Center" HorizontalAlignment="Center" AllowMultiSelect="True"  MaxDropDownHeight="300" ItemTemplate="{StaticResource ComboBoxMultiColumnTemplate}"/>
    </Grid>

 

multicolumn combo box

 

 

Sample [C#]: MultiColumnComboBoxSample

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied