以下示例中的红色矩形被剪裁(最后一行除外),我想知道是否可以转换在单元格外的数据网格单元内转换控件?< / p>
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:System="clr-namespace:System;assembly=mscorlib" x:Class="WpfSamples.Transforms.TranslateOutOfContainer"
mc:Ignorable="d"
Title="TranslateOutOfContainer" Height="300" Width="300">
<Grid>
<DataGrid AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTemplateColumn Header="Test">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Canvas>
<Grid Canvas.Top="0" Canvas.Left="0" Width="10" Height="10">
<StackPanel ClipToBounds="False">
<Rectangle Fill="Red" Height="5">
<Rectangle.RenderTransform>
<TranslateTransform Y="3"/>
</Rectangle.RenderTransform>
</Rectangle>
</StackPanel>
</Grid>
</Canvas>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
<System:Object/>
<System:Object/>
<System:Object/>
</DataGrid>
</Grid>