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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:53:54+00:00 2026-05-26T05:53:54+00:00

I am learning on to the concepts of WPF such as data binding, commands,

  • 0

I am learning on to the concepts of WPF such as data binding, commands, resources, element bindings, styles etc, which use markup extensions extensively, and i am having problem understanding the meaning behind the Markup classes, as they are being used beyond what i understand they should be used for. So here are a few points i need to clear:
(all code snippets are from Pro WPF in C# 2010 book)

  1. What is the meaning and use of Static extension? It can be used to
    declare static resources, which can be declared in as
    , but this xaml confuses me:

    <Button ... Foreground="{x:Static SystemColors.ActiveCaptionBrush}" >
    

    In {x:Static SystemColors.ActiveCaptionBrush}, what is the role
    of static here, and what will change if i use x:Dynamic here? The
    book says this xaml is equivalent to this codebehind:

    cmdAnswer.Foreground = SystemColors.ActiveCaptionBrush;

    This means that if i have a class with static properties, i should
    be able to use something like this:

    <Button ... Foreground="{x:Static MyClass.SomeStaticProperty}" >
    

    But it didn’t work, despite i had created a class, i tried using
    local:Static (referring to the local namespace) but VisualStudio
    didn’t allow me to use it. What is the proper method of achieving
    this?

  2. What is the meaning of Binding (beyond obvious meaning, what is
    happening when i am binding)? It is used for resource binding, or
    data or element binding. I was able to understand element binding,
    but binding to objects that are not elements caused problems. For
    example:

    <TextBlock Text="{Binding Source={x:Static SystemFonts.IconFontFamily},
    Path=Source}"></TextBlock>
    

    Here it is binding to the text to the SystemFonts.IconFontFamily
    property, what is the use of x:static in this case, and how to bind
    it to a property in a class that i have created? Also how to update
    the text property of the textfield if the value of the binding
    target changes? Due to binding, it should update by itself, is this
    the case?

    All the examples in the book make use of SystemFonts.IconFontFamily,
    none that i have seen explains the use of such binding, and how to
    do it for the classes that i create? Some help in this regard is
    needed. I want to ask more about binding, but i will do so in a
    separate question about binding only.

  3. Finally, recommend a book or resource that explains what is
    happening, instead of how to do this and that?

  • 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-26T05:53:55+00:00Added an answer on May 26, 2026 at 5:53 am

    Answers….

    1)

    You said …


    … This means that if i have a class with static properties, i should be
    able to use something like this:

       <Button ... Foreground="{x:Static MyClass.SomeStaticProperty}" >
    

    But it didn’t work, despite i had created a class, i tried using
    local:Static (referring to the local namespace) but VisualStudio
    didn’t allow me to use it. What is the proper method of achieving
    this?


    Well your trial attempt was correct but it was incorrect to what term you have applied that namespace token to…. local namespace token applies to the class that is declared under it so…

       <Button ... Foreground="{x:Static local:MyClass.SomeStaticProperty}" >
    

    Should work just fine provided that SomeStaticProperty is a valid Brush.

    In this example, the whole markup was internally equivalent to Binding as …

       Binding.Source = {x:Type local:MyClass}
       Binding.Path = SomeStaticProperty.
    

    2)

    You had an example…


       <TextBlock Text="{Binding Source={x:Static SystemFonts.IconFontFamily},     
                                 Path=Source}">
       </TextBlock>  
    

    So use the same equivalence from example 1 and apply it to this example…

        <TextBlock Text="{Binding Source={x:Type SystemFonts},     
                                  Path=IconFontFamily.Source}">
        </TextBlock>  
    

    3)

    I learned this whole thing from MSDN… I dont think we can have any other legitimate source than that.

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

Sidebar

Related Questions

I'm learning the ins and outs of creating custom controls in WPF. The concepts
I am currently learning java, I understand the concepts except Graphics which as a
I am learning concepts related to .NET framework. I am confused at one point.
I am learning the concepts of Test-Driven Development through reading the Craftsman articles (click
I'm learning the difference between these to concepts. I want to build a public
I'm learning Silverlight and am trying to ingest some new concepts. Just so I
When learning a langugage, I routinely find myself prototyping new concepts outside of the
Learning WPF nowadays. Found something new today with .Net dependency properties. What they bring
I'm still learning Sharepoint and all of its various concepts, so apologies in advance
I'm currently in the beginning of learning WCF, as some of the concepts and

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.