解决方案 »

  1.   

      <Style TargetType="{x:Type local:ExDataGrid}">
            <Setter Property="ColumnHeaderStyle" Value="{DynamicResource ExDataGridColumnHeaderKey}" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type local:ExDataGrid}">
                        <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="25"/>
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>可是这么写 把控件拖出去之后全是空白的 在里面添加了列也不显示  有没有高手会的啊 
      

  2.   

      <Grid.RowDefinitions>
                                    <RowDefinition Height="25"/>
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>datagrid不是这样实现的。它是里面有个itemscontrol。然后定义每行的模版就好了。你这个还是先学着做一个最基本的自定义控件开始吧。http://www.silverlightchina.net/html/study/WPF/2011/0820/9875.html