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 3978106
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:00:19+00:00 2026-05-20T05:00:19+00:00

I would ideally like to keep the resources for a window in a resource

  • 0

I would ideally like to keep the resources for a window in a resource dictionary, but am getting stuck as to the best way to make them known before you declare the window.resources section. So I wind up doing something like the code below.

Is there someway to reference the background image brush statically? How can I do better?

Cheers,
Berryl

<Window x:Class="Smack.ConstructionAdmin.Presentation.Wpf.Views.ProjectPicker.ProjectPickerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
...
    Background="{DynamicResource waveBrush}" 
    Icon="pack://application:,,,/MyAssembly;component/Images/Project_32.png" 
...
    >
<Window.Resources>
    <ImageBrush 
        x:Key="waveBrush" Stretch="Fill" ImageSource="pack://application:,,,/MyAssembly;component\Images\Wave.jpg" 
        />
</Window.Resources>
  • 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-05-20T05:00:20+00:00Added an answer on May 20, 2026 at 5:00 am

    In your projects Application.xaml file in the Application.Resources Section.

    Your could also use a standalone Resource File and include it in your windows xaml file or the Application.xaml file.

    <Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" Background="{DynamicResource MyBackColor}">
        <Window.Resources>
            <ResourceDictionary Source="Resources\MyResourceDictionary.xaml" />
        </Window.Resources>
        <Grid>
    
        </Grid>
    </Window>
    

    Or

    <Application x:Class="WpfApplication1.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary Source="Resources\MyResourceDictionary.xaml" />
    </Application.Resources>
    

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

Sidebar

Related Questions

I would like to animate movement on a SurfaceView . Ideally I would like
I have a route like following, ideally I would like it to match: domain.com/layout/1-slug-is-the-name-of-the-page
and it's linked to a 'confirm comment deleted page. Ideally I would like it
I would like to get a list of the wireless networks available. Ideally this
I would like to setup a multi-tenant ASP.NET MVC app. Ideally, this app would
I'd like to be able to unit test my Arduino code. Ideally, I would
I'm writing a Python+Qt4 application that would ideally need to pop up a window
I am new to Sweave/Tex and would like to keep my R code out
I'd like to make a rich text type editor using Core Text (ideally for
I have two HTML tables which would ideally be placed side by side on

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.