视觉工作室设计师不显示样式图像

时间:2012-02-21 12:45:13

标签: silverlight styles

在我的windowslight手机应用程序中,我在基本项目的主页上创建了这个xaml:

<phone:PhoneApplicationPage.Resources>
    <Style x:Key="TestStyle" TargetType="CheckBox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CheckBox">
                    <Grid x:Name="grid" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CheckStates">
                                <vsm:VisualState x:Name="Checked">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="image" Storyboard.TargetProperty="Source">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="ApplicationIcon.png"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Unchecked"/>
                                <vsm:VisualState x:Name="Indeterminate">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="image" Storyboard.TargetProperty="Source">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="ApplicationIcon.png"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <Image x:Name="image" Source="ApplicationIcon.png" Margin="0 0 0 10" Stretch="Fill" VerticalAlignment="Center" Width="32" Height="32"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</phone:PhoneApplicationPage.Resources>

<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <!--TitlePanel contains the name of the application and page title-->
    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
        <TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
        <TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <CheckBox Style="{StaticResource TestStyle}" />
    </Grid>
</Grid>

运行应用程序时,图像会在应用程序中正确显示,但不会在设计器中显示。 这很烦人,因为我不能设计我的应用程序。

有什么方法可以解决这个问题?解决方法?

提前感谢您提供任何帮助

1 个答案:

答案 0 :(得分:0)

应该是一个错误,混合它没关系