From d07ff6a0c0db079bc7a25934d31536c0d6642df9 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 14 Oct 2017 14:25:43 +0100 Subject: [PATCH] add repro for TextPresenter.Text not getting set on initialisation. --- samples/ControlCatalog/App.xaml | 3 +- samples/ControlCatalog/ControlCatalog.csproj | 4 + samples/ControlCatalog/EditableTextBlock.cs | 112 ++++++++++++++++++ samples/ControlCatalog/EditableTextBlock.xaml | 15 +++ samples/ControlCatalog/Pages/TextBoxPage.xaml | 40 ++++--- .../ControlCatalog/Pages/TextBoxPage.xaml.cs | 14 +++ 6 files changed, 169 insertions(+), 19 deletions(-) create mode 100644 samples/ControlCatalog/EditableTextBlock.cs create mode 100644 samples/ControlCatalog/EditableTextBlock.xaml diff --git a/samples/ControlCatalog/App.xaml b/samples/ControlCatalog/App.xaml index 43971dec4f..f42cefaf91 100644 --- a/samples/ControlCatalog/App.xaml +++ b/samples/ControlCatalog/App.xaml @@ -2,8 +2,9 @@ + - + \ No newline at end of file diff --git a/samples/ControlCatalog/Pages/TextBoxPage.xaml b/samples/ControlCatalog/Pages/TextBoxPage.xaml index 7bfcad6d51..339bbd6bee 100644 --- a/samples/ControlCatalog/Pages/TextBoxPage.xaml +++ b/samples/ControlCatalog/Pages/TextBoxPage.xaml @@ -1,30 +1,34 @@ - - - TextBox - A control into which the user can input text + + + TextBox + A control into which the user can input text + + + - - - - - + + + - - - - + + + + - - + - - + + - \ No newline at end of file diff --git a/samples/ControlCatalog/Pages/TextBoxPage.xaml.cs b/samples/ControlCatalog/Pages/TextBoxPage.xaml.cs index cd5f790312..7e0ac1abff 100644 --- a/samples/ControlCatalog/Pages/TextBoxPage.xaml.cs +++ b/samples/ControlCatalog/Pages/TextBoxPage.xaml.cs @@ -1,13 +1,27 @@ using Avalonia.Controls; using Avalonia.Markup.Xaml; +using ReactiveUI; namespace ControlCatalog.Pages { + public class TestViewModel : ReactiveObject + { + private string testText = "Editable TextBlock"; + + public string TestText + { + get { return testText; } + set { this.RaiseAndSetIfChanged(ref testText, value); } + } + } + public class TextBoxPage : UserControl { public TextBoxPage() { this.InitializeComponent(); + + DataContext = new TestViewModel(); } private void InitializeComponent()