Home Forums WPF controls Xceed DataGrid for WPF Cell not updated

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #24853 |

    Is there a way to update the cell contents without redrawing the whole grid?
    Why?
    I have a property that when set the set method changes the value to be a custom format.
    I can not use a converter because the format depends on other cells values’ in the row.

    ex:

    [Column]
    public string size
    {
    get{return _size;}
    set{_size = FormatSize(value);SendPropertyChanged(“size”);}
    }

    What happens is the cell displays the value the user entered not the value the object changed the size to be.
    Any suggestions?

    Imported from legacy forums. Posted by MiddleTommy (had 602 views)

    Xceed Support
    Member
    Post count: 5658

    This is most likely caused by the fact change notification is not “listened” to when a cell is undergoing edition ( including the ‘commiting’ phase ).

    A workaround to this issue would be to call the SendPropertyChanged(“size”) notification on the dispatcher, so that it occurs slightly after the ‘commiting’ phase.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 269 views)

    User (Old forums)
    Member
    Post count: 23064

    What is the dispatcher

    Imported from legacy forums. Posted by MiddleTommy (had 294 views)

    User (Old forums)
    Member
    Post count: 23064

    Read more <a href=”http://msdn.microsoft.com/msdnmag/issues/07/10/WPFThreading/default.aspx#S3″>here</a&gt;

    Imported from legacy forums. Posted by nat (had 344 views)

    User (Old forums)
    Member
    Post count: 23064

    Finaly got around to figuring out about the Dispatcher and for those of you interested on Change notification here is a some sample code

    public string size
    {
    set
    {
    this.SendPropertyChanging();
    _size = value;
    this.SendPropertyChanged(“size”);
    string sizeF = FormatSize();
    if(_size != sizeF)
    SetSize(sizeF);
    if(_
    }
    }

    delegate void VFunc<T>(T t);
    delegate void VFunc();
    public void SetSize(string newsize)
    {
    VFunc spc = new VFunc(this.SendPropertyChanging);
    Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Send, spc);
    //this.SendPropertyChanging();//old way didnt work
    this._size = newsize;
    VFunc<string> func = new VFunc<string>(this.SendPropertyChanged);
    Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Send, func, “size”);
    //this.SendPropertyChanged(“size”);//old way didnt work
    }

    Now if I change the size property it calls SetSize and the UI updates it.

    This was helpful to me because users can not type in the grid for Size
    4.5*4.5*.5
    and I can change that to be
    4-1/2×4-1/2×1/2

    And the Gird shows that change.

    For those curious Converters would not work in my situation because how the text is formated depends on the values of other properties.

    Imported from legacy forums. Posted by MiddleTommy (had 4246 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.