I'm trying to get an editable grid with a DataSource provided by a WCF Service.
I can get an editable grid when the source is provided by a generic list, using the techniques shown in the Introduction Tutorial video. However, when I change the DataSource assignment line, and replace it with my Service code call, the grid is correctly populated with data, however the cells are no longer editable.
My XAML code is unchanged for both scenarios, and is as follows:
UserControl x:Class="TestGrid.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:dxxmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="740" Height="330" BorderBrush="Black" BorderThickness="3" >="clr-namespace:DevExpress.Windows.Controls;assembly=DevExpress.AgDataGrid.v8.2
<Grid x:Name="LayoutRoot" Background="White">
<dx:AgDataGrid x:Name="mygrid" >
<dx:AgDataGrid.Columns></dx:AgDataGrid.Columns>
</dx:AgDataGrid>
</Grid>
</UserControl>
Very straight forward, nothing unusual. Note: I seem to have to specify the columns manually when binding from a Service, but that isn't really a problem for me - although it isn't shown above.
My CS code for the generic list (which works properly) is as follows:
public Page()
{
InitializeComponent();
mygrid.DataSource = Persons.GetAllPersons();
}
And when I change it to the service provided data source, the CS code becomes:
public Page()
{
InitializeComponent();
Service1Client servClient = new Service1Client();
servClient.GetAllRecordsCompleted += new EventHandler<GetAllRecordsCompletedEventArgs>(servClient_GetAllRecordsCompleted);
servClient.GetAllRecordsAsync();
}
void servClient_GetAllRecordsCompleted(object sender, GetAllRecordsCompletedEventArgs e)
{
mygrid.DataSource = e.Result;
}
As I say, the data shows up just fine, but none of the fields are editable. I have tried setting the AllowEditing flag for the grid as well as columns, in both the XAML and CS code.
What do I need to do to get this grid to be editable?