microsoft / xaml-standard

XAML Standard : a set of principles that drive XAML dialect alignment
Other
805 stars 50 forks source link

DataTemplate type #187

Open weitzhandler opened 7 years ago

weitzhandler commented 7 years ago

I haven't found any evidence of the existence of DataTemplate and DataTemplateExtension in the Standard. It's a very essential tool that is implemented in all XAML providers, including Xamarin.

crutkas commented 7 years ago

This needs more information. What is etc implying? if something is missing, please create a new issue for each item.

GeraudFabien commented 7 years ago

•What you are proposing and why it belongs in XAML Standard: I propose a control that allow user to personnalise how data will be display by a control 0 Widely used APIs: It mandatory to custom all List control source 0 Ubiquitous APIs : Exist in WPF, SilverLight, UWP and Xamarin.form. It not really tied to a specific native implementation (Hard to say). Framework can add to this technologie and it the goal of this technologie (Making new control that display/organise data differently). They also can add default datatemplate,...,. •Provide a clear usecase/scenario Show a List of element •Add a brief example in XAML syntax for your proposal. I propose a Tag use by a control that display data given by a source. The tag will be display (reuse) foreach item to display The currentItem data will be accessible with datacontext From WPF documentation in msdn

<ListBox Width="400" Margin="10"
         ItemsSource="{Binding Source={StaticResource myTodoList}}">
   <ListBox.ItemTemplate>
     <DataTemplate>
       <StackPanel>
         <TextBlock Text="{Binding Path=TaskName}" />
         <TextBlock Text="{Binding Path=Description}"/>
         <TextBlock Text="{Binding Path=Priority}"/>
       </StackPanel>
     </DataTemplate>
   </ListBox.ItemTemplate>
 </ListBox>

•Provide links to issues/discussions where this proposal has been talked about as well as any other : All controls that should display a List (https://github.com/Microsoft/xaml-standard/issues/24, https://github.com/Microsoft/xaml-standard/issues/88) Those repo may be related All the "panel" control may use somethinks like ItemControl and use it. all the View may use it also (ex: #175, #166).

charlesroddie commented 5 years ago

This was really badly done in WPF (which was written without generics) and Xamarin (which copied WPF). Ultimately a properly implemented DataTemplate<T> is a function T->View. So this is past the limit of what XAML can handle. The mistakes of WPF/Xamarin were to extend the limitations of XAML into the DataTemplate type itself!

Happypig375 commented 5 years ago

For non-F# users, a function T->View is System.Func<T, View>.