I should show datagrid in diagram for the work which I study on it.
I created a new class which inherits BaseNetworkGraphObject class.I am creating a grid at constructor with bindings as below. At .cs side, after I set my list to itemsource, I added the grid on diagram.But the grid does not come with columns which I define with bindings.
I should do binding for datagrid dynamically at code.I wrote the code as below. When I debug this code block ,it seems that it does bindings correctly, but grid comes with no columns on form.
GridClass side :
MyClass myInstance=new MyClass ();
dataGridObject.Width = 200;
dataGridObject.Height = 200;
binding = new Binding();
binding.Source = myInstance;
foreach (PropertyInfo prop in myInstance.GetType().GetProperties())
binding.Path = new PropertyPath(prop.Name);
DataGridTextColumn column=new DataGridTextColumn();
column.Header = prop.Name;
var model = this.objectDiagram.Model as GraphLinksModel<BaseNetworkGraphObject, string, string, BaseNetworkGraphLink>;
model.Modifiable = true;
model.HasUndoManager = true;
GridObject gridObject = new GridObject();
gridObject.DataGridObject.ItemsSource = e.Result;
gridObject.Key = “Key”;
gridObject.Nodetype = “NodeTemplateForGrid”;
objectDiagram.Model = model;
Why does’t come grid with columns, although I did necessary bindings?
There is another question I want to ask , I declared a nodetemplate which includes datagrid control.At MyClass, I am creating a datargid object according to the related table object.I bind DataGridObject.ItemsSource to Itemsource property at grid control ?Is there any other binding which should be declared?
Thanks for the replies in advance…