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 have one ViewController, in this i have added one Custom UIView named as
I have a custom user control in XAML that creates a ItemsControl which ItemsPanel
So here's my problem: I've created a custom component which extends the Button This
I created custom module and now from admin side on edit form i added
I have included Django comments framework in my project, and added custom templates to
In one of the iPad Application, I am working I have added custom views
I have an activity with 2 fragments. I have added custom animations for fragment
I added a custom validation method to validate a password. However, it does not
I added some custom products in virtuemart from my custom component and added its
I have added a custom action to the CustomList type. For testing purposes I

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.