Conditional Formatting Form

5 posts, 0 answers
  1. Barry
    Barry avatar
    2 posts
    Member since:
    May 2012

    Posted 24 Sep 2014 Link to this post

    How can I tell when a user has modified the Conditional Formatting of a Grid
     using the Conditional Formatting Form
  2. Chris
    Chris avatar
    5 posts
    Member since:
    Sep 2014

    Posted 25 Sep 2014 in reply to Barry Link to this post

    You can subscribe to one of these events:

    radGridView1.Columns["MyColumn"].ConditionalFormattingObjectList.CollectionChanged
    radGridView1.Columns["MyColumn"].ConditionalFormattingObjectList.CollectionChanging

    These will let you know when the conditional formatting collection has changed which doesn't happen until the user clicks apply. Also, it seems that this event is called twice as the Conditional Formatting Form clears the collection and then re-adds everything rather than add and removing objects from the collection. I have a post related to this here: How can I make conditional formatting read-only?

    I hope this helps. There may be a better way (such as subscribing to events on the Conditional Formatting Form itself) but I haven't figured out how to do this yet.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 29 Sep 2014 Link to this post

    Hello guys,

    Thank you for writing.

    @Barry
    The suggested solution by Chris is suitable to detect when you apply style formatting. You can determine whether the ConditionalFormattingObjectList is reset or a new setting is applied via the NotifyCollectionChangedEventArgs.Action argument:
    public Form1()
    {
        InitializeComponent();
        radGridView1.Columns["OrderID"].ConditionalFormattingObjectList.CollectionChanged
            += ConditionalFormattingObjectList_CollectionChanged;
    }
     
    private void ConditionalFormattingObjectList_CollectionChanged(object sender,
        NotifyCollectionChangedEventArgs e)
    {
        if (e.Action != Telerik.WinControls.Data.NotifyCollectionChangedAction.Reset)
        {
             
        }
    }

    @Chris
    I have updated your Telerik points for community effort.

    Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  5. Aref
    Aref avatar
    18 posts
    Member since:
    Sep 2015

    Posted 16 Dec 2015 in reply to Dess Link to this post

    hi, is it possible to change conditional formatting form font?
  6. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 17 Dec 2015 Link to this post

    Hello Aref,

    Thank you for writing back.

    You can subscribe to the RadGridView.ConditionalFormattingFormShown event and change the Font property for the form and all its controls:
    Font f = new Font("Arial",14, FontStyle.Italic);
    private void radGridView1_ConditionalFormattingFormShown(object sender, EventArgs e)
    {
        RadForm form = sender as RadForm;
        form.Font = f;
        foreach (Control c in form.Controls)
        {
            c.Font = f;
        }
    }
     
    I hope this information helps. If you have any additional questions, please let me know.

    Regards,
    Dess
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WinForms is Visual Studio 2017 Ready