1

I have a listview which binds customer informations from database. There are 15 columns which are binded in that listview. One of that column is Customer Name.

I want to be focused them when I type their name's initial character from the keyboard. Have you any idea to make this ?

This is my listview's XAML code

<ListView x:Name="datalist" ButtonBase.Click="datalist_Click" ContextMenuOpening="datalist_ContextMenuOpening" MouseDoubleClick="datalist_MouseDoubleClick" SelectionChanged="datalist_SelectionChanged"
MouseUp="datalist_MouseUp" PreviewMouseUp="datalist_PreviewMouseUp" >
Isi
  • 67
  • 1
  • 8

1 Answers1

0

Try to operate only on Model/ModelView and not on UI directly (as much as it possible).

For example, define in ModelView a property

public bool Focused{
  get ..   
  set...  //OnPropertyChanged
}

nd bind it to the UI elements corresponding property. After this the only thing you need to do is t simply

  • find an element in binded data (ModelView objects)
  • set it's Focused property to true
Tigran
  • 61,654
  • 8
  • 86
  • 123
  • @lsi: your UI element (list view row in this case) should have kind of *Focused* or *Selected* property. Bind it to corresponding property in your ModelView. – Tigran Nov 06 '12 at 14:02
  • @lsi: can have look in example provided in the asnwer on this question [WPF ListView Programmatically Select Item](http://stackoverflow.com/questions/1069577/wpf-listview-programmatically-select-item) – Tigran Nov 06 '12 at 14:04
  • I couldnt adjust it to my solution – Isi Nov 06 '12 at 14:28
  • @lsi: what do you mean saying "Focused" ? – Tigran Nov 07 '12 at 09:14
  • In the link provided answer described a template for list view. Look on it. It's not small amount of code to provide just in this answer. – Tigran Nov 07 '12 at 09:29