2013-03-03 2 views
0

를주고 내가이 안에 두 DataGrids를 다음과 같은 UserControl을 :WPF DataGrid에 일관성이 수직 정렬

class Order { 
    public string station; 
    public float price; 
} 
    ... 
foreach (Order order in parse_orders(xml, "sell_orders")) 
    sell_orders.Rows.Add(new object[] {order.station, order.price}); 

그리고이 결과 : screenshot

내가 두 DataTables로를 연결

<UserControl x:Class="emb.OrdersControl" 
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> 
    <Grid> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="200*" /> 
      <RowDefinition Height="100*" /> 
     </Grid.RowDefinitions> 
     <DataGrid AutoGenerateColumns="True" Name="dgSell" IsReadOnly="True" CanUserResizeRows="False"></DataGrid> 
     <DataGrid AutoGenerateColumns="True" Grid.Row="1" Name="dgBuy" IsReadOnly="True" CanUserResizeRows="False" /> 
    </Grid> 
</UserControl> 

고정 된 높이를 설정하면 스테이션 텍스트의 맨 아래가 잘립니다. 정렬을 설정해도 아무런 효과가 없습니다.

답변

2

ah. 게시 직후에 실현했습니다.

필자가 입력하는 텍스트에는 XML을 파싱하기 전후에 많은 공백과 개행 문자가 있습니다.