我是相當新的WPF,我已經嘗試找出如何添加一個Label出現下面的ListView這表明目前在ListView的項目數內。我在頂部給ListView填充以爲標籤騰出空間。嵌套一個ListView內的標籤在XAML
<ListView x:Name="MyListView" Grid.Row="0" Grid.Column="0" Margin="0,40,0,0" Padding="0" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<ListView.ItemTemplate>
<DataTemplate>
<WrapPanel>
<TextBlock Text="{Binding DatasetCode}" FontWeight="Bold"/>
</WrapPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
如果有人可以幫助我,它將不勝感激。
什麼是把'Label'的'ListView'內的點?如果你想要一個可重用的解決方案,爲什麼不編寫一個在單個組件中結合了一個'Label'和'ListView'的UserControl?你可能可以一起破解默認的'ListView.Template',但是IME通常比這樣的場景更值得痛苦。請更準確地解釋爲什麼'Label' _ has_成爲ListView的一部分。還請提供一個很好的[mcve],以顯示您已經嘗試過的內容,並清楚說明您獲得該功能的具體問題。 –
我想這是可行的,請張貼預期結果的一些屏幕截圖。 – pushpraj