Quantcast
Channel: wpftoolkit Discussions Rss Feed
Viewing all articles
Browse latest Browse all 2157

New Post: RichTextBox: Binding doesn't work when Mode=OneWay.

$
0
0
Example:

Xaml:
<extToolkit:RichTextBox IsReadOnly="True" Text="{Binding MyText, Mode=OneWay}">
    <extToolkit:RichTextBox.TextFormatter> 
        <extToolkit:PlainTextFormatter />
    </extToolkit:RichTextBox.TextFormatter>
</extToolkit:RichTextBox>
ViewModel:
public string MyText { get; private set; }

this.MyTextChangeCommand = new RelayCommand(() => 
    this.MyText = "new value";
    this.RaisePropertyChanged(nameof(this.MyText)); 
}});
But the same code perfectly works if replace RichTextBox to TextBox.

And also works after the following correction:
Xaml:
<extToolkit:RichTextBox IsReadOnly="True" Text="{Binding MyText}">
    <extToolkit:RichTextBox.TextFormatter> 
        <extToolkit:PlainTextFormatter />
    </extToolkit:RichTextBox.TextFormatter>
</extToolkit:RichTextBox>
ViewModel:
public string MyText { get; set; }

MyTextChangeCommand - the same

Viewing all articles
Browse latest Browse all 2157

Trending Articles