Windowscommunitytoolkit: MasterDetailsView How to programmatically go to the NoSelectionContentTemplate

Created on 20 May 2017  路  5Comments  路  Source: windows-toolkit/WindowsCommunityToolkit

Hi
I am using the MasterDetailsView in a project and it is working well so far. It combines 3 or 4 pages into a single page. I am using it to add, edit and delete items in a list. I have the add button in the master command bar, the add form in the NoSelectionContentTemplate.

The question is when I am in a narrow state, how do I programmatically get to the NoSelectedContentTemplate view?

ayakoai

controls question

All 5 comments

ping @skendrot

I don't believe that is a usecase we're looking to solve with the MasterDetailsView. I would suggest that if the add button is clicked and the ViewState is Master that you navigate to a new page.
Alternatively (and this would be my recommendation), you could not use the NoSelectionContent and instead could a ContentDialog as a popup for when adding new items.

It's very simple just set SelectedItem as Null

private void AddButton_Click(object sender, RoutedEventArgs e)
{
MasterDetailsViewName.SelectedItem = null;
}

@hypodyne I love the creativity here, but this is not something we're looking to solve with the MasterDetailsView. You are free to take the source and add it to your project to accomplish your needs or use the HamburgerMenu.

Hi.. I have added the extra Add Page and navigate to it in a narrow state and that works pretty well. The only thing is the animation does not match. I can live with that. Still cuts down the page count from 4 to 2 pages and simplifies everything.

I had a look at the source code hoping it was an easy fix, but it was easier to do it the other way.

Thanks for your help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

touseefbsb picture touseefbsb  路  46Comments

Vijay-Nirmal picture Vijay-Nirmal  路  47Comments

deltakosh picture deltakosh  路  34Comments

0pd picture 0pd  路  28Comments

hermitdave picture hermitdave  路  58Comments