Raise an event in Form when the Form Window is Maximized.

1 Answer 1003 Views
Form GridView
Shubham
Top achievements
Rank 1
Iron
Shubham asked on 23 Dec 2021, 12:39 PM | edited on 23 Dec 2021, 01:11 PM

Hi ,

I am using a RadGridView along with a button in a Form window. When button is clicked , it shows some hidden rows in RadGridView.

I want the hidden rows to be showed when the Form window is maximized.
How do I go on about doing this?

This is how I am trying it:


If Me.WindowState =2 Then

'Raise an event here


thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 23 Dec 2021, 01:46 PM
Hello, Shubham,

In order to detect when the form is maximized, you can subscribe to the SizeChanged event and check the WindowState:
        public RadForm1()
        {
            InitializeComponent();

            this.SizeChanged+=RadForm1_SizeChanged;
        }

        private void RadForm1_SizeChanged(object sender, EventArgs e)
        {
            if (this.WindowState == FormWindowState.Maximized)
            {
                //ToDo
            }
        }

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

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Shubham
Top achievements
Rank 1
Iron
commented on 23 Dec 2021, 02:16 PM | edited

Hi Dess,

Thanks for the response.

I have achieved what i wanted to do.
I have to handle Resize event of the Window.

Really appreciate the help.

Dess | Tech Support Engineer, Principal
Telerik team
commented on 24 Dec 2021, 05:29 AM

Hi, Shubham,

One possible solution is to create a method that extracts the code inside the RadButton.Click event handler. Thus, you can call the method inside the Click event or when the form is maximized. Another approach is to force the button clicking by calling the PerformClick method:

this.radButton1.PerformClick();

Feel free to use this approach which suits your requirements best.

Tags
Form GridView
Asked by
Shubham
Top achievements
Rank 1
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or