MVVM Binding in Ribbon.Group

Ribbon for WPF Forum

Posted 13 years ago by Iwaneczko
Version: 11.1.0544
I have a problem with Binding Text in MVVM pattern on simple textbox in Ribbon.Group.

xaml code:
<ribbon:Tab x:Class="Sato.ChartDocument.Ribbons.ChartDocumentRibbonTab"
            Label="Chart Properties">
        <StackPanel Orientation="Horizontal">
            <Label Content="Chart Title" />
            <TextBox Text="{Binding Path=ChartTitle, Mode=TwoWay}" />
and ChartDocumentViewModel code:
namespace Sato.ChartDocument.ViewModels
    using Microsoft.Practices.Prism.ViewModel;

    /// <summary>
    /// Description of chart document view model
    /// </summary>
    public class ChartDocumentViewModel : NotificationObject
        private string chartTitle = "Tytuł ViewModel";

        /// <summary>
        /// Gets or sets the chart title.
        /// </summary>
        /// <value>
        /// The chart title.
        /// </value>
        public string ChartTitle
            get { return chartTitle; }
                if (chartTitle != value)
                    chartTitle = value;
                    RaisePropertyChanged(() => this.ChartTitle);
I have a breakpoint on ChartTitle.set, and it break just when I push button on other Ribbon.Tab.
I searched in forum, but I don't found anything.
How to resolve it?

[Modified at 08/01/2011 05:29 AM]

Comments (2)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
The TextBox.Text property has a default UpdateSourceTrigger value of LostFocus. Perhaps change that on your binding to PropertyChanged instead.

Other than that, if it isn't firing correctly perhaps the LostFocus isn't occurring properly on the TextBox for the default update trigger since the Ribbon is in its own focus scope (same as a toolbar), and in separate focus scopes, focus can sometimes be handled differently.

Actipro Software Support

Posted 13 years ago by Iwaneczko
Thank you very much, changing the UpdateSourceTrigger to Property changed solve it in 100%.
The latest build of this product (v24.1.2) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.