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

GridView and DataForm Not Updating Properly

2 Answers 100 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Steve
Top achievements
Rank 1
Steve asked on 30 Aug 2011, 04:07 AM
Hi,

I am using the GridView as a master view and a DataForm as a detail view.  When I edit a field in the data form, it doesn't update the grid.  If I double click on the cell in the grid that was supposed to be changed, the new value shows up. If I sort on a column, the data is updated.  But it doesn't happen automatically.  Is this how it is supposed to work?

Here is my XAML
<telerik:RadGridView Grid.ColumnSpan="4"
Grid.Row="2"
HorizontalAlignment="Stretch"
Margin="5,5,0,0"
Name="radGridBoardActions"
VerticalAlignment="Top"
ItemsSource="{Binding}"/>
<dataform:DataForm x:Name="dataForm"
Grid.Column="0"
Grid.Row="3"
Grid.ColumnSpan="4"
ItemsSource="{Binding}"
CommandButtonsVisibility="All"
AutoEdit="False"
AutoCommit="True"
BindingValidationError="dataForm_BindingValidationError"
EditEnded="dataForm_EditEnded">
<dataform:DataForm.EditTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<dataform:DataField Grid.Row="0"
Grid.Column="0"
Label="Action Type">
<ComboBox
Width="150"
HorizontalAlignment="Left"
Margin="3,3,0,3"
Height="30"
ItemsSource="{Binding Path=AvailableTypes, Mode=TwoWay}"
SelectedIndex="{Binding Path=TypeID, Mode=TwoWay}"
/>
</dataform:DataField>
<dataform:DataField Grid.Column="1"
Grid.Row="0"
Label="Approval Date">
<telerik:RadDatePicker
HorizontalAlignment="Left"
Margin="3,20,0,0"
VerticalAlignment="Top"
Width="161"
SelectedValue="{Binding Path=DateApproved, Mode=TwoWay}"
/>
</dataform:DataField>
<dataform:DataField
Grid.Row="1"
Grid.Column="0" Label="Board Resolution Number">
<TextBox Width="150"
Grid.Row="1"
Grid.Column="1"
HorizontalAlignment="Left"
Margin="3"
VerticalAlignment="Center"
Text="{Binding Path=ResolutionNumber, Mode=TwoWay}"
/>
</dataform:DataField>
<dataform:DataField Grid.Column="1"
Grid.Row="1" Label="Board Approval Date">
<telerik:RadDatePicker Grid.Column="3"
Grid.Row="1"
HorizontalAlignment="Left"
Margin="3,20,0,0"
VerticalAlignment="Top"
Width="161"
SelectedValue="{Binding Path=DateBoardApproved, Mode=TwoWay}"
/>
</dataform:DataField>
</Grid>
</DataTemplate>
</dataform:DataForm.EditTemplate>
</dataform:DataForm>


And here is the code I use to initialize the itemssources:
public METROProjectFormWindow(METROProject Project)
{
    InitializeComponent();
    QueryableCollectionView pcv = new QueryableCollectionView(Project.BoardActions);
    METROProjectForm1.radGridBoardActions.ItemsSource = pcv;
    METROProjectForm1.dataForm.ItemsSource = pcv;
}

The dataform and grid synchronize fine when I am selecting a row in the grid--> The data form shows the details for that row.  If I use the navigation buttons on the dataform, the selection in the grid changes as well.  So that is all working.  The only thing that is not working is that when I change a property value in the data form, the changes are not automatically reflected in the grid.  I have to manually cause the grid to redraw (sorting or something like that) to get the new value to appear.

This is a serious issue I have to resolve quickly and any help I can get would be greatly appreciated.

Thanks,

Steve Montgomery, Consultant
www.stevetherfguy.com





2 Answers, 1 is accepted

Sort by
0
Steve
Top achievements
Rank 1
answered on 31 Aug 2011, 06:51 PM
Bump.... I really need to get help on this pretty quick or I am going to have to go to a different grid control.
0
Steve
Top achievements
Rank 1
answered on 31 Aug 2011, 07:24 PM
Well, I had a big explanation to show what the problem was and how i fixed it.  However, an errant keystroke navigated me away from the page and when I came back, my explanation was gone. 

So here is the short of it: your objects that have properties that need to be syncronized between multiple views much implement INotifyPropertyChanged.

For some reason, I thought that QueryableCollectionView did something special along those lines, but it does not.

For the record, this was a simple problem I should have caught..
Tags
GridView
Asked by
Steve
Top achievements
Rank 1
Answers by
Steve
Top achievements
Rank 1
Share this question
or