代码如下:
<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<数据对象>

解决方案 »

  1.   

    你看一下http://blog.sina.com.cn/woheaven
      

  2.   

    <ListView x:Name="listViewRegistry" Margin="0" ItemsSource="{Binding Registry}">
    <ListView.View>
    <GridView>
    <GridViewColumn Header="source" DisplayMemberBinding="{Binding source}"/>
                <GridViewColumn Header="destination" DisplayMemberBinding="{Binding destination}"/>
    </GridView>
    </ListView.View>
    </ListView>
      

  3.   

    其中Registry是一个Collection对象,里面包含着RegistryKey对象的集合。source和destination是RegistryKey的两个属性。
    楼主自己思考一下如何重构代码