You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: knowledge-base/window-center-programmatically.md
+8-15Lines changed: 8 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,20 +32,14 @@ This knowledge base article answers the following questions:
32
32
33
33
To center a Telerik Window programmatically, follow these steps:
34
34
35
-
1.Use [`Top` and `Left` parameters](slug:components/window/position#top-and-left)– These parameters define the Window position on the screen.
36
-
2.Reset `Top` and `Left` parameters to center the Window – Setting them to `string.Empty` allows automatic centering.
37
-
3. Refresh the Window using component reference – Calling `WindowRef?.Refresh();` re-renders the Window with the new position.
35
+
1.Bind the [`Top` and `Left` parameters](slug:components/window/position#top-and-left)using `@bind-Top` and `@bind-Left` to control the Window position dynamically. Set their default values to specific ones (e.g., `Top="30%"`, `Left="60%"`) to position the Window where you want it to appear initially.
36
+
2.Set both parameters to `string.Empty`to reset the Window position. This will ensure that, the component automatically repositions itself to the center of the current viewport.
37
+
3. Refresh the Window using component reference – Calling [`WindowRef?.Refresh();`](slug:window-overview#window-reference-and-methods) re-renders the Window with the new position.
0 commit comments