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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:38:44+00:00 2026-06-05T09:38:44+00:00

I have a WPF window that is supposed to load two vector images from

  • 0

I have a WPF window that is supposed to load two vector images from XAML files. (Each one is in a separate file for easier modification in Expression Design.)

When I include the XAML files in a MergedDictionary, it works fine.
Here is the code I use:

<Window.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Images/LCCD logo.xaml" />
            <ResourceDictionary Source="Images/LCCD bottom image.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Window.Resources>

and

<Image Source="{Binding Source={StaticResource LCCDlogo}}" /> <!-- Simplified -->
<Image Source="{Binding Source={StaticResource LCCDbar}}" /> <!-- Simplified -->

However, I now need to add more to the Window’s resources. The new resource belongs to this Window so we want it to be in the same file instead of an included file.

When I add the following code between <Window.Resources> and <ResourceDictionary>, I get the following error:

Code

<Style TargetType="{x:Type tab:FabTabItem}">
        <Setter Property="Header" Value="{Binding Path=LabelText}"/>
        <Setter Property="HeaderTemplate">
            <Setter.Value>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" Margin="0,0,4,0">
                        <TextBlock Text="{Binding}" TextTrimming="CharacterEllipsis"/>
                    </StackPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Warning

The designer does not support loading dictionaries that mix
‘ResourceDictionary’ items without a key and other items in the same
collection. Please ensure that the ‘Resources’ property does not
contain ‘ResourceDictionary’ items without a key, or that the
‘ResourceDictionary’ item is the only element in the collection.

So I change the <ResourceDictionary> tag to this:

<ResourceDictionary x:Key="Images">

However, I don’t know how to access the resources inside this Dictionary now. How do you get the resources from inside a named ResourceDictionary?


EDIT

Never mind. This compiles but doesn’t run.

The error is:

”Resources’ property has already been set on ‘MainWindow’.

I guess I’ll have to do it some other way.

  • 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-05T09:38:45+00:00Added an answer on June 5, 2026 at 9:38 am

    According to the MSDN Page on MergedResourceDictionary’s it is legal but not common to define a resource in a resource dictionary that is specified in a MergedDictionary. From above page.

    It is legal to define resources within a ResourceDictionary that is specified as a merged dictionary, either as an alternative to specifying Source, or in addition to whatever resources are included from the specified source. However, this is not a common scenario; the main scenario for merged dictionaries is to merge resources from external file locations. If you want to specify resources within the markup for a page, you should typically define these in the main ResourceDictionary and not in the merged dictionaries.

    So give this a try to see if it works.

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Images/LCCD logo.xaml" />   
                <ResourceDictionary Source="Images/LCCD bottom image.xaml" />
                <ResourceDictionary>
                    <Style TargetType="{x:Type tab:FabTabItem}">
                        <Setter Property="Header" Value="{Binding Path=LabelText}"/>
                        <Setter Property="HeaderTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal" Margin="0,0,4,0">
                                        <TextBlock Text="{Binding}" TextTrimming="CharacterEllipsis"/>
                                    </StackPanel>
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF Window that open a modal child window to load some
I have a WPF window that I am launching from inside of a winform
I have a WPF / XAML Window that contains a ComboBox that is giving
I have a frame in a WPF window that I'm using to load an
This one has me beat; I have a WPF window with two (important for
At the moment I have a DocumentViewer in a WPF window that displays an
I have a WPF Windows application. In one window there is a particular stackpanel
I have a WPF window that uses validation. I created an error template that
In my application i have a WPF Window that has a DataGrid in it.
Suppose you have WPF Window composed of many elements that are using DataTemplates /

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.