Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Dynamic Secondary ToolbarItem overlaps page content

$
0
0

Hello, I have a question about Secondary ToolbarItems for IOS.

If I add secondary items dynamically, for instance, by button tap, then toolbar overlaps the page content.

    private bool _isToolbarVisible = false;
    private void Button_Clicked(object sender, EventArgs e)
    {
        _isToolbarVisible = !_isToolbarVisible;

        if (!_isToolbarVisible)
        {
            var toolBarItems = new List<ToolbarItem>(ToolbarItems);

            foreach (var toolbarItem in toolBarItems)
            {
                ToolbarItems.Remove(toolbarItem);
            }
        }
        else
        {
            ToolbarItems.Add(
            new ToolbarItem
            {
                Text = "Toolbar item",
                Order = ToolbarItemOrder.Secondary
            });
        }
    }


If I rotate simulator then toolbar allocation start working fine until next button click.

  1. Probably I show toolbar incorrectly?
  2. If it is a bug, then probably full page redrawing could help? I've tried this without any success:
    this.InvalidateMeasure();
    this.UpdateChildrenLayout();
    this.ForceLayout();

To reproduce the problem you simply need to create default MasterPage xamarin application in Visual Studio. Then add button in xaml (I did it in ItemDetailPageg.xaml) with click handler I've provided above.

Thank you in advance.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>