Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8769527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:22:02+00:00 2026-06-13T17:22:02+00:00

I made a ResourceDictionary in a WPF User Control Assembly. I Want to be

  • 0

I made a ResourceDictionary in a WPF User Control Assembly. I Want to be able to use this across this UserControl and have all the styles in this separated file.

The ResourceDictionary:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">    
    <Style x:Key="c1BtnX1">
        <Setter Property="Background" Value="Bisque"></Setter>
    </Style>    
</ResourceDictionary>

It’s Address is The User Control Assembly Resources/mainResX.xaml
and the View is in the same assembly/Views/view.xaml

The usage I think could be:

<Border Style="{StaticResource ResourceKey=c1BtnX1}" 
        BorderBrush="Black"  
        Width="20" 
        Height="20">
               <TextBlock Text="X" />
</Border>

Also I tried the below code inside the UserControl, to define Per Control Resources but this way also seems it couldn’t find the resources.

 <UserControl ... >
    <UserControl.Resources>
        <ResourceDictionary Source="../Resources/mainResX.xaml" />            
    </UserControl.Resources>

Where and How should I place/Define this ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:22:03+00:00Added an answer on June 13, 2026 at 5:22 pm

    I can’t tell what your file structure is from info provided.

    If the resource.xaml and control.xaml are in the same folder of the same assembly, you would just reference mainResX.xaml without “/Resources” first; otherwise you need to account for the file structure somehow.

    Are they in the same assembly? You can ‘walk’ the tree up with as many “../” strings prepended to the location as needed, and the in using the folders (ie, “../Resources/mainResX.xaml”)

    If they are in different assemblies, you need to specify a pack uri. You can actually always do this, although it is a little cumbersome when not necessary. Here is an example

    <ResourceDictionary Source="pack://application:,,,/MyAssembly.Wpf;component/Resources/mainResX.xaml" />
    

    HTH,
    Berryl

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made up this jsfiddle, which displays correctly in all browsers except ie (testing
Made this nice little loop for hiding and showing div's, works as a charm
I made a Web service in which I have a function to count some
I made a UITableViewCell and I have 20 rows in that table in which
I made myself a template for all JSPs in my webapp that keeps things
I'm once again in WPF binding hell :) I have a public class (
Made this custom alert box: <script type="text/javascript"> $(function () { var $alert = $('#alert');
Made a new project, added main.cpp and wrote the code at this URL: http://www.boost.org/doc/libs/1_43_0/doc/html/boost_asio/example/echo/async_tcp_echo_server.cpp
I made of subclass of UIView called Bubble using which i want to draw
I made this server class that starts a thread when new connection comes in.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.