Hi all,
I'm trying so apply selected and active cells appearance in a way that selected cells have backcolor and forecolor. The active cell should have no color, only a thick black border. Some cells have some meaningfull backcolor and I like to see theses backcolor for the active cell (not for selected cells). I have tried to achieve this with the following code at Initialize_Layout event:
// Default-Appearance für selected Cells e.Layout.Override.SelectedAppearancesEnabled = DefaultableBoolean.True; e.Layout.DefaultSelectedBackColor = ClientParam.Instance.ParamColors.GetColor(Color.LightGrey ); e.Layout.DefaultSelectedForeColor = ClientParam.Instance.ParamColors.GetColor( Color.Black ); e.Layout.Override.SelectedCellAppearance.BorderColor = Color.White; e.Layout.Override.SelectedCellAppearance.BorderColor2 = Color.White; // Default-Appearance for active cells e.Layout.Override.ActiveAppearancesEnabled = DefaultableBoolean.True; e.Layout.Override.ActiveCellAppearance.BackColor = ClientParam.Instance.ParamColors.GetColor( Color.Transparent ); e.Layout.Override.ActiveCellAppearance.ForeColor = ClientParam.Instance.ParamColors.GetColor( Color.Empty ); e.Layout.Override.ActiveCellAppearance.FontData.Bold = DefaultableBoolean.True; e.Layout.Override.ActiveCellAppearance.BorderColor = Color.Black; e.Layout.Override.ActiveCellBorderThickness = 3
The active cell looks LightGrey with forecolor = black and I can not see the cells backcolor and forecolor.
Does anybody has some directions for me?
Thank you and best regards
Markus
Markus,
Have you tried setting ActiveAppearancesEnabled to "DefaultableBoolean.False"? It is true that this will prevent you from being able to set the font of the text of the ActiveCell to "Bold" in the InitializeLayout event, but you could set it in the BeforeCellActivate event and then set it back to normal in the BeforeCellDeactivate event. Could you try that and let me know if this enables you to achieve what you want?
Hello Michael,
I have tried your approach but it does not solve the problem that the active cell should have NO backcolor. Selected cells can have backcolor. My cells can have different backcolors and fore colors and users should see these colors of the active cell (see attached picture). For selected cells I can accept a special selected colors.
I have tried set the Backcolor of the active cell to Color.Transparent, but the cell still has a background color. Maybe I have some influence from style set I'm using for my application but I have to remove settings from the for the active cell. I have also attached my style set file.
I have also tried setting the SelectionOverlay-properties but this does not allow select multiple block of cells and it is not possible to select cells in over band borders.
Do you have another idea to solve my requirements?
Best regards
I have attached a sample application which incorporates the approach that I suggested and it seems to me that it does what you have described. Run the application in Visual Studio and you will see a grid that has been bound to a DataTable and the cell in the "City" column in the sixth row which contains the name "Mannheim" shows a BackColor of LightGreen and a ForeColor of DarkGreen. If you click into that cell and thereby activate it I think you will still see those colors. But if you click on the RowSelector for that row then the whole row will turn grey which signifies that the row was selected. Isn't that what you wanted? Have I misunderstood?
unfortunately I can not open your sample since I use VS2010 / NetAdvantage 12.2.20122.2061. Sorry, I did not mentioned that.
But in between I have found a solution using your BeforeCellActivate / BeforeCellDeactivate approach. Instead try setting NO color as the active cell backcolor, I set the backcolor to the color the cell currntly has and similar the forecolor. This works for me so far.
One last question: Users can configure the selected cells color. Alternatively I have tried to set red borders to selected cells, but only the left border appears red. To see all borders red I have to increase the cell margings but this looks bad. Is there a property to make all borders appears red? Border priority of selected cells or something like this?
Regards
I have found some properties to show cell borders for selected cells around each cell. Not perfect but ok.
e.Layout.Override.BorderStyleRow = UIElementBorderStyle.None; e.Layout.Override.BorderStyleCell = UIElementBorderStyle.Solid;
As you see (attached pic) the upper and right border are not visible.
Reagrds