2017-07-07 5 views
0

グリッドビューのマスターディテール行スタイルを条件によって変更したい。このような私のコード。DevExpressマスターディテール行セルスタイル

 GridView newDetailView = grdLog.CreateView("GridView") as GridView; 
     GridView View = sender as GridView; 
     gvLog.MasterRowGetLevelDefaultView += (s, e2) => 
     { 
      if (e.RowHandle >= 0) 
      { 
       for (int i = 0; i < gvLog.Columns.Count - 15; i++) 
       { 
        string strTimeKey1 = View.GetRowCellDisplayText(e.RowHandle, View.Columns[i]); 
        string strTimeKey2 = View.GetRowCellDisplayText(View.FocusedRowHandle, View.Columns[i]); 
        if (!strTimeKey1.Equals(strTimeKey2)) 
        { 
         e.Appearance.BackColor = Color.Red; 
        } 
       } 

      } 
     }; 

私の親行と詳細行は、同じ列を持っている、それは詳細行」列の値は、親行の列の値と異なる場合は、セルの色が赤になりますようにする必要があります。

答えて

0

から:MasterRowExpandedイベント が発生したときにHow To Dynamically Format Columns For A Detail View

列がすでに作成されています。このイベントを使用して、必要に応じてカスタマイズしてください。 このソリューションがお客様のニーズを満たしているかどうかをお知らせください。

は、これらのDevExpress社のスレッドを参照してください。
Style conditions conditional formatting for master and detail views
How to set row style of Detail grid records after data binded to xtragrid master-detail data Master/Detail grid with StyleFormatCondition

+0

ありがとうございました。私はそれらを試してみます。 @NiranjanKala – Mualla

関連する問題