i have 2 textblocks in my form.
something like this:
<TextBlock Name="applicationname" Text="{binding applicationname?}"/>
<TextBlock Name="applicationname" Text="{binding settings.stringVersionNumber}"/>
i would like to set the first textblock content to display the application name automatically and the other one to display a string saved in the application setting ..
should i be changing the values using a “wpf code-behind” or could i just bind the textblocks directly in the xaml ?
You can data bind to static properties, including the application settings, directly in XAML:
…where
WpfApplication1is your namespace, andVersionNumberis a string defined in the application settings.To get the assembly title, we’ll need some code-behind in the
MainWindowclass:P.S. You can’t assign the same name to two elements.