v5.0.0 of the Windows Community Toolkit dropped support for the Creators Update (15063). Now I want to manually backport the MasterDetailsView XAML Control.
I've already included the following files from the Windows Community Toolkit v5.0.0 MasterDetailsView XAML Control source code in my project:
If I now create one with the following XAML code:
xmlns:masterdetailsview1="using:ProjectName.Toolkit.MasterDetailsView"
<masterdetailsview1:MasterDetailsView x:Name="chats_mdv"
Grid.Row="1"
Background="Transparent"
DetailsTemplate="{StaticResource DetailsTemplate}"
ItemTemplate="{StaticResource MasterTemplate}"
ItemsSource="{x:Bind ViewModel.CHATS_ACV}"
MasterPaneBackground="{StaticResource AppBackgroundAcrylicElementBrush}"
NoSelectionContentTemplate="{StaticResource NoSelectionTemplate}"
SelectedItem="{x:Bind ViewModel.SelectedItem, Mode=TwoWay}"/>
The result of the code above is a MasterDetailsView XAML Control without any behavior. I can't interact with it. It's stuck in the master pane only mode. It does not react if I click on any master item to view it.
Which files do I have to include in my project for this to work?
The result of the code above is a MasterDetailsView XAML Control without any behavior. I can't interact with it. It's stuck in the master pane only mode. It does not react if I click on any master item to view it.
I followed your steps to make a code sample to test. I can reproduce your issue. The problem was that it cannot find the MasterDetalsView.xaml
resource file when the OnApplyTemplate()
method get called.
To solve this issue, open your project's App.xaml and add the following resource in it.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/MasterDetailsView/MasterDetailsView.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
My project's directory structure like the following:
You need to change the source by your own project's directory structure.