This is a migrated thread and some comments may be shown as answers.

GridView DataBinding Questions

2 Answers 132 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 31 Jan 2011, 01:59 PM
Hi,

I have a problem using the
  • GridViewCheckBoxColumn
  • GridViewComboBoxColumn
When I edit data in a "GridViewDataColumn" and execute my custom "UpdateItemCommand" I have no problems and my SelectedItem displays the changes which were entered in the "GridViewDataColumn".
However the problem occurs when I edit a "GridViewCheckBoxColumn" or "GridViewComboBoxColumn". The SelectedItem does not display the changes made by these Columns.

Thank you for your help!
Martin

<my:RadGridView x:Name="RadGridView" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" ItemsSource="{Binding PLC_Items}>
        <my:RadGridView.Columns>
            <my:GridViewDataColumn Header="ID" DataMemberBinding="{Binding ID}" IsReadOnly="True"/>
            <my:GridViewDataColumn Header="ItemName" DataMemberBinding="{Binding Name}" Width="*"/>
            <my:GridViewComboBoxColumn Header="Function" ItemsSource="{Binding AllFunctions}" DataMemberBinding="{Binding Function}"/>
            <my:GridViewCheckBoxColumn Header="Auto Update" DataMemberBinding="{Binding AutoUpdate, Mode=TwoWay}"/>
            <my:GridViewColumn Width="Auto">
                <my:GridViewColumn.CellTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" Margin="2">
                            <telerik:RadButton Command="{Binding DataContext.WriteItemCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type my:RadGridView}}}"/>
                            <telerik:RadButton Command="{Binding DataContext.UpdateItemCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type my:RadGridView}}}"/>
                            <telerik:RadButton Command="{Binding DataContext.ReadItemCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type my:RadGridView}}}"/>
                            <telerik:RadButton Command="{Binding DataContext.DeleteItemCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type my:RadGridView}}}"/>
                        </StackPanel>
                    </DataTemplate>
                </my:GridViewColumn.CellTemplate>
            </my:GridViewColumn>
        </my:RadGridView.Columns>
    </my:RadGridView>


2 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 31 Jan 2011, 03:39 PM
Hi Martin,

I was not able to reproduce your scenario. I am sending you the sample project I used for testing it. Please take a look at it and let me know in case of any discrepancies according to your requirements.
 

All the best,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Martin
Top achievements
Rank 1
answered on 02 Feb 2011, 05:13 PM
Hi Maya,

thank you for the help. I noticed that my Code actually works, I just need to "Enter" the changed Combobox before storing the Data.

Martin
Tags
GridView
Asked by
Martin
Top achievements
Rank 1
Answers by
Maya
Telerik team
Martin
Top achievements
Rank 1
Share this question
or