Style property - BasedOn - causing issue RRS feed

  • Question

  • Hi,

    I am hacking together some code from the internet to make a store app...but am having a problem with one part.

    I have a button which has a style on it.  This style is based on another style...BasedOn="{StaticResource GlyphButtonStyle}"...see below.  NB I have striped out some code to make it simple.

    Whenever I have the 'based on' part in the first style then the project will not debug into the breakpoint on page load....it just shows a black page.  Once I remove the 'based on' part then it debugs into the breakpoint on page load.  NB The button looks fine on the xaml page in VS. 

    Am I missing something?




            <Style TargetType="Button" x:Key="AddGlyphButton" BasedOn="{StaticResource GlyphButtonStyle}">
                <Setter Property="AutomationProperties.Name" Value="Add a New" />
                <Setter Property="Content" Value="&#xE109;" />


     <Style TargetType="Button" x:Key="GlyphButtonStyle">
            <Setter Property="FontFamily" Value="Segoe UI Symbol" />
            <Setter Property="Margin" Value="0" />
            <Setter Property="Padding" Value="0" />
            <Setter Property="FontSize" Value="18" />

    Friday, May 16, 2014 10:52 AM

All replies

  • I could not reproduce this using Windows 8.1 VS2013 Update 2.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, May 16, 2014 7:22 PM
  • Hi,

    Sorry I should have included all relevant code.

    I have the above code in a resource dictionary file...this is all the code you will need in the file.  Then in my xaml page...which has a reference to the resource dictionary file...I have the below code.

     <Button    AutomationProperties.Name="Add a Receipt" Margin="128,10,10,10"
                                        Style="{StaticResource AddGlyphButton}" />

    Thanks for all help.

    Sunday, May 18, 2014 8:42 PM