Joe, can you please tell how I can keep the tree open after refreshing the xmlDataProvider on the xamDataGrid. I am rearranging the xmlnodes and refreshing the xmlDataProvider but the tree completely collapses after the refresh. Help me please!
Thanks!
{
//MessageBox.Show(e.ToString());
XmlNode row = dr.DataItem as XmlNode;
XmlNode prev = row.PreviousSibling;
parent.InsertBefore(newRow, prev);
parent.RemoveChild(row);
queryResponse.LoadXml(parent.OwnerDocument.OuterXml);
xdp.Refresh();
}
You got it. I was held up on that same issue. I'm pretty sure I already posted that solution a few weeks back.
I think I got it. You also need to add the relation name? That's what I did and the child rows are showing.
DataRelation dr = new DataRelation("PRODUCT_STRUCTURE_NEST", dsStructure.Tables[0].Columns["product_structure_id"], dsStructure.Tables[0].Columns["parent_id"]);
fld = new Field();
fl.Fields.Add(fld);
fld.Name = "product_structure_id";
//fld.Visibility = Visibility.Hidden;
fld.Name = "parent_id";
//theDataGrid.FieldLayoutSettings.AutoGenerateFields = false;
theDataGrid.FieldLayoutSettings.HighlightAlternateRecords = true;
//theDataGrid.FieldLayouts.Add(GetStructureFieldLayout());
theDataGrid.FieldLayoutInitialized += new EventHandler<FieldLayoutInitializedEventArgs>(theDataGrid_FieldLayoutInitialized);
void theDataGrid_FieldLayoutInitialized(object sender, FieldLayoutInitializedEventArgs e)
foreach (Field field in e.FieldLayout.Fields) { if (field.Name == "model_id" || field.Name == "serial_id" || field.Name == "product_id" || field.Name == "quantity" || field.IsExpandableResolved == true) ; else field.Visibility = Visibility.Collapsed; }
foreach (Field field in e.FieldLayout.Fields)
if (field.Name == "model_id" || field.Name == "serial_id" || field.Name == "product_id" || field.Name == "quantity" || field.IsExpandableResolved == true) ; else field.Visibility = Visibility.Collapsed;
if (field.Name == "model_id" ||
field.Name == "serial_id" || field.Name == "product_id" || field.Name == "quantity" || field.IsExpandableResolved == true) ;
field.Name == "serial_id" ||
field.Name == "product_id" ||
field.Name == "quantity" ||
field.IsExpandableResolved == true)
;
else
field.Visibility = Visibility.Collapsed;
"rodyager" wrote in message news:24037@forums.infragistics.com... No luck Joe. If I add the FieldLayout to my sample project included in this thread, the child records do not show. Worse, than that, when I add it to my actual project, I get an exception. {System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Infragistics.Windows.DataPresenter.RecordManager.f.a..ctor(FieldSortDescription A_0, f A_1) at Infragistics.Windows.DataPresenter.RecordManager.f..ctor(FieldLayout A_0, Int32 A_1) at Infragistics.Windows.DataPresenter.RecordManager.a(Record[ A_0, Boolean& A_1) at Infragistics.Windows.DataPresenter.RecordManager.v() at Infragistics.Windows.DataPresenter.DataPresenterBase.a(FieldLayout A_0) --- End of inner exception stack trace --- Here is the FieldLayout code...theDataGrid.FieldLayoutSettings.AutoGenerateFields = false; theDataGrid.FieldLayouts.Add(GetStructureFieldLayout()); private FieldLayout GetStructureFieldLayout() { FieldLayout fl = new FieldLayout(); Field fld = new Field(); fld.Name = "model_id"; fld.Label = "Model ID"; fld.Settings.AllowEdit = false; fl.Fields.Add(fld); fld = new Field(); fld.Name = "serial_id"; fld.Label = "Serial ID"; fld.Settings.AllowEdit = false; fl.Fields.Add(fld); fld = new Field(); fld.Name = "product_id"; fld.Label = "Product ID"; fld.Settings.AllowEdit = false; fl.Fields.Add(fld); fld = new Field(); fld.Name = "quantity"; fld.Label = "Quantity"; fld.Settings.AllowEdit = false; fl.Fields.Add(fld); fld = new Field(); fld.Name = "product_structure_id"; fl.Fields.Add(fld); fld = new Field(); fld.Name = "parent_id"; fl.Fields.Add(fld); return fl; } http://forums.infragistics.com/forums/p/4985/24037.aspx#24037
No luck Joe. If I add the FieldLayout to my sample project included in this thread, the child records do not show. Worse, than that, when I add it to my actual project, I get an exception.
{System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Infragistics.Windows.DataPresenter.RecordManager.f.a..ctor(FieldSortDescription A_0, f A_1) at Infragistics.Windows.DataPresenter.RecordManager.f..ctor(FieldLayout A_0, Int32 A_1) at Infragistics.Windows.DataPresenter.RecordManager.a(Record[ A_0, Boolean& A_1) at Infragistics.Windows.DataPresenter.RecordManager.v() at Infragistics.Windows.DataPresenter.DataPresenterBase.a(FieldLayout A_0) --- End of inner exception stack trace ---
Here is the FieldLayout code...
theDataGrid.FieldLayouts.Add(GetStructureFieldLayout());
private FieldLayout GetStructureFieldLayout() { FieldLayout fl = new FieldLayout();
Field fld = new Field(); fld.Name = "model_id"; fld.Label = "Model ID"; fld.Settings.AllowEdit = false; fl.Fields.Add(fld);
fld = new Field(); fld.Name = "serial_id"; fld.Label = "Serial ID"; fld.Settings.AllowEdit = false; fl.Fields.Add(fld);
fld = new Field(); fld.Name = "product_id"; fld.Label = "Product ID"; fld.Settings.AllowEdit = false; fl.Fields.Add(fld);
fld = new Field(); fld.Name = "quantity"; fld.Label = "Quantity"; fld.Settings.AllowEdit = false; fl.Fields.Add(fld);
fld = new Field(); fld.Name = "product_structure_id"; fl.Fields.Add(fld);
fld = new Field(); fld.Name = "parent_id"; fl.Fields.Add(fld);
return fl; }
No prob. I will give it a try.
Thanks! Rod