Dagatrid View Row header glyph

Welcome to Wisej Support.
Questions, suggestions and plain old bugs - are all welcome here!
Answered
0
0

Hi

Is it possible to programmatically change the Row Header Glyph so that the DGV shows when a row is being edited or not?

It does not always show the correct Glyph. Usually in the case when the row edit is initiated by a custom data grid view cell

If so how?

Thanks

Ewan

  • Ewan Walker
    There does not seem to be a way of overriding the default image. I can get the image I want to display, however it is superimposed over the default.
  • You must to post comments
Great Answer
0
0

The mixin works well once you move the “table-row-header” appearance in appearances and place it in \Themes.

  • Themes and theme mixins must be in /Themes (see the \Themes folder section, will link to the themes page.)
  • There are several sections: Images, Colors, Fonts and Appearances. Visual appearances go in “appearances”:{}
  • You don’t need to replicate the entire appearance key, see simpler version below. You can inherit form the active theme to keep the flexibility of changing the main theme, and just override what you need:
{
 "name": "Application.mixin",
  "appearances": {
    "table-row-header": {
     "inherit": "table-row-header",
     "states": {
       "focused": {
         "styles": {
           "backgroundImage": null
         }
      },
      "new": {
        "styles": {
            "backgroundImage": null
        }
      },
      "new-selected": {
        "styles": {
           "backgroundImage": null
        }
      },
      "editing": {
        "styles": {
            "backgroundImage": null
          }
        }
      }
    }
  }
}

 

  • You must to post comments
0
0

I can’t get the following mixin to work which should not show the row header glyphs.

I have uncommented

// Add the WisejResources attribute to
// merge js and css embedded resources with the wisej package.
[assembly: Wisej.Core.WisejResources(ExcludeList: “”)]

Mixin is as below and is in the main folder not the \Themes folder

{
“name”: “Application.mixin”,
“table-row-header”: {
“states”: {
“default”: {
“styles”: {
“widthRight”: 1,
“colorRight”: “windowFrame”,
“backgroundColor”: “buttonFace”,
“backgroundRepeat”: “no-repeat”,
“backgroundPosition”: [ “center”, “right” ],
“backgroundSize”: “16px 16px”,
“fillColor”: “windowText”
},
“properties”: {
“padding”: [ 2, 2, 2, 2 ],
“textColor”: “buttonText”
}
},
“selected”: {
“styles”: {
“backgroundColor”: “table-row-background-selected”
},
“properties”: {
“textColor”: “table-row-selected”
}
},
“focused”: {
“styles”: {
//”backgroundImage”: “table-row-indicator”
},
“properties”: {
}
},
“new”: {
“styles”: {
//”backgroundImage”: “table-row-new”,
“fillColor”: “iconLight”
},
“properties”: {
}
},
“new-selected”: {
“styles”: {
//”backgroundImage”: “table-row-new”,
“fillColor”: “windowText”
},
“properties”: {
}
},
“editing”: {
“styles”: {
//”backgroundImage”: “table-row-editing”
},
“properties”: {
}
},
“rightToLeft”: {
“styles”: {
“transform”: “rotateZ(180deg)”
},
“properties”: {
}
}
},
“components”: {
“content”: {
“states”: {
“default”: {
“styles”: {
“backgroundRepeat”: “no-repeat”,
“backgroundPosition”: [ “center”, “left” ],
“backgroundSize”: “20px”
},
“properties”: {
“padding”: [ 0, 2, 0, 2 ]
}
}
}
},
“error”: {
“states”: {
“default”: {
“styles”: {
“backgroundImage”: “icon-error”,
“fillColor”: “invalid”,
“backgroundRepeat”: “no-repeat”,
“backgroundPosition”: [ “center”, “center” ],
“backgroundSize”: “16px”
},
“properties”: {
“padding”: [ 0, 8, 0, 8 ]
}
}
}
}
}
}
}

Thanks for your hekp

Ewan

  • You must to post comments
0
0

Hi Luca

The image does not show unless I use cell update(). Presumably the UserPaint needs set when the grid is initially populated

Could you let me know which part of the theme I would need to create a mixin for the hide the default row header glyphs

Many thanks for you help

Ewan

 

  • You must to post comments
0
0

Hi Luca

The image does not show unless I use cell update(). Presumably the UserPaint needs set when the grid is initially populated

Could you let me know which part of the theme I would need to create a mixin for the hide the default row header glyphs

Many thanks for you help

Ewan

 

  • Luca (ITG)
    UserPaint and BackgroundImage are not related. We don;’t use any user painting. UserPaint is only to enable the CellUserPaint event for your code to draw inside a cell.
  • Luca (ITG)
    Look in “table-row-header”, there are the states: focused, new, selected, new-selected that set the background-image style (css class, not property).
  • You must to post comments
0
0

The background image is correct. The row header is too narrow.

The paint event is fired when UserPaint is on and in the code you attached it’s turned on probably too late.

The call to cell.Update() is not needed.

 

  • You must to post comments
0
0

Hi Luca

The code I an using is as below as the paint event does not fire when I need it to. In the attached image the Edit Glyph is superimposed over the select Glyph

  private void dgvOfficeStaff_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (!Loading && !Saving && e.ColumnIndex < 5)
{
dgvOfficeStaff[5, e.RowIndex].Value = false;
RowChanged = e.RowIndex;
CanExit = false;

dgvOfficeStaff.Rows[e.RowIndex].HeaderCell.UserPaint = true;
dgvOfficeStaff.Rows[e.RowIndex].HeaderCell.Style.BackgroundImageLayout = Wisej.Web.ImageLayout.BestFit;
dgvOfficeStaff.Rows[e.RowIndex].HeaderCell.Style.BackgroundImageSource = “table-row-editing”;
dgvOfficeStaff.Rows[e.RowIndex].HeaderCell.Update();

   }
}
Attachment
  • You must to post comments
0
0

It can be changed (or disabled) in a theme or theme mixin. The header cell background image is supposed to show in addition to the current/editing indicator.

I can’t reproduce the issue you mentioned, can you attach a test case?

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.