I am new to wpf and xaml. I find solutions to most problems (in other languages) by searching here or where I am, and it made me go crazy. I searched a lot on google and looked through many forums, but it seems that this time I met a real problem!
I have the following code in Window.Resources:
<my:NameConverter x:Key="NameConverter"/>
<MultiBinding x:Key="CustomerFullNameBinding"
Converter="{StaticResource NameConverter}"
ConverterParameter="LastNameFirst">
<Binding Path="FirstName" />
<Binding Path="MiddleName" />
<Binding Path="LastName" />
</MultiBinding>
The NameConverter class returns the full name, combining the individual parts of the name. The return value is based on the ConverterParameter value , which can be one of the following: FirstNameFirst, LastNameFirst, OnlyFirstName, OnlyLastName, Initials (there are a few more, but for simplicity do not consider them)
. :
<TextBlock Text="{DynamicResource CustomerFullNameBinding}"/>
, CustomerFullNameBinding 20 (, abovw), . (.. , CustomerFullNameBinding, ConverterParameter = "LastNameFirst", 20 .)
: "", ConverterParameter?, , . , , , :
<MultiBinding x:Key="CustomerFullNameBinding_FirstNameFirst"
Converter="..." ConverterParameter="FirstNameFirst">
......
</MultiBinding>
<MultiBinding x:Key="CustomerFullNameBinding_LastNameFirst"
Converter="..." ConverterParameter="LastNameFirst">
......
</MultiBinding>
<MultiBinding x:Key="CustomerFullNameBinding_OnlyFirstName"
Converter="..." ConverterParameter="OnlyFirstName">
......
</MultiBinding>
... and so on ...
, , , , !
, .
.
: . msdn.microsoft.com/en-us/library/ms771336.aspx.
: wpf xaml staticresource dynamicresource binding