@@ -19,19 +19,26 @@ To use the animation container, add the `TelerikAnimationContainer` tag.
1919```` CSHTML
2020@* Click the button to toggle the visibility of the customized popup *@
2121
22- <TelerikAnimationContainer @ref="myPopupRef" Top="300px" Width="100px" Height="100px" AnimationType="AnimationType.ZoomOut" Class="k-popup">
23- My content goes here. The "k-popup" class adds some background and borders which you can define through your own styles instead.
24- </TelerikAnimationContainer>
25-
26- <TelerikButton OnClick="@ToggleContainer">Toggle Animation Container</TelerikButton>
22+ <div style="position:relative; border: 1px solid red; height: 300px;">
23+ <TelerikButton OnClick="@ToggleContainer">Toggle Animation Container</TelerikButton>
24+
25+ <TelerikAnimationContainer @ref="myPopupRef" Top="50px" Left="50px" Width="250px" Height="150px" AnimationType="AnimationType.ZoomOut" Class="k-popup">
26+ <p>
27+ The "k-popup" class adds some background and borders which you can define through your own styles instead.
28+ </p>
29+ <p>
30+ My parent element has <code>position: relative</code> to control my <code>Top</code> and <code>Left</code> offset.
31+ </p>
32+ </TelerikAnimationContainer>
33+ </div>
2734
2835@code {
29- Telerik.Blazor.Components.TelerikAnimationContainer myPopupRef;
36+ Telerik.Blazor.Components.TelerikAnimationContainer myPopupRef;
3037
31- public void ToggleContainer()
32- {
33- myPopupRef.ToggleAsync();
34- }
38+ async Task ToggleContainer()
39+ {
40+ await myPopupRef.ToggleAsync();
41+ }
3542}
3643````
3744
@@ -66,42 +73,45 @@ The animation container exposes the following properties and methods:
6673> caption Explore the animation options
6774
6875```` CSHTML
69- Choose a new animation from the dropdown and toggle the container
76+ @*Choose a new animation from the dropdown and toggle the container*@
77+
78+ <div style="position:relative;">
7079
71- <TelerikAnimationContainer @ref="myPopup" Top="300px" Width="200px" Height="200px" AnimationType="@AnimType" Class="my-popup">
72- My content goes here.<br />
73- <TelerikButton OnClick="@HideContainer">Hide Animation Container</TelerikButton>
74- </TelerikAnimationContainer>
80+ <select @bind="AnimType">
81+ @foreach (var possibleAnimation in Enum.GetValues(typeof(AnimationType)))
82+ {
83+ <option value="@possibleAnimation">@possibleAnimation</option>
84+ }
85+ </select>
7586
76- <select @bind="AnimType">
77- @foreach (var possibleAnimation in Enum.GetValues(typeof(AnimationType)))
78- {
79- <option value="@possibleAnimation">@possibleAnimation</option>
80- }
81- </select>
87+ <TelerikButton OnClick="@ShowContainer">Show Animation Container</TelerikButton>
8288
83- <TelerikButton OnClick="@ShowContainer">Show Animation Container</TelerikButton>
89+ <TelerikAnimationContainer @ref="myPopup" Top="40px" Width="200px" Height="200px" AnimationType="@AnimType" Class="my-popup">
90+ My content goes here.<br />
91+ <TelerikButton OnClick="@HideContainer">Hide Animation Container</TelerikButton>
92+ </TelerikAnimationContainer>
93+ </div>
8494
8595@code {
86- TelerikAnimationContainer myPopup;
87- public AnimationType AnimType { get; set; } = AnimationType.Fade;
88-
89- public void ShowContainer()
90- {
91- myPopup.ShowAsync();
92- }
93-
94- public void HideContainer()
95- {
96- myPopup.HideAsync();
97- }
96+ TelerikAnimationContainer myPopup;
97+ AnimationType AnimType { get; set; } = AnimationType.Fade;
98+
99+ async Task ShowContainer()
100+ {
101+ await myPopup.ShowAsync();
102+ }
103+
104+ async Task HideContainer()
105+ {
106+ await myPopup.HideAsync();
107+ }
98108}
99109
100110<style>
101- .my-popup {
102- border: 2px solid red;
103- background: #ccc;
104- }
111+ .my-popup {
112+ border: 2px solid red;
113+ background: #ccc;
114+ }
105115</style>
106116````
107117
0 commit comments