Hello,
I'm using an UltraGrid containing a column with a boolean value. I want to change the style of the checkbox displayed in this column. I defined this style in an isl file designed using AppStylist application.
This works fine except if I want to change the checkBoxGlyphInfo property of the checkbox. Then nothing is changed in my grid. I tried to place a checkbox outside of my grid and then the style I defined with the checkBoxGlyphInfo property is applied to this checkbox.
Am I doing something wrong?
Hi,
You lost me. Are you talking about setting the CheckBoxGlyphInfo property in code or in the isl file?
Are you saying that the grid is displaying the checkboxes as you want them but you want to use a different style for UltraCheckEditor controls outside of the grid?
If you want to change the checkbox glyphs for your whole application, then you can do this in the Isl file and you do not have to set any properties in code.
Sorry if I am not clear enough. I already changed the checkbox glyphs in the isl file. The style of the checkbox outside of the grid if changed according to the glyph defined in the isl file, but this doesn't work for the checkbox that is contained in the grid.
I have attached a simple prototype to this message.
Okay, so the isl file you have here is applying the glyphs to the UltraCheckEditor component role. So that will only affect that one control and no others.
If you want to change the glyphs in the entire application, you should use the "All Components" role instead.
You could also be more selective, by going to the UltraGrid component role and changing the CheckBoxGlyphInfo there.
A third option would be to assign the UltraCheckEditor control to the grid column:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { this.ultraCheckEditor1.Text = string.Empty; this.ultraCheckEditor1.CheckAlign = ContentAlignment.MiddleCenter; e.Layout.Bands[0].Columns[0].EditorComponent = this.ultraCheckEditor1; }
Thanks. I changed the CheckBoxGlyphInfo for the UltraGrid and it works fine.
I have another question related to this topic. To display a checkbox in the header of the UltraGrid, I use a CreationFilter as explained here: http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=4883. I don't understand how I can define the style for the CheckBoxUIElement displayed in the header. Is it possible to define the CheckBoxGlyphInfo for this element?
What version of the controls are you using? That article is out of date. We added inherent support to the grid for CheckBoxes in the column headers a few releases ago.
If you are using the latest version, you can turn on the header CheckBoxes with a few simple property settings and they should pick up the grid's GlyphInfo settings from the isl file automatically.
You're right, I was using a more complex way to display checkbox in the header. So now I define the CheckBoxVisibility of the header and the checkbox is displayed in the header without workaround.
However, the style is not applied automatically. I also tried to define the StyleLibraryName of the header (because I actually want a different style for the header content) like this in the InitializeComponent() method of my control without success:
appearance2.StyleLibraryName = "customStyle";ultraGridColumn37.Header.Appearance = appearance2;
Note that I load the style in the constructor of the control like this:
const string styleIslFile = "SingleInjectionsTable.gridStyle.isl"; StyleManager.Load(Assembly.GetExecutingAssembly().GetManifestResourceStream(styleIslFile ), true, "customStyle");
What am I doing wrong?
Now that I think about it, even when you are using the workaround, I would think that the CheckBoxUIElements would pick up the grid's GlyphInfo. If that's not happening, something is wrong.
So I tried this out in AppStylist. I created a new Style Library and set the CheckBoxGlyphInfo on the grid and then I went to the grid canvas and turned on the header checkboxes, and the glyphs apply to the cells in the grid, but not to the headers.
So then just for fun I tried applying CheckBoxGlyphInfo to the All Components role and it still doesn't apply.
So it looks like something is wrong here. I'm going to forward this over to Infragistics Developer Support and ask them to write this up for developer review.
I am submitting this as a development issue. You will receive more information through the support case.
Thanks Chris. It works.
Thank you for the sample. For some reason, toggling the HeaderCheckBoxVisibility worked in my sample but not in yours. I apologize for that. Instead, toggle the HeaderCheckBoxSynchronization property between None and Default. This definitely will trigger the synchronization process, and it makes more sense to use that property anyways. I verified this workaround in the sample you provided, and it updated the HeaderCheckBox state successfully.
Let me know if I can be of further assistance.
Chris.
Are you sure this workaround (using HeaderCheckBoxVisibility) works? I tried it in my application and in a prototype and the header checkbox is not upated.
I attached the prototype to this message.
It doesn't look like there is a workaround for the HeaderCheckBox - Glyph issue at this time.
In regards to your final issue, I took a brief look at the involved code. It appears the synchronization is not triggered when you refresh the Rows. This should also be put into developer review.
As a workaround, toggling the visible state of the checkboxes (using HeaderCheckBoxVisibility) should dirty the cached values, triggering the synchronization process. If you wrap this between SuspendLayout()/ResumeLayout() calls, you can minimize any flickering of the checkbox.
Hopefully this helps.
Chris