Home Forums WPF controls Xceed DataGrid for WPF How to do equivalent of IsSynchronizedWithCurrentItem?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • Xceed Support
    Member
    Post count: 5658
    #22576 |

    Hi,
    I’d like to have 2 DataGrids side by side (templated differently), that keep their CurrentItem in sync – i.e. like using the Selector.IsSynchronizedWithCurrentItem property.
    I can do a master-detail link, but that only drives selection one way – I’d like the user to be able to modify the common selected item from either grid.
    Is there a simple way to do this?
    Thanks.

    Imported from legacy forums. Posted by Simon (had 2400 views)

    User (Old forums)
    Member
    Post count: 23064

    Good question.

    did you find a way to make it work?

    Imported from legacy forums. Posted by Marco (had 474 views)

    Xceed Support
    Member
    Post count: 5658

    Well, I managed to get a listbox and an Xceed grid in CardView mode synchonized by a combination of SelectionChanged and CurrentItemChanged events.

    void B_Items_CurrentChanged(object sender, System.EventArgs e)
    {
    if (B.CurrentItem != null)
    {
    B.BringItemIntoView(B.CurrentItem);
    }
    }

    void OnASelectionChanged(object sender, RoutedEventArgs e)
    {
    B.SelectedItem = A.SelectedItem;
    if (B.SelectedItem != null)
    {
    // Following line sometime went splat (to do with Virtualizing panel, and item out of scope).
    //B.BringItemIntoView(B.SelectedItem);
    // So set CurrentItem here, and do BringItemIntoView() in B_Items_CurrentChanged()
    B.CurrentItem = B.SelectedItem;
    }
    }

    Imported from legacy forums. Posted by Simon (had 3542 views)

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