Thursday, August 11, 2011

MathConverter - How to Do Math in XAML - CodeProject

Graphene nanoribbon band structures for arm-ch...Image via WikipediaBackground to an article that's going to save me a lot of problems!!!!!

When working with my XAML files, periodically I run into a need of doing some simple calculations directly in XAML. For instance, what if I want this width to be exactly to thirds of that width, or what if rotation angle is a certain multiple of a particular value? This problem may be solved in a number of ways. Widths are usually better addressed via margins, paddings, or grids. At other times I put calculations into a view model. At some other times I create a special binding converter that would do the arithmetic for me.


MathConverter - How to Do Math in XAML - CodeProject
Enhanced by Zemanta

No comments:

Post a Comment