Skip to content

Conversation

skendrot
Copy link
Contributor

Addresses issue #452. Allows for the user to follow the Master/Details design pattern. Solves the problem of the user having to setup navigation to a details page if on a small device.
Using the control is simple. User sets the ItemsSource, ItemTemplate, and DetailsTemplate

<controls:MasterDetailsView ItemsSource="{Binding Items}"
                            ItemTemplate="{StaticResource ListItemTemplate}"
                            DetailsTemplate="{StaticResource DetailsTemplate}"/>
  • Allows for binding the SelectedItem to a viewmodel.
  • Automatic animations for details when an item is selected

@dnfclas
Copy link

dnfclas commented Oct 17, 2016

Hi @skendrot, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla2.dotnetfoundation.org.

TTYL, DNFBOT;

@dnfclas
Copy link

dnfclas commented Oct 17, 2016

@skendrot, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR.

Thanks, DNFBOT;

@ScottIsAFool
Copy link
Contributor

My initial thoughts on this are that it doesn't allow for non-lists in the master section. For example, a settings page.

@skendrot
Copy link
Contributor Author

The vast majority of use cases involve a ListView. Even the Windows Settings app. The Settings app just happens to also have a search bar and title bar in the "master" section. Better to have someone restyle to put a search bar than have everyone put a list in.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove redundant usings

new Email { From = "OneDrive", Subject = "Check out your event recap", Body = "Your new album.\r\nYou uploaded some photos to yuor OneDrive and automatically created an album for you."},
new Email { From = "Twitter", Subject = "Follow randomPerson, APersonYouMightKnow", Body = "Here are some people we think you might like to follow:\r\n.@randomPerson\r\nAPersonYouMightKnow"},
};
this.InitializeComponent();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove instances of "this."

<TextBlock Text="{Binding From}" Style="{ThemeResource SubtitleTextBlockStyle}" RelativePanel.RightOf="FromEllipse" Margin="12,-6,0,0"/>
<TextBlock x:Name="SubjectLine" Text="{Binding Subject}" Style="{ThemeResource BodyTextBlockStyle}" RelativePanel.Below="FromEllipse"/>
<TextBlock x:Name="Body" Text="{Binding Body}" Style="{ThemeResource BodyTextBlockStyle}" TextWrapping="Wrap" RelativePanel.Below="SubjectLine" Margin="0,12,0,0"/>
<Button Content="Click ME!" RelativePanel.Below="Body"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of this button?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the purpose is to click it ;)
I think I was going to add reply/forward/etc buttons but decided against it. Will be removed

{
var view = (MasterDetailsView)d;
string noSelectionState = view._stateGroup.CurrentState == view._narrowState
? "NoSelectionNarrow"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be happier if VisualState names/groups and Template child names were constants.

_compositor = _root.Compositor;

_detailsPresenter = (ContentPresenter)GetTemplateChild("DetailsPresenter");
_detailsPresenter.SizeChanged += OnSizeChanged;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I change the template and change the details presenter in some way (change its name, remove it, whatever), this will crash the control. Should have a null check.

Copy link
Contributor Author

@skendrot skendrot Oct 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's intended. The View doesn't function the same without it. Would need to check many other places for null as well. Others have thoughts?

</VisualState>
<VisualState x:Name="WideState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="720" />
Copy link

@jneidlinger jneidlinger Oct 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never been able to track down what the true "best practice" is on window width breakpoints, and it seems everyone does it however they want. That being said, the Windows guidelines pretty clearly denote breakpoints of 640 and below as narrow, 641 to 1007 as medium, and 1008 and greater as large. I'm not sure where these values came from, but they do suggest apps follow them. So, following that, it seems this value should be 641.

To make things more confusing though, the diagram directly above it show different breakpoints, and the header at the top shows a different set of breakpoints altogether.

Thoughts from the Microsoft folks? (@deltakosh, etc)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the status on this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say follow the guidelines @jneidlinger pointed to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Keeping as is:
image

Copy link

@jneidlinger jneidlinger Oct 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are not the recommended breakpoints though. Those are "example" screen widths. See the circled red area for the recommended breakpoint widths:

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jneidlinger it's the row below it he needs, not the one you circled :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScottIsAFool Fixed. Halloween. :)

Copy link

@jneidlinger jneidlinger Oct 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well - I did some more digging, and the specific guidelines for master / detail view do call out using 720 as the breakpoint. I wish the guidelines were a little more consistent.

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, looks like it's good to stay as is then.

@skendrot
Copy link
Contributor Author

Still need a doc file. Need to record a gif of the control

@ScottIsAFool
Copy link
Contributor

@skendrot didn't you already record one https://twitter.com/skendrot/status/787899417487474689?

@skendrot
Copy link
Contributor Author

skendrot commented Oct 31, 2016

No. I uploaded a video to twitter, they turned it into a gif. And I'd rather not use that gif for the repo

@deltakosh
Copy link
Contributor

Fix the conflict and we are good to go

@deltakosh deltakosh added this to the v1.2 milestone Oct 31, 2016
Conflicts:
	Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj
@ScottIsAFool
Copy link
Contributor

Are we still waiting for documentation for this?

@deltakosh
Copy link
Contributor

Nope we have it

@ScottIsAFool
Copy link
Contributor

Ah, sorry, thought the tag was still there :)

@deltakosh deltakosh merged commit 0b39573 into CommunityToolkit:dev Nov 1, 2016
@deltakosh
Copy link
Contributor

YEAHHH!Congrats @skendrot !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants