1
我想用一個例子來說明問題:如何動態添加包含ListView的HubSections?
- 獲得的視頻類型項目(喜劇,動作,...),每個包含來自web服務器的視頻項目的列表(編號列表的流派和視頻不能修復)
- 在包含resp列表的單獨HubSection中顯示每個流派。視頻項目
- 選擇視頻(列表項)觸發動作(如啓動播放器,打開信息框,...)
我所知道的: - 通過C#
myhubtest.cs添加HubSection
HubSection hubSection = new HubSection();
hubSection.Header = "My Title";
...
this.MyHub.Sections.Add(hubSection);
myhubtest.xaml:
<Hub x:Name="MyHub" SectionHeaderClick="Hub_SectionHeaderClick">
...
通過C#添加一個DataTemplate myhubtest.cs
對象xHubListTemplate; this.Resources.TryGetValue(「xHubListTemplate」,out xHubListTemplate); DataTemplate xHubListDataTemplate = xHubListTemplate as DataTemplate; hubSection.ContentTemplate = xHubListTemplate as DataTemplate;
的App.xaml
<DataTemplate x:Key="xHubListTemplate">
<ListView x:Name="xHubListView" IsItemClickEnabled="True"
Margin="0,0,0,0"
...
</ListView>
</DataTemplate>
如何的ItemsSource和ItemsTemplate和項目單擊分配?
你已經找到了一個解決方案? – NBoymanns