Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Mastering Windows Presentation Foundation

You're reading from   Mastering Windows Presentation Foundation Master the art of building modern desktop applications on Windows

Arrow left icon
Product type Paperback
Published in Feb 2017
Publisher Packt
ISBN-13 9781785883002
Length 568 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
 Yuen Yuen
Author Profile Icon Yuen
Yuen
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Mastering Windows Presentation Foundation
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
1. A Smarter Way of Working with WPF FREE CHAPTER 2. Debugging WPF Applications 3. Writing Custom Application Frameworks 4. Becoming Proficient with Data Binding 5. Using the Right Controls for the Job 6. Mastering Practical Animations 7. Creating Visually Appealing User Interfaces 8. Implementing Responsive Data Validation 9. Completing That Great User Experience 10. Improving Application Performance 11. Deploying Your Masterpiece Application 12. What Next?

Data binding to enumeration collections


We've already seen a number of examples of data binding to enumeration instances. We've seen converters that we can use to convert our enumeration values and Extension methods that we can use to extract additional information from each member. Earlier in this chapter, we even saw a full but basic example using our BitRate enumeration. Now, with our new-found knowledge, let's see how we can improve that earlier example.

As noted, in the previous example, we manually declared a RadioButton control for each of our enumerations. While that is fine for our three member enumeration, it wouldn't make so much sense to use this method if we had a large number of members. Instead, let's think about how we could use a DataTemplate to declare how each member should be rendered. Let's remind ourselves how we declared each RadioButton in the previous example.

<RadioButton Content="16 bits" IsChecked="{Binding BitRate, 
  Converter={StaticResource EnumToBoolConverter...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images