Collapse a panel on single-click of header?

Answered
0
0

When a panel has a header visible, a double-click collapses and expands it. How can we make it happen on a single click/tap?

 

 

  • You must to post comments
Best Answer
0
0

You can set the AutoShow property to Never (otherwise the single click will auto show the panel) and then set Collapsed to true|false in the Click, Tap or MouseClick. Check the location of the click in case the panel is expanded using the Control.MousePosition global property.

  • You must to post comments
0
0

Thanks, that works.  Some code like this can be used for multiple panels on the same form:

Private Sub Panel1_Click(sender As Object, e As EventArgs) Handles Panel1.Click, Panel2.Click, Panel3.Click, Panel4.Click, Panel5.Click

If boolEnableSingleClickPanels Then
Dim boolHeaderClicked As Boolean = TryCast(sender, Wisej.Web.Panel).PointToClient(Control.MousePosition).Y < 0
If boolHeaderClicked Then TryCast(sender, Wisej.Web.Panel).Collapsed = Not TryCast(sender, Wisej.Web.Panel).Collapsed
End If

End sub

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.