<Window x:Class="WpfTutorialSamples.WPF_Application.ResourceSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<Window.Resources>
<sys:String x:Key="centralRes">Hello, world!</sys:String>
</Window.Resources>
<StackPanel Margin="10">
<TextBox Name="src" />
<TextBlock Name="dst" Text="{DynamicResource centralRes}" FontSize="56" />
</StackPanel>
</Window>
I am just learning, and was curious if I can bind the string
literal in centralRes
to another control's Text property (like src.Text
), so when it updates, all things bound to it like dst
automatically update.
Almost like a central hub for a piece of info. Is this possible to do?
Example of what I want:
<sys:String x:Key="centralRes" Value="{Binding Text, ElementName=src}">Hello, world!</sys:String>
<sys:Boolean>True</sys:Boolean>
throughout my application and had no problem with it. – GreenheadTrue
or literal value in case of a string to another source, in XAML. I know if I change it in code it would all work magically. – AthabaskaMainViewModel
and display the same information throughout the app? Obviously only the Items that are bound to that Resource. – Greenhead