Skip to content

Commit af79e32

Browse files
docs(window): add example for toggling visibility with a single flag
1 parent 51d11ec commit af79e32

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

components/window/overview.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ To create a Telerik Window:
4242

4343
The Window component is of type `Telerik.Blazor.Components.Window.TelerikWindow` and exposes several properties and methods that let you control its state. The most important ones are the `Visible` property that lets you control whether it is shown on the initial view render, and the `Show` and `Close` methods that control its visibility programmatically.
4444

45-
>caption Store a reference to a Telerik Window, open and close it programmatically
45+
>caption Store a reference to a Telerik Window, open and close it programmatically through methods
4646
4747
````CSHTML
4848
@using Telerik.Blazor.Components.Window
@@ -75,6 +75,32 @@ The Window component is of type `Telerik.Blazor.Components.Window.TelerikWindow`
7575
}
7676
````
7777

78+
>caption Show and close a Window by toggling a single variable
79+
80+
````CSHTML
81+
@using Telerik.Blazor.Components.Window
82+
83+
<button onclick="@ToggleWindow">Toggle the Window</button>
84+
85+
<TelerikWindow Visible="@isWindowShown">
86+
<TelerikWindowTitle>
87+
<strong>The Title</strong>
88+
</TelerikWindowTitle>
89+
<TelerikWindowContent>
90+
This is my window <strong>popup</strong> content.
91+
</TelerikWindowContent>
92+
</TelerikWindow>
93+
94+
@functions {
95+
bool isWindowShown { get; set; }
96+
97+
public void ToggleWindow()
98+
{
99+
isWindowShown = !isWindowShown;
100+
}
101+
}
102+
````
103+
78104
## Styling
79105

80106
The `Class` property lets you define a CSS class that will be rendered on the popup element so you can cascade through it in order to change the appearane of both the content, and the built-in elements of the Window.

0 commit comments

Comments
 (0)