Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(Window): add kb for programmatic center of the window #2821

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Tsvetomir-Hr
Copy link
Contributor

@Tsvetomir-Hr Tsvetomir-Hr commented Mar 12, 2025

Related to: https://github.com/telerik/blazor/issues/8956

Once we deprecate the Centered parameter of the Window, will link this KB to Window Position documentation.

@Tsvetomir-Hr Tsvetomir-Hr added the merge-to-production Use this label to get a comment to choose whether to merge the PR to production label Mar 12, 2025
@Tsvetomir-Hr Tsvetomir-Hr self-assigned this Mar 12, 2025
@Tsvetomir-Hr Tsvetomir-Hr requested a review from a team as a code owner March 12, 2025 10:58
Copy link
Contributor

Hello @Tsvetomir-Hr,

Check the below option if you would like to automatically generate PR to production. The automation uses the branch for the cherry-pick, and then will delete the branch. Please, do not delete it manually.

  • create PR to production

>caption Telerik Blazor Window Centered Programmatically

````RAZOR
@if (!IsWindowVisible)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example can be simplified:

  • Remove the toggle button
  • Make the Window always visible
  • Move the Center button inside the Window


To center a Telerik Window programmatically, follow these steps:

1. Use [`Top` and `Left` parameters](slug:components/window/position#top-and-left) – These parameters define the Window position on the screen.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step is not actionable, especially if the customer wants the Window to be initially centered. For example, explain:

  • That the parameters must use two-way binding.
  • What should be their default values.

This may also help you to make the next step simpler, because the reader will already be familiar with the string.Empty value.


1. Use [`Top` and `Left` parameters](slug:components/window/position#top-and-left) – These parameters define the Window position on the screen.
2. Reset `Top` and `Left` parameters to center the Window – Setting them to `string.Empty` allows automatic centering.
3. Refresh the Window using component reference – Calling `WindowRef?.Refresh();` re-renders the Window with the new position.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2. Reset `Top` and `Left` parameters to center the Window – Setting them to `string.Empty` allows automatic centering.
3. Refresh the Window using component reference – Calling `WindowRef?.Refresh();` re-renders the Window with the new position.

>caption Telerik Blazor Window Centered Programmatically
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the caption an action "verb", rather than a "noun". For example:

Suggested change
>caption Telerik Blazor Window Centered Programmatically
>caption Center the Telerik Blazor Window Programmatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-to-production Use this label to get a comment to choose whether to merge the PR to production
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants