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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:32:11+00:00 2026-05-12T20:32:11+00:00

I added custom named styles to the app.xaml. I created an external resource dictionary

  • 0

I added custom named styles to the app.xaml.

I created an external resource dictionary (which I attach in the merged dictionaries of the app.xaml) and when I try to use one of the above named styles in the rcource dictionary, it says that there is no such style.

Also the default styles (i.e. unnamed styles that apply for the entire application) don’t apply on the template elements.

Note: The Build Action of the templates is ‘Page’.


Here is an example of how my code is written:

<Application x:Class="Application"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    
    ShutdownMode="OnExplicitShutdown">
    <Application.Resources>
        <ResourceDictionary>

            <Style
                    x:Key="StackPanelStyle" 
                    TargetType="StackPanel" 
                    BasedOn="{StaticResource {x:Type StackPanel}}">
                <Setter Property="Margin" Value="5"/>
                <Setter Property="Orientation" Value="Horizontal" />
                <Setter Property="Height" Value="40"/>
            </Style>

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Templates/DataTemplate1.xaml"/>
                <ResourceDictionary Source="/Templates/DataTemplate2.xaml"/>
                <ResourceDictionary Source="/Templates/DataTemplate3.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

This an example of the data template:

<DataTemplate DataType="{x:Type Entity}" x:Key="NameDataTemplate">
    <Expander>
        <StackPanel>
            <--The following line produces: StackPanelStyle was not found.-->
            <StackPanel Style="{StaticResource StackPanelStyle}">
                <Label Content="Name:"/>
                <TextBox Text="{Binding Name}"/>
            </StackPanel>
        </StackPanel>
    </Expander>
</DataTemplate>

Any ideas?
Do I have to merge the dictionaries in a different 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-05-12T20:32:11+00:00Added an answer on May 12, 2026 at 8:32 pm

    The code won’t work well because the DataTemplate in the resource dictionary doesn’t know which one is using it, it just been used. Like Hollywood mode. They compiled separately.

    To make this work, you can put your style which in app.xaml in the same resource dictionary of the DataTemplate or if you don’t like this coupling, you can put it in a different resource dictionary, and merge it into the DataTemplate’s resource dictionary.

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

Sidebar

Related Questions

I created custom membership provider for asp.net mvc applications and it all works fine
I managed to do almost all the way towards happiness with my custom form
I've got some problems adding a excel document as attachment on a custom list.
I am trying to handle add a custom field to a user profile using
I have a custom error script that displays custom error messages on a page
Hopefully someone can help, I've been playing with ASP.NET MVC 2 for a learning
I am trying to replace the JavaScript onclick event handler in ASP.NET that is
Is there a way to program using pure python in Xcode? I want something
I have a group of text boxes that have required field validation hooked up
So my problem may be a little bigger than that, but I'm not certain.

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.