-2
我想改變列表視圖中選定項目的數據模板,我發現的一切都過於複雜或過時。 我試過使用行爲,但它仍然無法正常工作。這是我後改變列表視圖selecteditem datatemplate UWP
<UserControl.Rescources>
<DataTemplate x:DataType="dt" x:Key="notselected">
<Grid>
<Textblock Text="{Binding Title}" Foreground="White"/>
<Image Source="ms-appx:///Assets/myimage.png"/>
</Grid>
</DataTemplate>
<DataTemplate x:DataType="dt" x:Key="selected">
<Grid>
<Textblock Text="{Binding Title}" Foreground="Black"/>
<Image Source="ms-appx:///Assets/myselectedimage.png"/>
</Grid>
</DataTemplate>
</UserControl.Rescources>
<ListView x:Name="listview" ItemTemplate="{StaticResource TMP1}">
<ListView.ItemContainerStyle>
<StaticResource ResourceKey="ListViewItemStyle1"/>
</ListView.ItemContainerStyle>
什麼,只是有選擇的同時被 這可能切換到TMP2?
感謝
的可能的複製[UWP:DataTemplateSelector和的SelectedItem(https://stackoverflow.com/questions/44249232/uwp-datatemplateselector-and-selecteditem) –
我一直在玩這個解決方案的最後一個小時,我不能得到它的工作 – user1855290