Skip to content

Collapse a panel on single-click of header? #1208

Closed

Description

@itg-assistant

Andrew Niese asked 2017-11-10 17:52:53 UTC

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?

Activity

  1. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2017-11-13 19:29:46 UTC

    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.

  2. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Andrew Niese answered 2017-11-15 20:37:45 UTC

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GeneralQuestions, how-tos and everything else.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions