Tuesday, April 21, 2009

Trips&Ticks: Do you know how you can break text in any text control of WPF?

Seems it is easy - we can use a LineBreak in code or as XAML element, but what can we do if we want to present this in attribute of XAML? Little searching shows that we should use XSLT and hexadecimally encoded value to present a literal.
<TextBlock Text="Line 1&#x0A;Line 2" />

Monday, April 13, 2009

Trips&Ticks: Do you know how can you obtain access to nested types through XAML?

Download source files - here.

XAML is a declarative XML-based language created by Microsoft which is used to initialize structured values and objects. I have already written how we can obtain access to properties of instance that located in other properties here (I have described binding's potential). But what can we do if we need to access to nested type? Which syntax should me use? It is easy: "+" indicates nested type in XAML:

local:MultiLevelButton+NestedInfo.NestedName

A lot of code snippets you can see in sources.