阅读背景:

在自定义控件模板中找不到资源

来源:互联网 
<ResourceDictionary xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:local="clr-namespace:CuratioCMS.Client.UI.Controls">
<Style BasedOn="{StaticResource {x:Type Button}}" TargetType="{x:Type local:ImageButton}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type local:ImageButton}">
                <StackPanel Height="Auto" Orientation="Horizontal">
                    <Image Width="20"
                           Height="20"
                           Margin="10,4,0,4"
                           Source="{Binding Path=Image,
                                            RelativeSource={RelativeSource TemplatedParent}}"
                           Stretch="Fill" />
                    <TextBlock Margin="5,0,10,0"
                               HorizontalAlignment="Left"
                               VerticalAlignment="Center"
                               FontSize="12"
                               FontWeight="Bold"
                               Foreground="{TemplateBinding Foreground}"
                               Text="{TemplateBinding Label}" />
                </StackPanel>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
<ResourceDictionary xmlns="https://schemas.micr



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: