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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:49:54+00:00 2026-05-15T13:49:54+00:00

Using the following code btn2 looks different to btn1 and btn3 yet they are

  • 0

Using the following code btn2 looks different to btn1 and btn3 yet they are using exactly the same image.

Public Class MyToolBar
    Inherits ToolBar

    Public Sub New()
        MyBase.New()

        Dim bmp1 = New BitmapImage(ImageUri.DeleteItem)
        Dim bmp2 = New BitmapImage(ImageUri.DeleteItem)
        Dim bmp3 = New BitmapImage(ImageUri.DeleteItem)
        Dim img1 = New Image With {.Source = bmp1}
        Dim img2 = New Image With {.Source = bmp2}
        Dim img3 = New Image With {.Source = bmp3}

        Dim btn1 = New Button With {.Content = img1}
        Dim btn2 = New MyButton With {.Content = img2}
        Dim btn3 = New Button With {.Content = img3}

        Me.AddChild(btn1)
        Me.AddChild(btn2)
        Me.AddChild(btn3)

    End Sub

End Class

Public Class MyButton
    Inherits Button
End Class

The only difference in the code is btn2 is constructed with MyButton. MyButton is a simple inheritance of Button, no other code.

btn1 & btn3 appear as expected; flat. btn2 appears semi raised and has a black border.

The order I add the buttons to the toolbar makes no difference. That is – the weird appearance of btn2 moves to the location that it is added to the toolbar.

I’ve dumped and compared the properties, to 2 levels, of btn1 and btn2 and there is only the expected differences except for:

btn1.DependencyObjectType.IsSecurityCritical=False
btn2.DependencyObjectType.IsSecurityCritical=True

and

btn1.DependencyObjectType.IsSecurityTransparent=True
btn2.DependencyObjectType.IsSecurityTransparent=False

Anything else I should look into?

  • 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-15T13:49:54+00:00Added an answer on May 15, 2026 at 1:49 pm

    Check you XAML for a default style that applies to MyButton.

    Update: The standard WPF themes include default styles for well-known controls. Your MyButton is not one of those. You need to extend the theme dictionary with style for your class, or you need to declare a default style for your class that is based on the Button style.

    Here’s the simplest style you can try adding to your resource dictionary (where local: is the XAML declaration of your CLR namespace – you need to add this to your root XAML element)

    <Style BasedOn="{StaticResource {x:Type Button}}"
           TargetType="{x:Type local:MyButton}" />
    

    Update 2: If your button is part of a toolbar, try this one instead (:-P):

    <Style BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
           TargetType="{x:Type local:MyButton}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following code. <% response.addHeader(Cache-Control,no-cache); response.addHeader(Pragma,no-cache,no-store,private,must-revalidate,max-stale=0,post-check=0,pre-check=0 ); response.addDateHeader (Expires, 0); %> It
I am using following code for notification. It should vibrate and make sound at
We are using following code for setters. if (is_numeric($id)) { global $db; $product =
I am using following code to render a JPEG file, which is on disk,
I am using following code to make a screen shot UIGraphicsBeginImageContext(self.view.frame.size); blendMode:kCGBlendModeClear alpha:1.0]; [self.view.window.layer
i'm using following code to set visibility=gone for a linear layout //onCreate method //setcontentview
I am using following code: slidingImageIconView=[[UIScrollView alloc]init]; [slidingImageIconScrollView setContentSize:CGSizeMake(110, 90)]; UIButton *iconImageSlide=[[UIButton alloc] init];
I am using following code I found from in the web to authenticate users
I am extracting metadata of a song using following code ,And how I can
I have upload the video on facebook using following code Help From : https://github.com/zoul/facebook-ios-sdk/

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.