locked
Blend 4 Static Resources not Found - Newbie RRS feed

  • Question

  • As a newcomer to WPF, I'm finding it hard to find tutorials that are basic enough for me to follow and have enough content in them to show me the power of WPF or how to access more features than just creating a new button control that has a green background.  I thought I had found one that looked promising and began the tutorial.

    I believe it was exactly what I was looking for until I tried to run the completed project.  I was faced with 2 lines of auto-generated code that would not compile and all resources I found to try to explain it stated it was a problem with 'static resources' but the solutions are way above my head or vague/for experienced coders.

    The tutorial I ran: http://msdn.microsoft.com/en-us/library/cc295235%28v=expression.30%29.aspx

    The error I get:

    "Cannot find the static member 'InactiveSelectionHighlightTextBrushKey" on the type 'SystemColors'.

    The offending lines of code:

    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}"/>

    <Rectangle Margin="2" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>

    So looking at possible solutions all seem to be 'hacks' and no clear way (at least to me) to fix this issue is severely stunting my ability to learn how to use Blend considering the very first and basic MICROSOFT tutorial using a Microsoft product ends up being a complete failure.

    I realize that nothing is perfect but I look at some of the bug reports or forum posts regarding this problem date back to 2008.  Really, 2008? This bug has been going on for the better part of 3 years?

    I'm at somewhat of an impasse here and if you can't tell, I'm extremely frustrated and annoyed that something like this has been allowed to persist for so long.  I really don't know what to do as I've already said that most of the solutions are so vague I don't even know where to put the suggested code blocs nor does it give me any hope that this bug has been going on for 3+ years.

    I guess I'm asking for help with this but in a way that a beginner will understand and not a simple cut and paste of code without a bit of explanation.




    • Edited by tomlinjm Friday, December 7, 2012 6:44 PM Fixed the link
    Friday, December 7, 2012 1:28 PM

All replies

  • I get a 404 error when trying to load the uri above, so I can't see the tutorial you are following.

    Looking at the documentation page, it appears that the SystemColors class does not have the member you are trying to use, which is what the compiler is trying to say.

    http://msdn.microsoft.com/en-us/library/vstudio/ms603164(v=vs.100).aspx

    There is a pretty good resource here for learning Blend/Xaml/WPF/SL, I think most of the content is SL specific, but almost everything that works in SL should work fine in WPF:

    http://www.microsoft.com/design/toolbox/

    • Proposed as answer by Chuck HaysModerator Friday, December 7, 2012 3:00 PM
    • Unproposed as answer by tomlinjm Saturday, December 8, 2012 2:46 PM
    Friday, December 7, 2012 2:59 PM
    Moderator
  • Link was missing the ending 'x'.  It's fixed now.
    Friday, December 7, 2012 6:45 PM
  • http://www.kirupa.com/blend_wpf/index.htm in the advanced topics, middle of the page he has a tutorial on UserControls.

    ~Christine


    My Gallery - calControls

    Friday, December 7, 2012 7:23 PM