How to put binding information into a Resource

I was experimenting with using App.Config Properties.Settings in XAML. For instance I added a setting for GridMaxWidth as an int of 500. Then in my XAML I added

<UserControl ...

    MaxWidth={Binding Source={x:Static Properties:Settings.Default},

This works fine. My question is: Is there some way to reduce the visual clutter and put all that binding source and mode information in a resource dictionary? I tried putting a <binding> property in a resource file but the xaml couldn't see it.


Most times Bindings get created for good and not supposed to be customised, so it is safe to create a binding in code:


public class MaxWidthBidning: MultiBinding
   public MaxWidthBidning()

The approach helps a lot when dealing with bulky MultiBindings with converters, turning 5++ lines of XAML into one.

<local:Control ComplexProperty={local:MaxWidthBidning} />

Update 1 - Talking of reducing the 'visual clutter' in general I can call two principal techniques we use:

  1. For Non Sealed objects, accepted by XAML (note, some derived objects cannot be used in XAML by some reason (exact type match is expected instead of a check for IsDervied) - so always try it out before. An example is Bidning - you can create a class dervied from Binding and hardwire the stuff (individual MultiBinding paths & converter), which is not supposed to be modified in XAML.

  2. For Sealed Objects, for example - DoubleAnimationUsingKeyFrames - you can create an attached behavior, something like 'StreamlinedAnimation.Definition' and using it create bulky parts in code. So, your animation will look like:

<DoubleAnimationUsingKeyFrames local:StreamlinedAnimation.Definiton="Some Encoded information to be used for creating Frames" />

Need Your Help

python-imaging on OSX 10.8.1

python django osx

I am currently checking out django for a project. I am also looking at django-cms. Django-cms requires python-imaging. I can find no simple way to install this on the current version of OSX, in fac...

Update panel breaking my calendar

c# html5 calendar updatepanel

The following asp:Calendar controls don't seem to want to work inside of the asp:UpdatePanel items. By don't work, I mean they are visible, but you cannot change the date or month. Remove the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.