Welcome to the Xceed Community | Help
Community Search  

Set focus to row and have it move in to view

Sort Posts: Previous Next
  •  09-04-2008, 4:33 PM Post no. 14928

    Set focus to row and have it move in to view

    Hi

     This is probably a simple answer so hope you can help.

    I have built 1 table view and 1 3d card view.

    I want to be able to (in code) set the index of the item to focus and have it brought in to view so the user can see the item.

    I can set the item by: GRID.SelectedIndex = 50 and when I scroll to the item, it is highlighted.  What I need is for when I set the index, for the item to scroll in to view so that the user can see the card and not have to scroll to the item.

    :-(

  •  09-05-2008, 2:00 AM Post no. 14936 in reply to 14928

    Re: Set focus to row and have it move in to view

    Hi,

    maybe you can use GRID.BringItemIntoView(GRID.SelectedItem) after you set the GRID.SelectedIndex.

    HTH.


    Regards,

    Maximilian Haru Raditya
  •  09-06-2008, 6:16 AM Post no. 14965 in reply to 14936

    Re: Set focus to row and have it move in to view

    many thanks, this works for a large collection of cards but when I have 8 cards all displayed on screen and I set the index to the last card, it does not bring the card in to focus.

    For example, cards 1-8 are displayed and card 1 has focus.  I set index to 7 (count -1) so I would expect the 8th card to be given focus but card 1 still has the focus eventhough the index is no longer 1.

    Any ideas?

  •  09-06-2008, 9:21 AM Post no. 14967 in reply to 14965

    Re: Set focus to row and have it move in to view

    About the SelectedIndex behavior, I also encounter the problem you have. Sometimes, when I set the SelectedIndex, it got focus and sometimes it didn't. I'm still not sure whether this is a bug in my code or DataGridControl.

    A workaround I can think of it is to get the Xceed.Wpf.DataGrid.DataRow of current selected item and then call Focus() on it. I haven't try this though. I'll try this as soon as I have time.


    Regards,

    Maximilian Haru Raditya
  •  09-08-2008, 8:44 AM Post no. 14992 in reply to 14967

    Re: Set focus to row and have it move in to view

    If you are refering to the card that is in the "front" in the 3D Cardflow View, then you need to set the CurrentItem to the desired card in order for it to appear in the front/center.
    Technical Writer - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
  •  09-08-2008, 10:10 AM Post no. 15003 in reply to 14992

    Re: Set focus to row and have it move in to view

    Hi Jenny,

    what is the difference between CurrentItem and SelectedItem? I'm still not clear about them. Further, how are we supposed to do with them when dealing with current row's focus since I sometimes see it works and the other times not at all (I meant both for TableView and CardView)?

    Thanks!


    Regards,

    Maximilian Haru Raditya
  •  09-08-2008, 10:46 AM Post no. 15007 in reply to 15003

    Re: Set focus to row and have it move in to view

    The current item is the item that has the focus. The selected items are the items that are selected. The current item can also be the selected item or one of the selected items.

    If you want to set the focus on a row, then what you really want to do is set that item as the current item and not the selected item.

     


    Technical Writer - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
  •  09-08-2008, 3:08 PM Post no. 15035 in reply to 15007

    Re: Set focus to row and have it move in to view

    So, I figure out that to focus a specific row based on a specific row index in the DataGridControl and also bring the focused row to be viewable, I'll do the following:

    • set the SelectedIndex to a specific row index I want; this also means the SelectedItem will be changed accordingly
    • set the CurrentItem based on SelectedItem
    • call the BringItemIntoView() with CurrentItem as its parameter

    Is this correct?

    Thanks!


    Regards,

    Maximilian Haru Raditya
  •  09-08-2008, 8:00 PM Post no. 15046 in reply to 15035

    Re: Set focus to row and have it move in to view

    Yes. That should be correct. Is it not doing what you are expecting it to?
    Technical Writer - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
  •  09-14-2008, 2:23 AM Post no. 15239 in reply to 15046

    Re: Set focus to row and have it move in to view

    I think it is so far working the way it should be. I'll let you know if it didn't work as expected.

    Thanks!


    Regards,

    Maximilian Haru Raditya
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.