-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathWindowResize.razor
103 lines (95 loc) · 3.12 KB
/
WindowResize.razor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
@page "/windowresize"
<Window WindowResized="OnWindowResized" />
@(WindowSize != null)
{
<AbsolutePanel AutoResize="true">
<VerticalSliderPanel LeftPanelStartingWidth="@VerticalLeftPanelWidth">
<LeftChildContent>
<HorizontalSliderPanel PanelPosition="PanelPosition.Left"
TopStyleString="background-color:antiquewhite;"
BottomStyleString="background-color:aliceblue;"
TopPanelHeight="@LeftHorizontalTopPanelHeight">
<TopChildContent>
<div style="padding:10px;">
<h3>Top Content 1</h3>
This demo sets the location of the sliders based on a percentage of the
initial size of the browser.
</div>
</TopChildContent>
<BottomChildContent>
<div style="padding:10px;">
<h3>Bottom Content 1</h3>
<NavMenu />
</div>
</BottomChildContent>
</HorizontalSliderPanel>
</LeftChildContent>
<RightChildContent>
<HorizontalSliderPanel PanelPosition="PanelPosition.Right"
TopStyleString="background-color:orange;"
BottomStyleString="background-color:yellow;"
TopPanelHeight="@RightHorizontalTopPanelHeight">
<TopChildContent>
<div style="padding:10px;">
<h3>Top Content 2</h3>
</div>
</TopChildContent>
<BottomChildContent>
<div style="padding:10px;">
<h3>Bottom Content 2</h3>
</div>
</BottomChildContent>
</HorizontalSliderPanel>
</RightChildContent>
</VerticalSliderPanel>
</AbsolutePanel>
}
@code
{
Size WindowSize { get; set; } = null;
int VerticalLeftPanelWidthPercent = 80;
int LeftHorizontal1TopPanelHeightPercent = 40;
int RightHorizontal1TopPanelHeightPercent = 60;
int VerticalLeftPanelWidth
{
get
{
if (WindowSize != null)
{
return WindowSize.Width * VerticalLeftPanelWidthPercent / 100;
}
else
return 0;
}
}
int LeftHorizontalTopPanelHeight
{
get
{
if (WindowSize != null)
{
var height = WindowSize.Height * LeftHorizontal1TopPanelHeightPercent / 100;
return height;
}
else
return 0;
}
}
int RightHorizontalTopPanelHeight
{
get
{
if (WindowSize != null)
{
var height = WindowSize.Height * RightHorizontal1TopPanelHeightPercent / 100;
return height;
}
else
return 0;
}
}
void OnWindowResized(Size Size)
{
WindowSize = Size;
}
}