至於我能理解你需要一些控制,可以顯示動態內容(文本/圖片)。我可以建議你使用內容控件,根據當前的數據上下文選擇其內容DataTemplate。 我會在幾分鐘內提出一個完整的解決方案。
<ContentControl Content="{Binding CurrentControlContent.Content}">
<ContentControl.Resources>
<DataTemplate DataType="{x:Type soSandBoxListView:SingleTextModel}">
<TextBlock Text="{Binding SingleModelContent}" Background="Tan"></TextBlock>
</DataTemplate>
<DataTemplate DataType="{x:Type soSandBoxListView:MultipleTextModel}">
<StackPanel>
<TextBlock Text="{Binding FirstName}" Background="Yellow"></TextBlock>
<TextBlock Text="{Binding LastName}" Background="Red"></TextBlock>
<!--use the binding to your picture presentation in model-->
<Image Source="Resources/yotveta.jpg" Stretch="None"></Image>
</StackPanel>
</DataTemplate>
</ContentControl.Resources>
</ContentControl>
問候
非常感謝您的回答,先生。這可以使用Windows窗體完成嗎? –
@OkwuPrecious嗨,我確定在winforms中有這樣做的能力,但我無法幫助你。對不起;)。 – Ilan