CommunityToolkit / WindowsCommunityToolkit

The Windows Community Toolkit is a collection of helpers, extensions, and custom controls. It simplifies and demonstrates common developer tasks building .NET apps with UWP and the Windows App SDK / WinUI 3 for Windows 10 and Windows 11. The toolkit is part of the .NET Foundation.
https://docs.microsoft.com/windows/communitytoolkit/
Other
5.87k stars 1.38k forks source link

Use ContentPresenter in MasterDetailsView instead of ListView #1187

Closed Vijay-Nirmal closed 4 years ago

Vijay-Nirmal commented 7 years ago

I know I am asking you to reduce the features of MasterDetailsView but I think it is necessary. Let me explain

At present MasterDetailsView is like a ListView with a place to show Content. It limits the use of MasterDetailsView. If a developer wants to do something different then they must write their own MasterDetailsView or they should restyle the whole control.

If we Use ContentPresenter in MasterDetailsView instead of ListView then it would be easy for the developer to create their own version of MasterDetailsView with unique design Like Pivot as MasterView, Multiple Layers of MasterDetailsView, GridView as MasterView, PullToRefresh in MasterView or Connected Animations. If we did this then we can solve #891, #1011, #1079, #1087, #1173 ...

When Master and Detail view is in the overlapping state it should act like single navigating between Master and Detail view. Don't Fack it using a Storyboard animation. If we do then it affect developer when they are doing connected animation also causes issues like #1117, #1729.

This is just my opinion.

UserVoice: Use ContentPresenter in MasterDetailsView instead of ListView

nmetulev commented 7 years ago

Great feedback. The reality is, we had a long discussion around this when the MasterDetailsView control was being created (see #452). The consensus was to build a control that is very simple to add without the need for the developer to build much around the master or the detail. Maybe I'm not understanding you correctly, but you are essentially asking the developer to build their own master detail view every time they want to use the control. Apologies if I misunderstand

ping @skendrot

Vijay-Nirmal commented 7 years ago

@nmetulev My Idea is to create a Skeleton for Master/Detail view. So that developers can create Master/Detail view like News app(With GridView), Mail(With ListView) or in their own style. It is not limited to a single kind of Master/Detail view.

Here is my concept

  1. When Master and Detail view are in Side-by-Side state it should act like two <Frame> are in Side-by-Side.
  2. When Master and Detail view is in overlapping state it should act like single <Frame> navigating between Master and Detail view. Don't Fack it. If we do then it affect developer when they are doing connected animation also causes issues like #1117
  3. Allow Master View to take entire space all the time to achieve Master view With GridView Like in News app. MasterPaneWidth="*"
  4. Don't bother about data binding because it is an easy part, developers can do it.
  5. We don't need line separator between Master and Detail view.
  6. Allow developers to place Detail View Above, Right Side or Below of Master View. For Example: We can use Carousel to show images in bottom(Master View) and we can show large form of that image at top(Detail View)

If we do this then developers can easy take advantage of new controls like RefreshContainer, SwipeContainer, TreeView(as Master View) etc. Some users prefer ListView and Some would prefer GridView so Developers can easy give an option to switch between these two controls. If we develop this then Sky is the Limit of is control.

mdtauk commented 7 years ago

Could it not be templated, so you change the type of list view in the MasterView. So it could be a GridView, ListView, or even a custom control with an ItemSelectionChanged event?
Heck, even change the basic Root part so you can re-template and change the grid which positions the Master and Detail panels.

Vijay-Nirmal commented 7 years ago

@mdtauk

you can re-template

This is the part that doesn't sit right with me. Why should we re-template the whole thing in order to use the default controls Like RefreshContainer? Pull To Refresh is a common thing to be used in Master View but to achieve that we should re-template this. What about Connected Animation? In my opinion, we should create a skeleton for Master/Detail view so that it isn't limited by anything and developers can easy take advantage of all controls.

I know this may sound like a bad idea. Why shouldn't we create a control for both? Let the old one be MasterDetailsListView and this one be MasterDetailsPanel.

mdtauk commented 7 years ago

@Vijay-Nirmal It is a choice about having a bare bones implementation, developers would have to program themselves, or architecting the control into something to allow re-templating the MasterDetails core template, which could easily be as simple as: `

` Easy to re-template but contains all the logic so no need for devs to do the heavy lifting. You can then re-template the MasterView to use whatever List view you want etc.
Vijay-Nirmal commented 7 years ago

@mdtauk

architecting the control into something to allow re-templating the MasterDetails core template

New developers don't know to re-template.

developers would have to program themselves

Data Binding is an easy part even new developers can do it.

What about Connected Animation?

nmetulev commented 7 years ago

@Vijay-Nirmal, what you are describing feels like a bare-bone structure that won't work unless a developer implements the functionality, which is not much more work than a developer implementing what you describe from scratch. Sounds like a modified version of a SplitView to be honest. Apologies, as I'm still struggling to see the benefit.

Vijay-Nirmal commented 7 years ago

@nmetulev Excuse me if I am saying something wrong.

Lets me consider myself a new developer then I will know about XAML Controls and Data Binding. Let us consider I want to implement MasterDetailsView with the Pull-To-Refresh feature. I know to achieve Pull-To-Refresh with RefreshContainer because it is very easy but If I want to implement Pull-To-Refresh in MasterDetailsView I want to re-Template the whole control and may be re-Data Bind to get the value from the new Control which I may not know because to re-template first I want to learn how the default template has been implemented. Now I think you can understand, to implement very simple and most used Pull-To-Refresh feature in Master View the developer has to understand the whole control in order to re-template it.

what you are describing feels like a bare-bone structure

That is exactly the reason to implement it. It won't be limited by anything. Also, can you think of any default control that is limited by anything? except MediaPlayerElement.

won't work unless a developer implements the functionality

The developer wouldn't have much work. They just need to enclose the same <DataTemplate> in <ListView>

Sounds like a modified version of a SplitView to be honest

I don't understand how you are comparing SplitView with this control.

Connected Animation in the next big thing in page navigation. How can we achieve Connected Animation with the current control?

skendrot commented 7 years ago

RefreshContainer isn't even in the docs yet so [new] developers do not know anything about it because they have no way to use it. There is a request (made by you) to replace the ListView with the PullToFreshListView control. I personally don't see anything wrong with this. There is also a request for a RefreshContainer from the Toolkit as a stopgap control. I'm happy to include this solution as well.

The key with this control is to make is very easy for anyone to use, especially new developers. I did investigate the possibility of being able to easily swap out the content of the master side:

Unfortunately, I do not believe that it is possible to add a default view to the master section and allow it to be customized without styling. Adding either a MasterTemplate or MasterControl property to the MasterDetailsView and having a default implementation makes it impossible to properly bind the ItemsSource, ItemTemplate, etc to the control itself without ancestor RelativeSource binding. Using TemplatedParent brings it to the ContentPresenter being used to display such a property.

I do agree that connected animations are lacking in this control. But making it harder to use is not the answer. And continuing to argue about using a control that isn't even released yet doesn't help either.

Vijay-Nirmal commented 7 years ago

@skendrot

making it harder to use is not the answer

I don't think this makes harder to implement MasterDetailsView. They just need to enclose the same <DataTemplate> in <ListView>. Sure, they need to handle Back Navigation but I don't think It is a hard part.

continuing to argue about using a control that isn't even released yet doesn't help either

Agree. So we will continue this discussion after Fall Creators Update. Also RefreshContainer is just an example control I gave you, I can many other controls like ScrollHeader, Loading etc

dave-c-whitney commented 7 years ago

As a novice in this entire area, I'd like to know how I'd get SemanticZoom into the list view portion of this control. If it's possible to do with templates or styles, could someone provide a detailed tutorial about how it's done? If it's not possible to do, that would be a further argument in favor of the original poster's request.

Vijay-Nirmal commented 7 years ago

@dave-c-whitney This tutorial may help you: https://mva.microsoft.com/en-us/training-courses/xaml-for-windows-10-controls-14482?l=yDKg0B8sB_604819052

Vijay-Nirmal commented 6 years ago

FCU was released. Is there is any hope for this issue?

nmetulev commented 6 years ago

I can see the benefit here, really, so there is hope. But I'm not sure if there is a big enough need in the community for it. If we do decide to do it, would you be able to do it? Either way, we should have user voice for it, can you create one?

Vijay-Nirmal commented 6 years ago

I have created UserVoice: Use ContentPresenter in MasterDetailsView instead of ListView

Can I spread the word about this UserVoice in other issues related to this one?

nmetulev commented 6 years ago

Of course :)

lucaasrojas commented 6 years ago

What's the current status of this issue?

Kyaa-dost commented 4 years ago

@Vijay-Nirmal What's the update on this one?

michael-hawker commented 4 years ago

@Vijay-Nirmal your details on requirements here sounds a lot like the TwoPaneView control provided by the platform now?

Is there a need here to do something specific in the toolkit to the MasterDetailView if a developer needing such flexibility has more building blocks now? Could we close this issue?

Kyaa-dost commented 4 years ago

Closing this for now as @michael-hawker already provided some related details on the request that could be useful.