I have a user control that allows the user of the application to select which users are allowed to purchase an amount of a set of products. A grid then is populated with the list of users selected as columns and the products are each a row in that grid. The problem that I have is that the WCF service contains the underlying object with a List of User objects so whenever I try and edit the amount for that user, the grid won't allow me to exit the cell editor. I think this is due to the fact that the grid does not auto generate its fields.
Is there a way where I can set define the columns in real time and then refresh the columns displayed after a user hits a button? Below is a simple example of the hack where I hard-code in the properties.
WPF:
<Window x:Class="XamTreeView.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="XamTreeView" Height="600" Width="600"
xmlns:local="clr-namespace:XamTreeView"
xmlns:igDP="http://infragistics.com/DataPresenter">
<Grid x:Name="gridContainer">
<igDP:XamDataGrid x:Name="grd" GroupByAreaLocation="None" DataSource="{Binding Path=MyProductCollection}">
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings AutoGenerateFields="True" AllowRecordFixing="Top" />
</igDP:XamDataGrid.FieldLayoutSettings>
</igDP:XamDataGrid>
</Grid>
</Window>
C#:
public partial class Window1 : Window
{
public MyContext Cntx { get; private set; }
public Window1()
InitializeComponent();
MyContext ctx = new MyContext();
ctx.Initialize();
this.Cntx = ctx;
this.gridContainer.DataContext = Cntx;
}
public class MySimpleProduct
public string ProductName { get; set; }
// These should come from a dictionary<String, double>...
public double AdamBought { get; set; }
public double BobBought { get; set; }
public MySimpleProduct(string productName, double adamBought, double bobBought)
this.ProductName = productName;
this.AdamBought = adamBought;
this.BobBought = bobBought;
public class MyContext
public List<MySimpleProduct> MyProductCollection { get; set; }
public void Initialize()
this.MyProductCollection = new List<MySimpleProduct>();
this.MyProductCollection.Add(new MySimpleProduct("Toys", 100, 10));
this.MyProductCollection.Add(new MySimpleProduct("Houses", 90, 0));
Any ideas?
Hi,
I created a sample from your code but I’m not seeing any issues with not being able to edit cells in the grid.
I’m using NetAdvantage for WPF 2011 vol. 1 version 11.1.20111.1004.
If you could modify my sample so that it duplicates the behavior you are seeing and reattach it to the forum thread, I’ll be happy to look into it further.
I don’t know if you’ve had an opportunity to review my sample.
Please let me know if there is anything further that I can help you with regarding this question?