troubleshooting Question

WPF/XAML - How to reference a static resource

Avatar of JElster
JElsterFlag for United States of America asked on
C#
19 Comments3 Solutions1075 ViewsLast Modified:
Hi..
I have a custom button... the XAML is JUST



<Button x:Class=".BaseTypes.NoteButton"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           Style="{StaticResource DefaultButton}">

   
</Button>


Along with code behind...
I get an error that the static resource cannot be found...

I've tried adding   the Resource Dictionary like this.. but it doesn't work either


<Button x:Class="LandonIP.PWBReader.BaseTypes.NoteButton"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           Style="{StaticResource DefaultButton}">
 
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/BaseTypes;component/StyleResource.xaml" />
            <ResourceDictionary         </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>


</Button>

How can I reference the static resource..? What's wrong with my XAML?
thx

ASKER CERTIFIED SOLUTION
MikeToole

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 19 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 19 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros