0

If you have a binding on a textbox with the UpdateSourceTrigger.PropertyChanged, which updates your datasource everytime the textproperty on the TextBox changes and you have a RaisedPropertyChanged on that Property, then your textbox gets really slow (during typing some text) if you have a lot of Text inside (over 1000 characters). Has someone a solution for that issue? I need to inform the GUI about the change from the datamodel. I use the MVVM pattern. I already tried to convert my Content Property into a dependency object -> same textbox typing lag. This issue confuses me, because this should be basic silverlight stuff??

cheers tobias

var binding = new Binding("Content");
binding.Mode = BindingMode.TwoWay;
binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
myTextBox.SetBinding(TextBox.TextProperty, binding);


private string m_content;
        public string Content
        {
            get { return m_content; }
            set
            {
                m_content = value;
                //RaisePropertyChanged("Content");
            }
        }


    public event PropertyChangedEventHandler PropertyChanged;

    /// <summary>
    /// Raises this object's PropertyChanged event.
    /// </summary>
    /// <param name="propertyName">The property that has a new value.</param>
    protected void RaisePropertyChanged(string propertyName)
    {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null)
        {
            var e = new PropertyChangedEventArgs(propertyName);
            handler(this, e);
        }
    }
4

1 回答 1

1

尝试将文本框的UpdateSourceTrigger属性设置为LostFocus,以便在键入时不会更新基础数据源

于 2013-03-27T16:29:03.397 回答