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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:03:00+00:00 2026-06-13T01:03:00+00:00

<ResourceDictionary xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:local=clr-namespace:CuratioCMS.Client.UI.Controls> <Style BasedOn={StaticResource {x:Type Button}} TargetType={x:Type local:ImageButton}> <Setter Property=Template> <Setter.Value> <ControlTemplate

  • 0
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:local="clr-namespace:CuratioCMS.Client.UI.Controls">
<Style BasedOn="{StaticResource {x:Type Button}}" TargetType="{x:Type local:ImageButton}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type local:ImageButton}">
                <StackPanel Height="Auto" Orientation="Horizontal">
                    <Image Width="20"
                           Height="20"
                           Margin="10,4,0,4"
                           Source="{Binding Path=Image,
                                            RelativeSource={RelativeSource TemplatedParent}}"
                           Stretch="Fill" />
                    <TextBlock Margin="5,0,10,0"
                               HorizontalAlignment="Left"
                               VerticalAlignment="Center"
                               FontSize="12"
                               FontWeight="Bold"
                               Foreground="{TemplateBinding Foreground}"
                               Text="{TemplateBinding Label}" />
                </StackPanel>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

this is the code inside Generic.xaml for ImageButton custom control. whit works as expected but I can not inherit from Base button stale so instead of inheriting all base styling from Button this style only creates custom control without any base styles and as far as

BasedOn="{StaticResource {x:Type Button}}"

inside VS with line shows error which says Resource ‘{x:Type System.Windows.Controls.Button}’ is not found

I do not know how to achieve desired styling and why this error message is there showing up inside Visual studio editor

  • 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-13T01:03:02+00:00Added an answer on June 13, 2026 at 1:03 am

    You are defining a style based on a generic button style (which is inside Generic.xaml) and then redefining the template of the style. this way the base style will be overwritten.

    if you wish to change the style a bit, you got two options:

    option1:

    1. provide a key for the generic button style (find the style defined within Generic.xaml with TargetType="{x:Type Button}" and add x:Key="someName" to its properties)
    2. set the style of every other buttons (except for ImageButtons) to {StaticResource someName}
    3. set the BasedOn property of your ImageButton style to {StaticResource someName}

    option2:

    1. you can make a copy of the generic button style
    2. leave it generic by setting its TargetType to ImageButton and ‘not’ setting any key for it
    3. change the desired parts of it.

    option 2 is generally a better solution since it does not require lots of change, but I’ve been through what you wanted to do some time ago and I didn’t find any way to avoid duplicated style code.

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

Sidebar

Related Questions

MainWindow.xaml <Window x:Class=MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:my=clr-namespace:MyStuff;assembly=MyStuff Title=MainWindow Height=350 Width=525> <Grid> <TabControl Margin=5> <TabItem Header=Start
I have the below block of XAML 'BaseStyles.xaml <ResourceDictionary xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source=ShinyBlue.xaml/>
I have this context menu resource: <ResourceDictionary xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml> <ContextMenu x:Key=FooContextMenu> <ContextMenu.CommandBindings> <CommandBinding Command=Help
I have a ResourceDictionary that contains strings: <ResourceDictionary xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:sys=clr-namespace:System;assembly=mscorlib> <sys:String x:Key=Foo>Hello world</sys:String>
I have the following ResourceDictionary: <ResourceDictionary xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml> <Style x:Key=StyleComboBox TargetType={x:Type ComboBox}> <Setter Property=BorderBrush
One more easy one. Resources.xaml contains: <ResourceDictionary xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml> <DataTemplate DataType=TestInstanceViewModel x:Name=TestInstanceViewModelTemplate> <StackPanel Orientation=Vertical>
Hello, how to go from: <Application xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml x:Class=teste.App> <Application.Resources> <!-- Resources scoped at
Like so: <Window x:Class=WpfApplication3.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> <Window.Resources> <ResourceDictionary x:Key=whatever Source=colors.xaml />
How to fix this error? Error 1 XAML Namespace http://schemas.microsoft.com/winfx/2006/xaml is not resolved. <ResourceDictionary
In App.xaml I have the following code: <Application xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml x:Class=FJW.App> <Application.Resources> <!-- Resources

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.