Ok... I've searched this topic and found a lot of posts on related tasks, but nothing seems to help me get the buttons showing up in my grid...
I'm using some combination of the following code in my InitializeRow event handler:
Dim editor1 As New UltraTextEditor Dim button1 As New EditorButton button1.Appearance.Image = My.Resources.lock editor1.ButtonsLeft.Add(button1) e.Row.Cells("images").EditorComponent = editor1
This may be a terribly inefficient way to go about this, but I'm not concerned with that until I get the buttons to actually show up! My desire is to get multiple buttons (3 to 5 max, but any combination of those 3 to 5 buttons can be in each cell). I've got a "buttons" column in the grid... currently bound to a string column in the datatable but all values are empty. I may make this an unbound column later but with the hierarchical nature of my grid, leaving it bound for now is easier.
I can't find a combination of properties that makes the buttons visible. Everything I've read says they should be showing up, but they are not. I've seen grids that do this so I'm fairly sure it's possible.
Any ideas on what I'm missing?
Use the InitializeLayout event, and reference the column.
Dim editor1 As New UltraTextEditor Dim button1 As New EditorButton button1.Appearance.Image = My.Resources.lock editor1.ButtonsLeft.Add(button1) ultraGrid1.DisplayLayout.Bands(0).Columns("images").Row.Cells("images").EditorComponent = editor1
Forgive any mistake in my VB syntax, I've spent the last 5 years in C# land.
My concern with this method is that it will only allow me to show the same buttons in every cell in that column. I need to control which buttons display at a row level, so I'm looking to put this code in the InitializeRow() event handler.
I did try the code above though and still didn't see the button show up in the grid on band 0 (I have 5 or 6 bands, but applied the editor only to band 0 just as a test. I can't see what setting might be causing the buttons to not be visible.
It's a bound column that is empty. I don't know if that'll affect anything. I made the grid editable and verified it by going to the cell that I want to show buttons and put it into edit mode, so I know it can be done. I've got two grids I'm trying to use this on... one is a single band and the other has child bands. The common feature is that there are column groups.
I'll summarize what I'm doing and maybe you can find the hole in my logic... to keep things simple... I'm doing all my testing in the grid that has only one band and I've added an unbound column that's in the first group. If I don't add it to a group I can't see it.
In the IntializeLayout() event of the grid, I have: Dim column As UltraGridColumn = Me.ugMeasures.DisplayLayout.Bands(0).Columns.Add("imagesUnbound") column.DataType = GetType(String) column.CellAppearance.ImageHAlign = Infragistics.Win.HAlign.Center column.CellAppearance.ImageVAlign = Infragistics.Win.VAlign.Middle
In the InitializeRow() event of the grid, I have: Dim editor1 As New UltraTextEditor Dim button1 As New EditorButton button1.Appearance.Image = My.Resources.lock editor1.ButtonsLeft.Add(button1) e.Row.Cells("imagesUnbound").EditorComponent = editor1
I have a SetupGrid routine that is called when the datasource is set... here are the settings in that function that may have some affect on this situation (all in a With ugMeasures block).SyncWithCurrencyManager = False .DisplayLayout.MaxBandDepth = 5 .DisplayLayout.Override.HeaderClickAction = HeaderClickAction.Select .DisplayLayout.Override.SelectTypeCol = SelectType.None .DisplayLayout.Override.SelectTypeCell = SelectType.Single .DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False .DisplayLayout.CaptionVisible = Infragistics.Win.DefaultableBoolean.False .DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.Vertical .DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.CellSelect .DisplayLayout.Override.SelectTypeRow = SelectType.Single .DisplayLayout.Override.AllowColSizing = AllowColSizing.Synchronized .DisplayLayout.Override.BorderStyleRow = UIElementBorderStyle.Solid .DisplayLayout.Override.BorderStyleCell = UIElementBorderStyle.Solid .DisplayLayout.Override.GroupByColumnsHidden = Infragistics.Win.DefaultableBoolean.True .DisplayLayout.Override.GroupByRowExpansionStyle = Infragistics.Win.UltraWinGrid.GroupByRowExpansionStyle.Disabled .DisplayLayout.Override.RowSizing = Infragistics.Win.UltraWinGrid.RowSizing.Fixed .DisplayLayout.Override.AllowGroupSwapping = Infragistics.Win.UltraWinGrid.AllowGroupSwapping.NotAllowed .DisplayLayout.ColumnChooserEnabled = Infragistics.Win.DefaultableBoolean.True .DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.True .DisplayLayout.Override.RowSelectorHeaderStyle = RowSelectorHeaderStyle.ColumnChooserButton .DisplayLayout.Override.AllowUpdate = DefaultableBoolean.True
There are other various settings to add each column to its respective group and to setup visual aspects of each column (all color/border stuff, nothing that would affect the functionality of the grid).
I've tried your recommendation of setting the grid to allow updates, etc. Nothing is making these buttons show up.
Anything I posted look like it could be the culprit?
Thanks!
UGH... finally found the culprit... I wrote up a C# test application with the code I pasted above and it worked fine... so I started looking at other seemingly-unrelated areas of the program. I had a logic error earlier in the RowLayout where it was SUPPOSED to be setting the Editor property of fields that have % values in them to a %-formatted Editor. It was, however, setting this editor to all non-$ cells, including the images column... it didn't manifest in my grid visually because I was setting the $ cells editor later (overwriting the incorrect % editor).
Apparently if the cell.Editor property is set... setting the cell.EditorComponent property later won't work as expected.
Thanks for your help guys... I bet it's frustrating to try to fix problems with systems where you can only see what the programmer thinks is related :)
Rocky
Hi Rocky,
The Editor property on the column will override the EditorComponent. So that explains it.
ok, here's a follow-up question... I have the buttons in and they look great... I've set the appearance of the EditorButton to use a transparent background color and I'm using the Office2007ScrollBarButton button style so they look almost just like images. Here's a pic...
So long as the mouse is not hovering over the cell that contains the images, they look great. If I hover over that cell, however, I get a sort of hottrack on the editorbutton:
The EditorButton is applying a mouseover appearance setting and I can't find any way to override it. Any ideas? Not the end of the world but I'd like to make it so that hovering over the cell or button doesn't visually change it. However, I can't cancel the mouseenterelement event as I'm using that for tooltips on the editor buttons.
On an unrelated note... I'm having trouble reusing appearance objects on the EditorButtons. To setup the appearance changes to the editorbutton, I'm using the following code every time I add a button to the editor that is assigned to the cell: If CBool(.GetCellValue("notes")) Then editorbutton = New EditorButton editorbutton.ButtonStyle = UIElementButtonStyle.Office2007ScrollbarButton editorbutton.Appearance.BackColor = Color.Transparent editorbutton.Appearance.Image = My.Resources.note editorbutton.Tag = "One or more notes were found for this account." textEditor.ButtonsLeft.Add(editorbutton) End If
The part in bold is my problem... I've tried adding an appearance to the appearances collection of the grid and then assigning the appearance like this: editorbutton.Appearance = ugMeasures.DisplayLayout.Appearances("NotesImageNotesFound")
This doesn't do anything. The only way I've been able to apply appearance settings to the appearance of the EditorButton is to do it manually, which is not ideal. I can deal with this though and do the cleanup, but if there's a way to do it the correct way (reusing appearance objects), I'd like to do it that way.
Thanks again for your help!
DamnRock said:The EditorButton is applying a mouseover appearance setting and I can't find any way to override it. Any ideas? Not the end of the world but I'd like to make it so that hovering over the cell or button doesn't visually change it. However, I can't cancel the mouseenterelement event as I'm using that for tooltips on the editor buttons.
My guess is that this is caused by the button's DisplayStyle. The Office2007ScrollBarButton style is not really intended to be used, except for Scrollbar buttons. There is a probably another style on the list that will give you want you want without the hotracking.
If not, then the HotTracking background color must be coming from something in the code or maybe an isl file.
DamnRock said: The part in bold is my problem... I've tried adding an appearance to the appearances collection of the grid and then assigning the appearance like this: editorbutton.Appearance = ugMeasures.DisplayLayout.Appearances("NotesImageNotesFound") This doesn't do anything. The only way I've been able to apply appearance settings to the appearance of the EditorButton is to do it manually, which is not ideal. I can deal with this though and do the cleanup, but if there's a way to do it the correct way (reusing appearance objects), I'd like to do it that way.
This looks like it should work, assuming you are setting the properties on the Appearance object correctly when you create it.
The appearance might be overriden by Themes. But if that were the case, then setting properties directly on the editorButton.Appearance would not behave any differently. And the same is true of AppStyling.