Binding in Style Setters – SilverLight 5 Beta

Silverlight 5  introduces Binding in style Setters. Hence you can use Binding, StaticResource or any markup extension inside the style Setters.
Let you have a class that defines your resource based on some custom logic :

public class MySettings 
    public Thickness Margin {get;set;}

Now from your style setters you can easily point to the class to get the value of the Thickness.

<local:MySettings x:Key="msettings" />
    <Setter Property="Margin" Value="{Binding MyMargin, Source={StaticResource msettings}}" />

In the code, it will bind the msettings object and pull the data from MyMargin.

Abhishek Sur

Abhishek Sur is a Microsoft MVP since year 2011. He is an architect in the .NET platform. He has profound theoretical insight and years of hands on experience in different .NET products and languages. He leads the Microsoft User Group in Kolkata named KolkataGeeks, and regularly organizes events and seminars in various places for spreading .NET awareness. He is associated with the Microsoft Insider list on WPF and C#, and is in constant touch with product group teams. He blogs at His Book : Visual Studio 2012 and .NET 4.5 Expert Development Cookbook. Follow Abhishek at Twitter : @abhi2434

58 Comments to “Binding in Style Setters – SilverLight 5 Beta”

  1. I was extremely pleased to discover this web-site.I wanted to good time because of this wonderful read!! I definitely enjoying every bit of it and I maybe you have bookmarked to view new stuff you short article.

  2. Very informative and useful post. You have nice command on the post and have explained in a very great way. Thanks for helping .Good work,hope your blog be better!I just want to make a blog like this!

  3. Please tell me that youre going to maintain this up! Its so excellent and so critical. I cant wait to read a lot more from you. I just feel like you know so considerably and know the best way to make men and women listen to what you’ve got to say. This blog is just too cool to be missed. Wonderful stuff, really. Please, PLEASE maintain it up!

  4. Wow, what a weblog! I mean, you just have so much guts to go ahead and tell it like it really is. Youre what blogging requirements, an open minded superhero who isnt afraid to tell it like it really is. This is definitely something men and women have to be up on. Excellent luck in the future, man.

  5. Thank you for this blog. Thats all I can say. You most certainly have made this weblog into something thats eye opening and essential. You clearly know so much about the subject, youve covered so numerous bases. Fantastic stuff from this component of the world wide web. Once more, thank you for this weblog.

  6. about the most recent posts are fantastic quality bootcamp guess I’ll add you into my daily bloglist,would you mind writing your weblog with even more data,2

  7. How-do-you-do, just necessary you to know I’ve added your web site to my Google bookmarks because of your extraordinary blog layout. But seriously, I feel your internet site has one of the freshest theme I’ve came across. It genuinely assists make reading your weblog a whole lot less difficult.

  8. Great blog! I dont believe Ive seen all of the angles of this subject the way youve pointed them out. Youre a accurate star, a rock star man. Youve got so a lot to say and know so much about the subject that I think you should just teach a class about it…HaHa!

  9. I’m typically to running a blog and i really admire your content. The article has really peaks my interest. I’m going to bookmark your web site and hold checking for brand new information.

  10. Göcek; ülkemizin güney batısında yer alan güzel bir tatil beldemizdir. Yaz kış tatil imkanı bulabildiğiniz Göcek’de yazları denizin, kumsalın, güneşin ve parlayan maviliklerin tadını çıkartabilirken, kış aylarında da yaz aylarına göre daha sakin olan Göcek’de doğayla içiçe sessiz ve huzurlu bir tatil geçirebiliriniz. Kış ayları genellikle çok sert geçmemektedir ve yöre halkı kış aylarında bazen denize bile girebilmektedir. İklimi tipik Akdeniz ilkimidir ve zengin bitki örtüsüne sahiptir. Göcek’de kendinizi engin maviliklerin ve her tondan yeşilin içinde bulacaksınız. Göcek de sıradan tatil anlayışınız biraz değişebilir. Deniz, kum ve güneş ve dinlenme olan tatil

  11. I’m impressed, I have to say. Actually not often do I encounter a weblog that’s each educative and entertaining, and let me let you know, you might have hit the nail on the head. Your idea is outstanding; the issue is something that not sufficient people are speaking intelligently about. I’m very joyful that I stumbled throughout this in my search for one thing regarding this.

  12. I do consider all the ideas you have presented on your post. They’re very convincing and can certainly work. Nonetheless, the posts are too brief for newbies. May just you please prolong them a bit from next time? Thank you for the post.

  13. whoah this blog is great i love studying your articles. Stay up the great paintings! You understand, lots of people are hunting around for this information, you could help them greatly.

  14. I was just seeking this info for some time. After six hours of continuous Googleing, at last I got it in your web site. I wonder what is the lack of Google strategy that don’t rank this kind of informative sites in top of the list. Usually the top web sites are full of garbage.

  15. That is the right blog for everyone who truly wants to learn about this matter. You understand such a lot its almost difficult to argue with you (not that I actually would…HaHa). You certainly put a completely new spin on a subject thats been written about for years. Excellent stuff, superb!

  16. I have read some of the comments posted here with dismay. I agree with the poster that there is more to this than anyone realizes.

  17. I don’t understand how anyone can read this and not think “genius alert”. Great article. I’ll keep coming back to see even more.

  18. Good day very cool website!! Man .. Beautiful .. Amazing .. I’ll bookmark your web site and take the feeds also…I am happy to search out numerous helpful information here within the publish, we need develop extra techniques on this regard, thanks for sharing.

  19. You really make it appear so easy along with your presentation however I to find this matter to be actually one thing that I feel I might never understand. It kind of feels too complex and very broad for me. I am taking a look ahead to your subsequent put up, I will try to get the hang of it!

  20. I think other web-site proprietors should take this web site as an model, very clean and fantastic user genial style and design, let alone the content. You’re an expert in this topic!

  21. Great – I should definitely pronounce, impressed with your website. I had no trouble navigating through all the tabs as well as related information ended up being truly simple to do to access. I recently found what I hoped for before you know it in the least. Quite unusual. Is likely to appreciate it for those who add forums or anything, website theme . a tones way for your client to communicate. Excellent task.

  22. hello,this is an excellent article,I found it on bing and I like it very much,I agree with you, lots of things will be learned form your site,but I am not follw well with the last part,can you explain it for me ?I need your answer,and I will be back again!

  23. Hi,what an excellent article this is,I found it on yahoo and I love it very much,I agree with you, it help me a lot in decision,but I still have some questions with the last part,can you explain it for me ?I need your answer,and I will keep on watching your blog

  24. Hi,what an excellent article this is,I found it on yahoo and I like it very much,I agree with you, it help me a lot in decision,but I still have some questions with the last part,can you explain it for me ?I need your answer,and I will keep on watching your blog

Comments are closed.