代码如下:
<ListView Name="dataGrid" Grid.Row="1" Grid.Column="0">
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="140"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Grid.Row="1" Grid.Column="0" Content="回复人:" FontSize="15" HorizontalAlignment="Right"></Label>
<Label Grid.Row="1" Grid.Column="1" FontSize="15" Content="{Binding Path=UserNameColumn}"></Label>
<Label Grid.Row="2" Grid.Column="0" Content="所属机构:" FontSize="15" HorizontalAlignment="Right"></Label>
<Label Grid.Row="2" Grid.Column="1" FontSize="15" Content="{Binding Path=GROUPNAMEColumn}"></Label>
<Label Grid.Row="3" Grid.Column="0" Content="回复日期:" FontSize="15" HorizontalAlignment="Right"></Label>
<Label Grid.Row="3" Grid.Column="1" FontSize="15" Content="{Binding Path=ReplyDateColumn}"></Label>
<TextBox Grid.Row="0" Grid.RowSpan="5" Grid.Column="0" Grid.ColumnSpan="3" Text="{Binding Path=ReplyContentColumn}"></TextBox>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
假如绑定的是数据对象集合的话,怎么实现?
list<数据对象>
<ListView Name="dataGrid" Grid.Row="1" Grid.Column="0">
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="140"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Grid.Row="1" Grid.Column="0" Content="回复人:" FontSize="15" HorizontalAlignment="Right"></Label>
<Label Grid.Row="1" Grid.Column="1" FontSize="15" Content="{Binding Path=UserNameColumn}"></Label>
<Label Grid.Row="2" Grid.Column="0" Content="所属机构:" FontSize="15" HorizontalAlignment="Right"></Label>
<Label Grid.Row="2" Grid.Column="1" FontSize="15" Content="{Binding Path=GROUPNAMEColumn}"></Label>
<Label Grid.Row="3" Grid.Column="0" Content="回复日期:" FontSize="15" HorizontalAlignment="Right"></Label>
<Label Grid.Row="3" Grid.Column="1" FontSize="15" Content="{Binding Path=ReplyDateColumn}"></Label>
<TextBox Grid.Row="0" Grid.RowSpan="5" Grid.Column="0" Grid.ColumnSpan="3" Text="{Binding Path=ReplyContentColumn}"></TextBox>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
假如绑定的是数据对象集合的话,怎么实现?
list<数据对象>
解决方案 »
- 高分求简单程序!急!
- 在向服务器发送请求时发生传输级错误。 (provider: 共享内存提供程序, error: 0 - 管道的另一端上无任何进程。)
- log4net的一个问题?
- C#中在循环里如何生成多个lable组件????
- VS2003如何对C#分成多个文件编写
- DataGridView的问题 请求高手解答谢谢
- 我就不信邪!难到大家都没有遇到过这样的问题?
- c#写一个界面来控制某个软件
- 安装vs2005后,再卸载vs2003时说什么安装程序无法确定安装的有效顺序
- 关于DataGrid的数据源的问题
- CuteEditor控件放到DetailsView中后有一些按键不能用
- 在控制台上能否输入一个名字创建一个类的实例?
<ListView.View>
<GridView>
<GridViewColumn Header="source" DisplayMemberBinding="{Binding source}"/>
<GridViewColumn Header="destination" DisplayMemberBinding="{Binding destination}"/>
</GridView>
</ListView.View>
</ListView>
楼主自己思考一下如何重构代码