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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:49:46+00:00 2026-06-11T05:49:46+00:00

My requirement is to apply multiple styles on a textbox having following situation: I

  • 0

My requirement is to apply multiple styles on a textbox having following situation:

  1. I have one style(e.g. MyTextStyle) in another file say ‘Generic.xaml‘
  2. my textbox is in ABC.xaml
  3. I want to apply some triggers to this Textbox so I have to use Textbox.Style
  4. I also want to apply “MyTextStyle“

when I do following it gives me error that I cannot apply DynamicResource to BasedOn:

<TextBox.Style>
                    <Style BasedOn="{DynamicResource MyTextStyle}" TargetType="{x:Type TextBox}">
                        <Setter Property="Text" Value="{Binding SelectedCall.Name}" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding SelectedCall.Name}" Value="N/A">
                                <Setter Property="Text" Value="" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </TextBox.Style>

please suggest me some solution so that I can apply this Dynamicresource as well as my datatrigger style

  • 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-11T05:49:48+00:00Added an answer on June 11, 2026 at 5:49 am

    Change DynamicResource to StaticResource like this:

    <Style BasedOn="{StaticResource MyTextStyle}" TargetType="{x:Type TextBox}">
    

    DynamicResource is intentionally not allowed in BasedOn.

    EDIT:
    You got “Cannot find resource named ‘EmptyTextBoxStyle'” because application can’t find this particular static resource. To help application to find it you need to use MergedDictionary. Here is the example of how to use it inside e.g. Window:

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Generic.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    

    Inside another ResourceDictionary you should use this as the following:

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Generic.xaml" />
    </ResourceDictionary.MergedDictionaries>
    

    You need to reference ResourceDictionary that contains definition for EmptyTextBoxStyle style in this way. So for example, if ‘EmptyTextBoxStyle’ is declared in Generic.xaml file and you’re using it in ABC.xaml you can just use the above XAML (of course, you need to update Source attribute according to your project structure).

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

Sidebar

Related Questions

I have a requirement where I need to transform one XML document to another
Requirement I have an application with 2 activities, say A and B , with
Requirement: I need to run multiple animations one by one. I'm using onAnimationEnd() to
I have a requirement to run a transform on a xml file. it is
I have a requirement to apply the ?? C# operator to JavaScript and I
I am programming a database. I have one requirement, I am unsure how to
I have a requirement to do the following. Pass a set of variables from
I have a simple requirement ; Apply desktop.css for larger screen sizes AND Apply
I have a image gallery, my requirement is to apply diffrent image sizes to
I have requirement to extend particular CSS style. For example, I'm using 3rd party

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.