1

I use the Iconize plugin for my project, and there is an issue that occurs in case of the IconToolbarItem is used in a IconNavigationPage, that is itself used in the Detail of a MasterDetailPage.

If we launch the UWP project from IconizeSample, the IconToolbarItems are well displayed in the TabbedPage:

var tabbedPage = new IconTabbedPage { Title = "Iconize" };
foreach (var module in Plugin.Iconize.Iconize.Modules)
{
    tabbedPage.Children.Add(new Page1
    {
        BindingContext = new ModuleWrapper(module),
        Icon = module.Keys.FirstOrDefault()
    });
}
MainPage = new IconNavigationPage(tabbedPage);

If we replace the TabbedPage by a MasterDetailPage, this also works if the Detail is not a IconNavigationPage:

var mdPage = new MasterDetailPage();
mdPage.Master = new ContentPage
{
    Title = "Iconize"
};
var module = Plugin.Iconize.Iconize.Modules.First();
mdPage.Detail = new Page1
{
    BindingContext = new ModuleWrapper(module),
    Icon = module.Keys.FirstOrDefault()
};
MainPage = new IconNavigationPage(mdPage);

But if we put the Detail in an IconNavigationPage, the icons of the IconToolbarItem are no longer visible:

var mdPage = new MasterDetailPage();
mdPage.Master = new ContentPage
{
    Title = "Iconize"
};
var module = Plugin.Iconize.Iconize.Modules.First();
mdPage.Detail = new IconNavigationPage(new Page1
{
    BindingContext = new ModuleWrapper(module),
    Icon = module.Keys.FirstOrDefault()
});
MainPage = mdPage;

Would you have an explanation? Is there a way to fix this awaiting a new package version?

Gold.strike
  • 1,269
  • 13
  • 47

1 Answers1

0

But if we put the Detail in an IconNavigationPage, the icons of the IconToolbarItem are no longer visible:

The problem is that you have not inserted the mdPage into IconNavigationPage. I have modified your code and it works.

var mdPage = new MasterDetailPage();
mdPage.Master = new ContentPage
{
    Title = "Iconize"
};
var module = Plugin.Iconize.Iconize.Modules.First();
var page = new Page1
{
    BindingContext = new ModuleWrapper(module),
    Icon = module.Keys.FirstOrDefault()
};
mdPage.Detail = page;
MainPage = new IconNavigationPage(mdPage);
Nico Zhu
  • 32,367
  • 2
  • 15
  • 36
  • Hi @Nico Zhu. I've also made this test in the second case that I've described. It works on UWP but not on Android. But in the real project where I want to use Iconize, this implementation is not possible. So I wanted to create a test that reproduce the "real" context. – Gold.strike Feb 02 '18 at 09:39
  • Yep, I have tried to replace `ToolbarItem ` with `IconToolbarItem`, it works fine, I think it is Iconize plugin bug. I strongly suggest using `ToolbarItem` in your real project. – Nico Zhu Feb 02 '18 at 09:54
  • I'm working on an existing projet, where the `ToolbarItems` are already implemnted, but only with labels, no with icons. In the new sceens, there are now icons: so Iconize was a good choice to implement this easily. As it seems to work fine on Android and iOS, I think that I will keep this as that. The `IconToolbarItems` display the label on UWP: only the icons are missing. – Gold.strike Feb 02 '18 at 10:46