【发布时间】:2019-08-05 12:53:07
【问题描述】:
目前这样做:
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Column="2">
<ListBox Name="lb_right" Background="Red">
<ListBox.Resources>
<DataTemplate DataType="{x:Type local:Textfeld_Template}">
<WrapPanel HorizontalAlignment="Stretch">
<Label Content="{Binding name}"></Label>
<TextBox Text="{Binding text}" HorizontalAlignment="Stretch"></TextBox>
<Label Foreground="Red" IsEnabled="{Binding Pflicht}">Pflichtfeld!</Label>
</WrapPanel>
</DataTemplate>
<DataTemplate DataType="{x:Type local:Datefeld_Template}">
<WrapPanel HorizontalAlignment="Stretch">
<Label Content="{Binding name}"></Label>
<DatePicker HorizontalAlignment="Stretch" Text="{Binding zeit,StringFormat='dd.MMM.yyyy'}"></DatePicker>
<Label Foreground="Red" IsEnabled="{Binding Pflicht}">Pflichtfeld!</Label>
</WrapPanel>
</DataTemplate>
</ListBox.Resources>
</ListBox>
</Grid>
填充我使用
ObservableCollection<Object> t = new ObservableCollection<Object>();
并将其设置为listview的Itemsource,工作正常,但是,它是一个listview,有没有像Wrappanel这样的Itemsource的元素?
【问题讨论】:
标签: c# wpf wrappanel itemsource