@@ -196,7 +196,7 @@ N> If TooltipText is provided, tooltip will be displayed on the back icon. If no
196196 BackIconAlignment="End"
197197 BackIconToolTipText="Back"
198198 BackIconColor="Red">
199- < toolbar:SfOverlayToolbar.BackIconTemplate >
199+ <toolbar:SfOverlayToolbar.BackIconTemplate>
200200 <DataTemplate>
201201 <ViewCell>
202202 <Grid WidthRequest="47" HeightRequest="33" HorizontalOptions="Start">
@@ -235,7 +235,7 @@ N> If TooltipText is provided, tooltip will be displayed on the back icon. If no
235235 </toolbar:SfToolbarItem.Icon>
236236 </toolbar:SfToolbarItem>
237237
238- < toolbar:SeparatorToolbarItem/ >
238+ <toolbar:SeparatorToolbarItem/>
239239
240240 </toolbar:SfOverlayToolbar.Items>
241241 </toolbar:SfOverlayToolbar>
@@ -264,10 +264,10 @@ namespace ToolbarSample
264264 HeightRequest = 33,
265265 HorizontalOptions = LayoutOptions.Start
266266 };
267-
268- var image = new Image
267+ var image = new ImageButton
269268 {
270- Source = "close.png"
269+ Source = "close.png",
270+ Clicked = "ImageButton_Clicked",
271271 };
272272
273273 grid.Children.Add(image);
@@ -285,27 +285,32 @@ namespace ToolbarSample
285285 overlaytoolbar.BackIconToolTipText = "Back";
286286 overlaytoolbar.BackIconAlignment = OverlayToolbarBackIconPosition.End;
287287 }
288- }
289288
290- private async void Toolbar_Tapped(object sender, Syncfusion.Maui.Toolbar.ToolbarTappedEventArgs e)
291- {
292- if (e.NewToolbarItem != null)
289+ private async void Toolbar_Tapped(object sender, Syncfusion.Maui.Toolbar.ToolbarTappedEventArgs e)
293290 {
294- if (e.NewToolbarItem.Name == "Alignment" )
291+ if (e.NewToolbarItem != null )
295292 {
296- var item = e.NewToolbarItem?.OverlayToolbar;
297-
298- if (!this.layout.Children.Contains(item))
293+ if (e.NewToolbarItem.Name == "Alignment")
299294 {
300- this.layout.Children.Add(item);
295+ var item = e.NewToolbarItem?.OverlayToolbar;
296+
297+ if (!this.layout.Children.Contains(item))
298+ {
299+ this.layout.Children.Add(item);
300+ }
301+
302+ await Task.Delay(1000);
303+ (sender as SfToolbar)?.ClearSelection();
301304 }
302-
303- await Task.Delay(1000);
304- (sender as SfToolbar)?.ClearSelection();
305305 }
306306 }
307+
308+ private void ImageButton_Clicked(object sender, EventArgs e)
309+ {
310+ this.overlaytoolbar.IsVisible = false;
311+ }
307312 }
308- }}
313+ }
309314
310315{% endhighlight %}
311316
0 commit comments