c# - How can I bind the rowheight between two DataGrids? -
i have 2 datagrids same number of rows. can row in datagrid1 has more text in , rowheight bigger in datagrid2. tried this:
(int = 0; < datagrid1.items.count; i++) { datagrid1.scrollintoview(datagrid1.items[i]); datagridrow row = (datagridrow)datagrid1.itemcontainergenerator.containerfromindex(i); binding bindingheight = new binding(); bindingheight.mode = bindingmode.twoway; bindingheight.source = row.actualheight; bindingheight.path = new propertypath(datagridrow.heightproperty); datagrid2.scrollintoview(datagrid2.items[i]); datagridrow row2 = (datagridrow)datagrid2.itemcontainergenerator.containerfromindex(i); bindingoperations.setbinding(row2, datagridrow.heightproperty, bindingheight); }
any ideas how can rows have same height?
edit: problem want bind rowheight of single row. how looks @ moment: want specific row in datagrid2 has rowheight of other row in datagrid1. e.g. row id 12940 + rm in datagrid2 has same height row in datagrid1.
you should define binding in xaml: rowheight="{binding elementname=m_datagrid1, path=rowheight}"
or if want bind in code behind:
m_datagrid2.setbinding(datagrid.rowheightproperty, new binding("rowheight") { source = m_datagrid1 });
Comments
Post a Comment