Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1060
ComboBox Editor
posted

Hi

Say I have a column called CategoryId that contains a numeric value and I want to display a text representation of that value in each cell plus allow the user to edit the value by using a ComboBox editor.

In the asp.net/windows forms grid i could do this by use of a ValueList or ComboBox, setting the datasource of the ComboBox and setting the displaymember and valuemember properties.  How can i do this with the xamWebGrid?

Thanks again.

Kevin

  • 12631
    Suggested Answer
    posted

    We have an example of exactly how to do this using the TempalteColumn in our samples: http://samples.infragistics.com/silverlight/

    xamWebGrid > Data Binding and Interaction > Cell Editor Templates

    The basic XAML looks like this:

    <igGrid:TemplateColumn Key="Category" Width="120" HorizontalContentAlignment="Stretch">
           <igGrid:TemplateColumn.ItemTemplate>
             <DataTemplate>
               <TextBlock x:Name="CategoryDisplay" Text="{Binding Category}" />
             </DataTemplate>
           </igGrid:TemplateColumn.ItemTemplate>
           <igGrid:TemplateColumn.EditorTemplate>
             <DataTemplate>
               <ComboBox x:Name="CategoryEditList" ItemsSource="{StaticResource categoryProvider}"
                       SelectedItem="{Binding Category, Mode=TwoWay, 
                                                   Converter={StaticResource categoryConverter},
                                                   ConverterParameter={StaticResource categoryProvider}}"
                       DisplayMemberPath="Value" />
             </DataTemplate>
            </igGrid:TemplateColumn.EditorTemplate>
    </igGrid:TemplateColumn>