1+ <?xml version =" 1.0" encoding =" utf-8" ?>
2+ <ContentPage xmlns =" http://schemas.microsoft.com/dotnet/2021/maui"
3+ xmlns : x =" http://schemas.microsoft.com/winfx/2009/xaml"
4+ xmlns : local =" clr-namespace:Maui.Controls.Sample"
5+ x : Class =" Maui.Controls.Sample.HybridWebViewControlPage"
6+ x : DataType =" local:HybridWebViewViewModel"
7+ Title =" HybridWebViewControlPage" >
8+
9+
10+ <Grid Padding =" 10"
11+ RowSpacing =" 5" >
12+ <!-- Define Grid Rows -->
13+ <Grid .RowDefinitions>
14+ <RowDefinition Height =" 250" />
15+ <RowDefinition Height =" Auto" />
16+ <RowDefinition Height =" Auto" />
17+ </Grid .RowDefinitions>
18+
19+ <!-- Row 0: HybridWebView at the top -->
20+ <HybridWebView Grid.Row=" 0"
21+ x : Name =" MyHybridWebView"
22+ DefaultFile =" {Binding DefaultFile}"
23+ HybridRoot =" {Binding HybridRoot}"
24+ IsVisible =" {Binding IsVisible}"
25+ Shadow =" {Binding Shadow}"
26+ FlowDirection =" {Binding FlowDirection}"
27+ RawMessageReceived =" OnRawMessageReceived"
28+ AutomationId =" HybridWebViewControl" />
29+
30+ <!-- Row 1: Title and Status Labels -->
31+ <VerticalStackLayout Grid.Row=" 1"
32+ Spacing =" 2" >
33+ <Label Text =" {Binding Status}"
34+ FontSize =" 14"
35+ TextColor =" DarkGreen"
36+ HorizontalOptions =" Start"
37+ AutomationId =" StatusLabel" />
38+
39+ <Grid ColumnSpacing =" 20" >
40+ <Grid .ColumnDefinitions>
41+ <ColumnDefinition Width =" *" />
42+ <ColumnDefinition Width =" *" />
43+ </Grid .ColumnDefinitions>
44+
45+ <HorizontalStackLayout Grid.Column=" 0"
46+ Spacing =" 2" >
47+ <Label Text =" HybridRoot:"
48+ FontAttributes =" Bold"
49+ FontSize =" 12"
50+ HorizontalOptions =" Start" />
51+ <Label Text =" {Binding HybridRoot}"
52+ FontSize =" 11"
53+ TextColor =" Blue"
54+ AutomationId =" HybridRootLabel" />
55+ </HorizontalStackLayout >
56+
57+ <HorizontalStackLayout Grid.Column=" 1"
58+ Spacing =" 2" >
59+ <Label Text =" DefaultFile:"
60+ FontAttributes =" Bold"
61+ FontSize =" 12"
62+ HorizontalOptions =" Start" />
63+ <Label Text =" {Binding DefaultFile}"
64+ FontSize =" 11"
65+ TextColor =" Blue"
66+ AutomationId =" DefaultFileLabel" />
67+ </HorizontalStackLayout >
68+ </Grid >
69+ </VerticalStackLayout >
70+
71+ <!-- Row 2: Action Buttons -->
72+ <VerticalStackLayout Grid.Row=" 2"
73+ Spacing =" 2" >
74+ <Grid RowSpacing =" 2"
75+ ColumnSpacing =" 5" >
76+ <Grid .RowDefinitions>
77+ <RowDefinition Height =" Auto" />
78+ <RowDefinition Height =" Auto" />
79+ <RowDefinition Height =" Auto" />
80+ <RowDefinition Height =" Auto" />
81+ <RowDefinition Height =" Auto" />
82+ <RowDefinition Height =" Auto" />
83+ <RowDefinition Height =" Auto" />
84+ <RowDefinition Height =" Auto" />
85+ <RowDefinition Height =" Auto" />
86+ <RowDefinition Height =" Auto" />
87+ <RowDefinition Height =" Auto" />
88+ </Grid .RowDefinitions>
89+ <Grid .ColumnDefinitions>
90+ <ColumnDefinition Width =" *" />
91+ <ColumnDefinition Width =" *" />
92+ </Grid .ColumnDefinitions>
93+
94+ <!-- HybridRoot Selection -->
95+ <Label Grid.Row=" 0"
96+ Grid.ColumnSpan=" 2"
97+ Text =" Select HybridRoot:"
98+ FontSize =" 12"
99+ FontAttributes =" Bold"
100+ HorizontalOptions =" Start" />
101+
102+ <Button Grid.Row=" 1"
103+ Grid.Column=" 0"
104+ x : Name =" HybridWebView1Button"
105+ Text =" HybridWebView1"
106+ Clicked =" OnHybridRootButtonClicked"
107+ AutomationId =" HybridWebView1Button" />
108+ <Button Grid.Row=" 1"
109+ Grid.Column=" 1"
110+ x : Name =" HybridWebView2Button"
111+ Text =" HybridWebView2"
112+ Clicked =" OnHybridRootButtonClicked"
113+ AutomationId =" HybridWebView2Button" />
114+
115+ <!-- DefaultFile Selection -->
116+ <Label Grid.Row=" 2"
117+ Grid.ColumnSpan=" 2"
118+ Text =" Select Default File:"
119+ FontSize =" 12"
120+ FontAttributes =" Bold"
121+ HorizontalOptions =" Start" />
122+
123+ <Button Grid.Row=" 3"
124+ Grid.Column=" 0"
125+ x : Name =" IndexHtmlButton"
126+ Text =" index.html"
127+ Clicked =" OnDefaultFileButtonClicked"
128+ AutomationId =" IndexHtmlButton" />
129+ <Button Grid.Row=" 3"
130+ Grid.Column=" 1"
131+ x : Name =" ImageHtmlButton"
132+ Text =" image.html"
133+ Clicked =" OnDefaultFileButtonClicked"
134+ AutomationId =" ImageHtmlButton" />
135+
136+ <Button Grid.Row=" 4"
137+ Grid.Column=" 0"
138+ x : Name =" NavigationHtmlButton"
139+ Text =" navigation.html"
140+ Clicked =" OnDefaultFileButtonClicked"
141+ AutomationId =" NavigationHtmlButton" />
142+ <Button Grid.Row=" 4"
143+ Grid.Column=" 1"
144+ x : Name =" WebHtmlButton"
145+ Text =" web.html"
146+ Clicked =" OnDefaultFileButtonClicked"
147+ AutomationId =" WebHtmlButton" />
148+
149+ <!-- Properties Section -->
150+ <Label Grid.Row=" 5"
151+ Grid.ColumnSpan=" 2"
152+ Text =" Properties:"
153+ FontSize =" 12"
154+ FontAttributes =" Bold"
155+ HorizontalOptions =" Start" />
156+
157+ <HorizontalStackLayout Grid.Row=" 6"
158+ Grid.Column=" 0"
159+ Spacing =" 5" >
160+ <CheckBox x : Name =" IsVisibleCheckBox"
161+ IsChecked =" {Binding IsVisible}"
162+ AutomationId =" IsVisibleCheckBox" />
163+ <Label Text =" IsVisible"
164+ VerticalOptions =" Center"
165+ FontSize =" 12" />
166+ </HorizontalStackLayout >
167+
168+ <HorizontalStackLayout Grid.Row=" 6"
169+ Grid.Column=" 1"
170+ Spacing =" 5" >
171+ <CheckBox x : Name =" ShadowCheckBox"
172+ IsChecked =" {Binding HasShadow}"
173+ AutomationId =" ShadowCheckBox" />
174+ <Label Text =" Shadow"
175+ VerticalOptions =" Center"
176+ FontSize =" 12" />
177+ </HorizontalStackLayout >
178+ <HorizontalStackLayout Grid.Row=" 7"
179+ Grid.Column=" 0"
180+ Spacing =" 5" >
181+ <CheckBox x : Name =" FlowDirectionCheckBox"
182+ IsChecked =" {Binding IsLeftToRight}"
183+ CheckedChanged =" OnFlowDirectionCheckBoxChanged"
184+ AutomationId =" FlowDirectionCheckBox" />
185+ <Label Text =" FlowDirection: LTR if checked, RTL if unchecked"
186+ VerticalOptions =" Center"
187+ FontSize =" 12" />
188+ </HorizontalStackLayout >
189+
190+
191+ <!-- Action Buttons -->
192+ <Label Grid.Row=" 8"
193+ Grid.ColumnSpan=" 2"
194+ Text =" Action Buttons:"
195+ FontSize =" 12"
196+ FontAttributes =" Bold"
197+ HorizontalOptions =" Start" />
198+
199+ <Button Grid.Row=" 9"
200+ Grid.Column=" 0"
201+ Text =" Evaluate JS"
202+ Clicked =" OnEvaluateJavaScriptClicked"
203+ AutomationId =" EvaluateJavaScriptButton" />
204+
205+ <Button Grid.Row=" 9"
206+ Grid.Column=" 1"
207+ Text =" Send Message to JS"
208+ Clicked =" OnSendMessageToJavaScriptClicked"
209+ FontSize =" 14"
210+ AutomationId =" SendMessageButton" />
211+ <!-- Reset Button -->
212+ <Button Grid.Row=" 10"
213+ Grid.ColumnSpan=" 2"
214+ Text =" Reset"
215+ Clicked =" OnResetButtonClicked"
216+ BackgroundColor =" Orange"
217+ FontSize =" 12"
218+ AutomationId =" ResetButton" />
219+ </Grid >
220+ </VerticalStackLayout >
221+ </Grid >
222+ </ContentPage >
0 commit comments