Created
July 4, 2016 09:46
-
-
Save sakapon/ba254fee254555754675e320b91d3706 to your computer and use it in GitHub Desktop.
BindingSample / DynamicBindingWpf / MainWindow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace DynamicBindingWpf | |
{ | |
public class AppModel | |
{ | |
public dynamic TextModel { get; } = new TextModel().ToDynamicSyncProxy(300); | |
} | |
public class TextModel | |
{ | |
string _Input; | |
public string Input | |
{ | |
get { return _Input; } | |
set | |
{ | |
_Input = value; | |
Output = _Input?.ToUpper(); | |
} | |
} | |
public string Output { get; private set; } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="DynamicBindingWpf.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:local="clr-namespace:DynamicBindingWpf" | |
Title="Dynamic Binding" Height="400" Width="600" FontSize="36"> | |
<Window.DataContext> | |
<local:AppModel/> | |
</Window.DataContext> | |
<Grid> | |
<Grid.RowDefinitions> | |
<RowDefinition/> | |
<RowDefinition/> | |
</Grid.RowDefinitions> | |
<TextBox Text="{Binding TextModel.Input, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap"/> | |
<TextBlock Text="{Binding TextModel.Output}" TextWrapping="Wrap" Grid.Row="1"/> | |
</Grid> | |
</Window> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment