Hi,
i have a - maybe - stupid question. My Application uses Entity Framework 4.1 with DBContext. In the MainWindow is a RadGridView bound to a QueryableCollectionView (Customers) to display Data.
The user changes a single row of the grid via a ModalWindow. The Window has it's own dbcontext. After the user has closed the ModalWindow (and the changes are saved to the database) i wan't to refresh the grid in the parent's window.
I tried the following:
This code forces the dbcontext to update the changed entry. But the changes are not reflected in the grid. I tried to call the Refresh() method of the QueryableCollectionView, but the grid still show's the old values.
How can i force the grid to show the changes made in the dbcontext?
i have a - maybe - stupid question. My Application uses Entity Framework 4.1 with DBContext. In the MainWindow is a RadGridView bound to a QueryableCollectionView (Customers) to display Data.
<
telerik:RadGridView
x:Name
=
"uxCustomerGrid"
ItemsSource
=
"{Binding Customers,BindsDirectlyToSource=True}"
IsReadOnly
=
"True"
EnableColumnVirtualization
=
"True"
EnableRowVirtualization
=
"true"
SelectionMode
=
"Extended"
RowIndicatorVisibility
=
"Collapsed"
AutoGenerateColumns
=
"False"
CanUserDeleteRows
=
"False"
CanUserInsertRows
=
"False"
GridLinesVisibility
=
"None"
IsFilteringAllowed
=
"False"
ShowGroupPanel
=
"False"
RowStyle
=
"{DynamicResource CustomerRowStyle}"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Kundennummer}"
Header
=
"Nummer"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Kundenname}"
Header
=
"Name"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Ort.Bezeichnung}"
Header
=
"Ort"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Ort.PLZ}"
Header
=
"PLZ"
IsVisible
=
"False"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Einwohneranzahl}"
Header
=
"Einwohner"
IsVisible
=
"False"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
private
QueryableCollectionView _customers;
public
QueryableCollectionView Customers
{
get
{
return
_customers; }
set
{
if
(value != _customers)
{
_customers = value;
OnPropertyChanged(
"Customers"
);
}
}
}
....
this
._context =
new
MiexUnitOfWork();
_context.Kunde.ToList();
this
.Customers =
new
QueryableCollectionView(_context.Kunde.Local);
The user changes a single row of the grid via a ModalWindow. The Window has it's own dbcontext. After the user has closed the ModalWindow (and the changes are saved to the database) i wan't to refresh the grid in the parent's window.
I tried the following:
_context.Entry(_context.Kunde.Find(Key)).Reload()
This code forces the dbcontext to update the changed entry. But the changes are not reflected in the grid. I tried to call the Refresh() method of the QueryableCollectionView, but the grid still show's the old values.
How can i force the grid to show the changes made in the dbcontext?