How to add a click event to the form header? How to do it so that the event fires only when you click on the header, excluding buttons and tabs.
For clarity, I have highlighted the area in the picture below, only it should react to the event.
3 Answers, 1 is accepted
Hello, Serg,
In this case, I can suggest to handle the MouseDown event on the TabbedFormControlTabsElement:
this.TabbedFormControl.TabbedFormControlTabsElement.MouseDown += this.TabbedFormControlTabsElement_Click;
private void TabbedFormControlTabsElement_Click(object sender, EventArgs e)
{
Console.WriteLine("TabbedFormControlTabsElement is clicked");
}
I hope this helps. Should you have other questions do not hesitate to contact me.
Regards,
Nadya
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/.
Now I want to restore this function with a listener. Did I choose the right path for the solution? Or can you suggest another solution?
Hello, Serg,
According to the provided information in your last post, it seems that you have removed the Minimize, Maximize, and Close buttons from the caption in TabbedFormControl. Now, you would like to maximize the form when you double click on the form's title bar and revert back to normal state when the form is maximized.
In order to achieve this, I can suggest handling TabbedFormControlTabsElement.DoubleClick event and achieve this. Below is a sample code snippet which result is illustrated in the attached gif file. When I double click on the form's title bar the form gets maximized, then when I double click the title bar again the form gets back to its normal state.
this.TabbedFormControl.TabbedFormControlTabsElement.DoubleClick += this.TabbedFormControlTabsElement_DoubleClick;
private void TabbedFormControlTabsElement_DoubleClick(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Normal)
{
this.WindowState = FormWindowState.Maximized;
}
else if (this.WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Normal;
}
}
I hope this helps. Should you have other questions please let me know.
Regards,
Nadya
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/.