日期:2014-05-17  浏览次数:20839 次

WPF,这段代码为什么报错,却能运行?

<Window.Resources>
    <ControlTemplate x:Key="ResizeDecoratorTemplate" TargetType="Control">
        <Grid>
            <local:ResizeThumb Height="3" Cursor="SizeNS" Margin="0 -4 0 0"
        VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
            <local:ResizeThumb Width="3" Cursor="SizeWE" Margin="-4 0 0 0"
        VerticalAlignment="Stretch" HorizontalAlignment="Left"/>
            <local:ResizeThumb Width="3" Cursor="SizeWE" Margin="0 0 -4 0"
        VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
            <local:ResizeThumb Height="3" Cursor="SizeNS" Margin="0 0 0 -4"
        VerticalAlignment="Bottom"  HorizontalAlignment="Stretch"/>
            <local:ResizeThumb Width="7" Height="7" Cursor="SizeNWSE" Margin="-6 -6 0 0"
        VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <local:ResizeThumb Width="7" Height="7" Cursor="SizeNESW" Margin="0 -6 -6 0"
        VerticalAlignment="Top" HorizontalAlignment="Right"/>
            <local:ResizeThumb Width="7" Height="7" Cursor="SizeNESW" Margin="-6 0 0 -6"
        VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
            <local:ResizeThumb Width="7" Height="7" Cursor="SizeNWSE" Margin="0 0 -6 -6"
        VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
        </Grid>
    </ControlTemplate>
    <Style TargetType="Button">
        <Setter Property="Template" >
            <Setter.Value>