Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
210
How to display SelectedDataItem in view in MVVM
posted

I have SelectedDataItem bound to an object in my ViewModel.   I can find items in my list and update them, but the item I am updating does not display in the grid as it is outside teh scrolling region.

i want to be able to find an item in the list, udpate it and have that item displayed in the scrollable portion of the screen.

I need to do this from my vie wmodel, not from code behind

Can anyone help - this seems liek such a simple thing to do

Parents
  • 1500
    Offline posted

    Hello,

    SelectedDataItem will select a record, but won't scroll your grid to this item. If you would like the DataItem to be also displayed, you can call the BringDataItemIntoView() method, which will do the trick.

    Since you are doing this from your ViewModel, I suppose you have a command to search in the grid and you can pass the grid as a command parameter into this binding, so you can call the method.

    In case you need help implementing this, please provide me with more information of the scenario, and I will prepare a sample for you.

    Sincerely,
    Tihomir Tonev
    Associate Software Developer
    Infragistics

Reply Children