3
我在xaml頁面中具有帶datatemplate的樣式,如下所示。將數據模板設置爲適合silverlight datgrid列標題
<
Style x:Name="mytemplate" x:Key="mytemplate" xmlns:dataprimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"
TargetType="dataprimitives:DataGridColumnHeader">
<Setter Property="ContentTemplate" >
<Setter.Value>
<DataTemplate>
<StackPanel Background="Aqua" Height="{Binding this.DataGridColumnHeader.Height}" Width="{Binding this.DataGridColumnHeaderWidth}" >
<TextBlock Text="{Binding}" HorizontalAlignment="Center" FontWeight="Black" ></TextBlock>
<TextBox x:Name="{Binding}" Padding="0,-1,0,0" HorizontalAlignment="Stretch" Width="100" Height="20" KeyDown="txtfilterBox_KeyDown" LostFocus="txtfilterBox_LostFocus" />
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
此樣式將應用於silverlight datgrid列標題樣式。 現在我想要模板內的堆棧面板與 silverlight datgrid列標題的高度和寬度相同?那麼怎麼做呢?
要不然怎麼舒展內容模板來佔滿DataGrid列標題