Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
505
can these inline code settings be moved to design-time
posted

Hello,

I would like to now if these settings in the following inline code can be done at design-time.

private void ultraGrid1_InitializeLayout( object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e )
{
 e.Layout.Override.CellAppearance.BorderColor = Color.Gainsboro;
 e.Layout.Override.RowAppearance.BorderColor = Color.Black;
 e.Layout.Bands[ 0 ].Columns[ e.Layout.Bands[ 0 ].Columns.Count - 1 ].Hidden = true;  // I tried to set this in grid designer, then I cannot use this column to do the sorting in Form Load (it's column5).
.......
}

 // I couldn't find the SortedColumns in grid property GUI in design-time. 

private void Form1_Load( object sender, EventArgs e )
{   
 this.ultraGrid1.DisplayLayout.Bands[ 0 ].SortedColumns.Add( "column0", false, false );
 this.ultraGrid1.DisplayLayout.Bands[ 0 ].SortedColumns.Add( "column5", false, false );
.......
}

 // If it can, how and where do I place the contion check? 

private void ultraGrid1_InitializeRow( object sender, InitializeRowEventArgs e )
{
 if( e.Row.Cells[ "ChangeColor" ].Value.ToString() == "TRUE" )
 {
  e.Row.Appearance.BackColor = Color.Red;
.......

}

  • 469350
    Offline posted

    Yes, all of this can be done at design-time, assuming your grid is bound at design-time and has access to the data structure. 

    Which part(s) of this are giving you trouble? The grid.DisplayLayout.Override.CellAppearance should be easy enough to find. And so should the Hidden property on the column. 

    Hiding a column has no effect on sorting. You can sort a hidden column and it will work just fine. 

    To sort a column at design-time, you have a couple of option. The easiest thing to do is to set the HeaderClickAction and then just click the column header on the grid in the form designer, just as you would do at run-time. Another option would be to set the SortIndicator property on the column.

    cpswart said:

     // If it can, how and where do I place the contion check? 

    private void ultraGrid1_InitializeRow( object sender, InitializeRowEventArgs e )
    {
     if( e.Row.Cells[ "ChangeColor" ].Value.ToString() == "TRUE" )
     {
      e.Row.Appearance.BackColor = Color.Red;

    This is a bit trickier.  You can do this using ValueBasedAppearances in the grid. This new feature was added recently (in the last couple of years) so you may not have it if you have a really old version of the grid.