Creating a custom markup extension
Markup extensions are used to extend the capabilities of XAML, by providing declarative operations that need more than just setting some properties. These can be used to do pretty much anything, so caution is advised – these extensions must preserve the declarative nature of XAML, so that non-declarative operations are avoided; these should be handled by normal C# code.
Make sure Visual Studio is up and running.
How to do it...
We'll create a new markup extension that would provide random numbers and use it within a simple application:
- First, we'll create a class library with the markup extension implementation and then test it in a normal WPF application. Create a new Class Library project named