Search This Blog

Thursday, June 15, 2017

The recommended approach to hiding the 'Protected Content' columns and Property Editors is improved - YOUR FEEDBACK IS NEEDED!


I have recently updated the HideProtectedContentController code in the How to: Hide the 'Protected Content' Columns in a List View and Property Editors in a Detail View topic. The main change is that the HideProtectedContentController now checks if a visibility state for the target UI element is customized by existing Conditional Appearance rules before applying its own customizations.

void appearanceController_CustomApplyAppearance(object sender, ApplyAppearanceEventArgs e) {
    if(e.AppearanceObject.Visibility == null || e.AppearanceObject.Visibility == ViewItemVisibility.Show) {
        // ...
    }
}

This prevents possible conflicts with existing appearance rules.

If you are using the HideProtectedContentController code in your projects, we would greatly appreciate it if you try the updated code and share your feedback here in comments.

Please note that HideProtectedContentController may make a negative impact on the application performance in complex scenarios.

3 comments:

  1. Dear Dennis,
    in my solution, when I am on a ListView
    this code is never give back a "true" value
    if (View is ListView)
    {
    if (e.Item is ColumnWrapper)
    {
    ...
    }
    ...
    }

    e.Item is an instance of {DevExpress.ExpressApp.Win.Editors.GridViewRowCellStyleEventArgsAppearanceAdapter} class.

    do you have any suggestion for me?
    Thank you in advance
    David

    ReplyDelete
    Replies
    1. It happens in my custom class derived from SecuritySystemUser

      public class MyUser : SecuritySystemUser, IMyUser, IMyPersistentBase, IOperationPermissionProvider, IResource
      {
      ...
      }

      Delete
    2. We tested this scenario, but could not replicate this behavior locally. Would you please attach your problematic project in a ticket submitted using the https://www.devexpress.com/ask service?

      Delete