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

  • Home
  • SEARCH
  • 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 8150611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:07:06+00:00 2026-06-06T15:07:06+00:00

What is the difference between: <Style TargetType={x:Type Border}> and: <Style TargetType=Border> When and why

  • 0

What is the difference between:

<Style TargetType="{x:Type Border}">

and:

<Style TargetType="Border">

When and why do I need to use the {x:Type …} ?

  • 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-06T15:07:07+00:00Added an answer on June 6, 2026 at 3:07 pm

    There is no difference in effect; in both cases the TargetType property will be set to typeof(Border)

    The first version {x:Type Border} was needed in the first version of WPF because the compiler did not use the TypeConverter class to convert the string into a Type object and you needed to specify the TypeExtension class to do that for you.

    The second version was introduced, if I remember correctly, with Silverlight and quickly found its way to the WPF compiler.

    EDIT

    My assumption on the TypeConverter class was wrong; this is implemented by the FrameworkElementFactory:

    From the documentation:

    Type Properties That Support Typename-as-String

    WPF supports techniques that enable specifying the value of some
    properties of type Type without requiring an x:Type markup extension
    usage. Instead, you can specify the value as a string that names the
    type. Examples of this are ControlTemplate.TargetType and
    Style.TargetType. Support for this behavior is not provided through
    either type converters or markup extensions. Instead, this is a
    deferral behavior implemented through FrameworkElementFactory.

    Silverlight supports a similar convention. In fact, Silverlight does
    not currently support {x:Type} in its XAML language support, and does
    not accept {x:Type} usages outside of a few circumstances that are
    intended to support WPF-Silverlight XAML migration. Therefore, the
    typename-as-string behavior is built-in to all Silverlight native
    property evaluation where a Type is the value.

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

Sidebar

Related Questions

What is the difference between the following TargetType specifications? 1. <Style TargetType={x:Type Button} ...
Is there no difference between No media and media=all? <link rel=stylesheet type=text/css media=all href=style.css>
What is the difference between these two: font-style:italic font-style:oblique I tried using the W3Schools
Is there an actual difference between a const_cast and c style cast (ObjectType) ?
What is the difference between $(#myid).attr(style, visibility: hidden) and $(#myid).css(visibility, hidden) ?
what is difference between relative position and absolute position is CSS eg .style {
In javascript is there any difference between using element.style.setAttribute('width', '150px'); and element.style.width = '150px';
I already know the difference between old-style class (class Foo()...) and new-style class (class
Possible Duplicates: C++ cast syntax styles What is the difference between (type)value and type(value)
What is the difference between old style and new style classes in Python? When

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.