1

I have a RadgridView along with a button in a Form Window.When the button is clicked , it shows some hidden rows in RadGridView.

I want the hidden rows to be showed when the Form window is maximized. I am trying something like this in Form_Activated method:

If Me.WindowState=2 Then
    button1.PerformClick()

upon Debugging, I can see that the method that handles click event executes but nothing is being done in the Form Window i.e the columns are not showing up. Am I missing something? What should I do?

Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175
schwifty
  • 145
  • 1
  • 12

1 Answers1

1

You will need to handle the WindowStateChanged event, see https://docs.telerik.com/devtools/wpf/controls/radwindow/features/states

In that event you will need to check the WindowState of your Window object. Since you have not specified which class is the one where you handle the event, the Me might be referring to something different from your window. For WindowStateChanged the sender contains the RadWindow. You will need to debug and figure out which member of the sender is the RadWindow. It may be the sender itself. You will need to refer WindowState through the sender.

Also, I recommend that you could avoid triggering clicks in order to change UI properties. You could just have a function which handles every change necessary when the window is maximalized and call that instead of doing a click.

As explained in the comment section, this logic needs to be handled in the Resize event.

Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175
  • Thanks for the response , Lajos. I am writing this code in the window's Activated event handling method, So Me refers to the Form Window. So should I create a method that handles WindowStateChanged event of the Window? I am writing in VB.net and it says that event WindowSateChanged does not exist. – schwifty Dec 23 '21 at 18:59
  • @schwifty it has been a long while since I last worked with Telerik controls. Please let me know about the class name of your window. Is it RadWindow? – Lajos Arpad Dec 23 '21 at 19:15
  • Window is System.Windows.Forms.Form which contains button and RadGridView Telerik.WinControls.UI.RadGridView – schwifty Dec 23 '21 at 19:24
  • Lajos, I figured it out . I have to handle Resize event of the Form. Really appreciate the help. – schwifty Dec 23 '21 at 19:32