2014-03-27 73 views
1

調整寬度,高度的行和列的DataGrid中如何避免由用戶調節寬度,高度的行和列的DataGrid如何避免用戶

這是我的XAML代碼:

<DataGrid 
    Name="MarkDG" 
    ItemsSource="{StaticResource Marks}" 
    IsReadOnly="True" 
    HorizontalAlignment="Left" 
    Margin="323,179,0,0" 
    VerticalAlignment="Top" 
    AutoGenerateColumns="False" 
    ColumnWidth="150" 
    HeadersVisibility="Column" 
    VerticalScrollBarVisibility="Auto" 
    FrozenColumnCount="1"> 
    <DataGrid.Columns> 
     <DataGridTextColumn Binding="{Binding Path=StuNo}" Header="Student No" /> 
     <DataGridTextColumn Binding="{Binding Path=MarkSet}" Header="Mark Obtained"/> 
    </DataGrid.Columns> 
</DataGrid> 

最初DataGrid似乎是
enter image description here
但是用戶可以移動DataGrid如下所示
enter image description here
如何避免這種情況?

+0

謝謝你,我會正確的格式在未來 – Dhinesh

回答