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
685
Chang Property on Cell Edit
posted

I'm trying to change cell appearance when it goes into edit mode.

I've set these properties at the grid level.

grid.DisplayLayout.Override.CellClickAction = CellClickAction.Edit;
grid.DisplayLayout.Override.EditCellAppearance.BackColor = CellEditColor;

It's entering edit mode, but it's not changing the back color.

What am I doing wrong?

  • 1700
    Offline posted

    Hello Sean,

    I have created a small sample trying to reproduce the described behavior. I am using  UltraGrid with version 22.1 and changing the appearance of the cell in edit mode inside the InitializeLayout event. On my side everything works as expected and appearance of the cell is changing every time the user enters edit mode. The code for the event is the following:

     

     private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
            {
                var layout = e.Layout;
                var band = layout.Bands[0];
                var ov = layout.Override;
                ov.EditCellAppearance.BackColor = Color.Crimson;
                ov.EditCellAppearance.ForeColor = Color.White;
    
            }

    What might be causing the issue is using a style for your application/grid that has already specified the EditCellAppearance. If that is the case, then there are few approaches that you can take.

    The first one is to modify the style directly. Open the theme with the AppStylist. Hoover with the mouse over the grid’s cell and when Role Selection tooltip is shown press “1”. This should open the GridCell element properties (you can also go to Style Explorer -> Roles -> UI Roles -> Base -> Cell -> GridCell). Select “Other States” tab in Properties window. Select Edit mode and apply the appearance you need.

    If you have more than one grids using this style and you would like to apply this change to only a certain grid then you can also create a copy of this style apply the changes mentioned above and set the newly created theme to this grid only by setting the StyleSetName property of the grid.

    The last suggestion is to change the ResolutionOrder property of the style to ControlThenApplication, it would use the control properties first and then the properties of the application style. To change it navigate to the Style Explorer select under Component And Role Settings the component you need to set the ResolutionOrder (you can choose All Components or UltraGrid depending on your application scenario). Then in Common Component Properties find and set the ResolutionOrder property. Please note that if you have some properties set that  were previously overridden by the theme that the grid was using, they would applied with priority, so you would need to make sure that there aren’t any unnecessary properties set that would alter your desired style.

    Attached you will find my sample for your reference. Please test it on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me along with steps to reproduce. Alternatively, if the behavior cannot be replicated, please feel free to provide your own sample. Remove any external dependencies and code that is not directly related to the issue, zip your application and attach it in this case.

    Having a working sample on my side, which I can test and debug, is going to be very helpful in finding the root cause of this behavior.

    Thank you for your cooperation. 

    Looking forward to hearing from you.

    Regards,
    Ivan Kitanov

    AppStylistControlThenThemeStyle.zip