This is a migrated thread and some comments may be shown as answers.
Conditional Formatting Rules Manager
1 Answer 10 Views
This is a migrated thread and some comments may be shown as answers.
Sagar
Top achievements
Rank 1
Sagar asked on 05 Jun 2020, 06:59 AM

Hi,

We have used a Telerik RadGridView in our Windows Application.

On specific form user has a option to right mouse click and open conditional formatting

then user gets a popup window of Conditional Formatting Rules Manager. 

In that Rules Manager window - we can see some properties under Format section such as CellBackColor and RowBackColor.

for these very particular options CellBackColor and RowBackColor we have set some standard color from code and want to keep it as a standard

thus want to prevent user to go and edit these properties and change the color to something else. 

So is it possible to completely disable to edit/hide these options (CellBackColor and RowBackColor) from code, so end user could not change it ?

Please find attached image of Rules Manager.

 

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Sr.
Telerik team
answered on 09 Jun 2020, 09:57 AM

Hello, Sagar, 

In order to disable the CellBackColor and RowBackColor options in the conditional formatting dialog, it is necessary to handle the ConditionalFormattingFormShown event and access the property grid that is used in the Format section. Then, disable these particular items in the RadPropertygrid.ItemFormatting event. 

        public RadForm1()
        {
            InitializeComponent();
            this.radGridView1.ConditionalFormattingFormShown += radGridView1_ConditionalFormattingFormShown;
        }

        private void radGridView1_ConditionalFormattingFormShown(object sender, EventArgs e)
        {
            ConditionalFormattingForm form = sender as ConditionalFormattingForm;
            RadPropertyGrid propertyGrid = form.Controls["radPropertyGridProperties"] as RadPropertyGrid;
            if (propertyGrid != null)
            {
                propertyGrid.ItemFormatting -= propertyGrid_ItemFormatting;
                propertyGrid.ItemFormatting += propertyGrid_ItemFormatting;

                propertyGrid.Editing -= propertyGrid_Editing;
                propertyGrid.Editing += propertyGrid_Editing;
            }
        }

        private void propertyGrid_Editing(object sender, PropertyGridItemEditingEventArgs e)
        {
            if (e.Item.Label == "CellBackColor" || e.Item.Label == "RowBackColor")
            {
                e.Cancel = true;
            }
        }

        private void propertyGrid_ItemFormatting(object sender, PropertyGridItemFormattingEventArgs e)
        {
            if (e.Item.Label == "CellBackColor" || e.Item.Label == "RowBackColor")
            {
                e.VisualElement.Enabled = false;
            }
            else
            {
                e.VisualElement.Enabled = true;
            }
        }

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Asked by
Sagar
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Sr.
Telerik team
Share this question
or