@@ -19,19 +19,26 @@ To use the animation container, add the `TelerikAnimationContainer` tag.
19
19
```` CSHTML
20
20
@* Click the button to toggle the visibility of the customized popup *@
21
21
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>
27
34
28
35
@code {
29
- Telerik.Blazor.Components.TelerikAnimationContainer myPopupRef;
36
+ Telerik.Blazor.Components.TelerikAnimationContainer myPopupRef;
30
37
31
- public void ToggleContainer()
32
- {
33
- myPopupRef.ToggleAsync();
34
- }
38
+ async Task ToggleContainer()
39
+ {
40
+ await myPopupRef.ToggleAsync();
41
+ }
35
42
}
36
43
````
37
44
@@ -66,42 +73,45 @@ The animation container exposes the following properties and methods:
66
73
> caption Explore the animation options
67
74
68
75
```` 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;">
70
79
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>
75
86
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>
82
88
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>
84
94
85
95
@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
+ }
98
108
}
99
109
100
110
<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
+ }
105
115
</style>
106
116
````
107
117
0 commit comments