我使用的是wpftoolkit中的一个数据报,并且遇到了rowdetailsTemplate的问题。
我的rowdetailTemplate包含3个项目:2个富文本框和一个按钮。我想要的是按钮保持停靠在窗口的右边缘,两个富文本框展开以填充其余的空间。我遇到的问题是,如果我将按钮停靠在窗口右侧,当我放大窗口时,按钮会正确移动并保持在外边缘,但是如果我将窗口向后收缩,它不会收缩并保持相同的间距。这会导致它位于窗口外且不可见。这是预期的行为吗?如果有人知道一个解决方法或解决方案来设置整个细节模板,如我所描述的,我会很感激一些建议。
相关代码:
<toolkit:DataGrid.RowDetailsTemplate>
<DataTemplate>
<DockPanel Width="Auto">
<DockPanel DockPanel.Dock="Right">
<Button Height="50" Width="75" Margin="5 5 0 5" DockPanel.Dock="Right">
<Image Source="Resources/ArrowOutOfBox.bmp" />
</Button>
</DockPanel>
<StackPanel Margin="20 0 20 0" Orientation="Horizontal" HorizontalAlignment="Left" DockPanel.Dock="Left">
<StackPanel>
<ToolBar>
<ToggleButton MinWidth="20" Command="EditingCommands.ToggleBold" CommandTarget="{Binding ElementName=rtbNewComment}" TextBlock.FontWeight="Bold" Content="B" />
<ToggleButton MinWidth="20" Command="EditingCommands.ToggleItalic" CommandTarget="{Binding ElementName=rtbNewComment}" TextBlock.FontStyle="Italic" Content="I" />
<ToggleButton MinWidth="20" Command="EditingCommands.ToggleUnderline" CommandTarget="{Binding ElementName=rtbNewComment}">
<TextBlock TextDecorations="Underline">U</TextBlock>
</ToggleButton>
</ToolBar>
<RichTextBox
x:Name="rtbNewComment"
Height="100"
Margin="5 5 0 5"
FlowDirection="LeftToRight"
VerticalScrollBarVisibility="Auto"
IsReadOnly="False"
SpellCheck.IsEnabled="true"
>
</RichTextBox>
</StackPanel>
<StackPanel>
<RichTextBox
x:Name="rtbCommentHistory"
Height="125"
Margin="5 5 0 5"
FlowDirection="LeftToRight"
VerticalScrollBarVisibility="Auto"
IsReadOnly="True"
SpellCheck.IsEnabled="true"
>
<RichTextBox.Resources>
<Style TargetType="{x:Type Paragraph}">
<Setter Property="Margin" Value="0" />
</Style>
</RichTextBox.Resources>
</RichTextBox>
</StackPanel>
</StackPanel>
</DockPanel>
</DataTemplate>
</toolkit:DataGrid.RowDetailsTemplate>