Two-value binding

Is it possible to associate the contents of a label with two values. For example, I need a separate label, the contents of which are displayed below, Username = First Name, Last Name

where Firstname and Lastname are both values ​​from the database. If I used tags that I would bind as Content = {Binding Firstname} for one and Content = {Binding Lastname} for the other. But I want both on the same label. Is it possible?

+6
c # wpf binding xaml
source share
1 answer

You can do something like this

<TextBlock> <TextBlock.Text> <MultiBinding StringFormat="{}{0}, {1}"> <Binding Path="firstName" /> <Binding Path="lastName"/> </MultiBinding> </TextBlock.Text> </TextBlock> 
+8
source share

All Articles