これは、DevExpess XtraGrid の GridView に関連しています。
drilldown plus icon (+)
ChildRow のデータを持たない GridView の MasterRow からを削除する必要があります。
現在、GridView のすべての行 (MasterRows) にdrilldown plus icon (+)
. をクリックするdrilldown plus icon (+)
と、ChildRow が適切なデータとともに表示されます。ただし、ChildRow にデータがない場合、ChildRow は表示 (展開) されません。drilldown plus icon (+)
ChildRow にデータがない場合にユーザーに表示されないように、非表示にする必要があります。
ChildRow でデータが使用可能かどうかを確認する関数があり、ChildRow を表示 (展開) するかどうかを許可します。
私は使用GridView.OptionsView.ShowDetailButtons
しましたが、それはdrilldown plus icons (+)
すべての行を非表示にします。ChildRow のデータがない場合にのみ非表示にする必要があるため、これはうまくいきません。
これが私がこれまでに持っているコードです:
private void gridView1_MasterRowGetRelationCount(object sender, MasterRowGetRelationCountEventArgs e)
{
e.RelationCount = 1;
}
private void gridView1_MasterRowEmpty(object sender, MasterRowEmptyEventArgs e)
{
e.IsEmpty = IsRelationEmpty(e.RowHandle, e.RelationIndex);
}
bool IsRelationEmpty(int rowHandleX, int relationIndex)
{
Tuple<string, double, double> row = (Tuple<string, double, double>)gridView1.GetRow(rowHandleX);
return rowHandleX == DevExpress.XtraGrid.GridControl.InvalidRowHandle || _tfs._dataDictionary[row.Item1.ToString()].Item2.Count == 0;
}
private void gridView1_MasterRowGetChildList(object sender, MasterRowGetChildListEventArgs e)
{
if (IsRelationEmpty(e.RowHandle, e.RelationIndex))
{
return;
}
Tuple<string, double, double> row = (Tuple<string, double, double>)gridView1.GetRow(e.RowHandle);
e.ChildList = _tfs._dataDictionary[row.Item1.ToString()].Item2.ToList(); // _tfs.DictionaryToList();
}
private void gridView1_MasterRowGetRelationName(object sender, MasterRowGetRelationNameEventArgs e)
{
e.RelationName = "Work Items with no Size Estimate:";
}
方向性や提案は大歓迎です。
前もって感謝します、
マーワン (^_^)