<UserControl x:Class="DDCUI.CommDiagnosisWPFCtrl"
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" Height="950" Width="300">
<DockPanel LastChildFill="True">
<DataGrid DockPanel.Dock="Top" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Height="300" AutoGenerateColumns="False" Name="DGComm" CanUserResizeColumns="True" IsReadOnly="True" SelectedCellsChanged="DGComm_SelectedCellsChanged">
<DataGrid.Columns>
<DataGridTextColumn Header="No." Binding="{Binding Number}" Width="0.1*"/>
<DataGridTextColumn Header="Time" Binding="{Binding Time}" Width="0.1*" />
<DataGridTextColumn Header="Protocol" Binding="{Binding Protocol}" Width="0.15*" />
<DataGridTextColumn Header="Source" Binding="{Binding Source}" Width="0.15*" />
<DataGridTextColumn Header="Destination" Binding="{Binding Destination}" Width="0.15*" />
<DataGridTextColumn Header="Data" Binding="{Binding Data}" Width="0.5*" />
</DataGrid.Columns>
</DataGrid>
<TreeView DockPanel.Dock="Top" MinHeight="200" Name="TreeViewDecode"/>
<RichTextBox Name="RtbHexCode"/>
</DockPanel>
</UserControl>
由於某些原因,數據網格的MaxHeight屬性不起作用。也就是說,每當我將一個大表綁定到它時,它總是會溢出並隱藏RichTextBox和Treeview(實際上,它不應超過600像素並顯示垂直滾動條)。Datagrid MaxHeight屬性不起作用
而且DataGrid不顯示水平滾動條。
我該如何解決這個問題?
編輯:更新的代碼。 maxHeight屬性的工作,但現在水平滾動條顯示犯規