I am facing a strage problem in ListView when we have selectionMode = Extended and TextSearch is enabled.
Here is a sample XAML:
<Window x:Class="TextSearchIssue.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"><Grid><ListView TextSearch.TextPath="ProductName" ItemsSource="{Binding Products}" SelectionMode="Extended"><ListView.View><GridView><GridViewColumn DisplayMemberBinding="{Binding ProductName}" /><GridViewColumn DisplayMemberBinding="{Binding Description}" /></GridView></ListView.View></ListView></Grid></Window>
and here is the code-behind:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace TextSearchIssue { public class ProductDetails { public string ProductName { get; set; } public string Description { get; set; } } /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); DataContext = this; } public List<ProductDetails> Products { get { List<ProductDetails> lst = new List<ProductDetails>(); lst.Add(new ProductDetails() { ProductName = "Adobe", Description = "Adobe" }); lst.Add(new ProductDetails() { ProductName = "Microsoft", Description = "Microsoft" }); lst.Add(new ProductDetails() { ProductName = "Apple", Description = "Apple" }); lst.Add(new ProductDetails() { ProductName = "Digia", Description = "Digia" }); lst.Add(new ProductDetails() { ProductName = "Nokia", Description = "Nokia" }); lst.Add(new ProductDetails() { ProductName = "HP", Description = "Adobe" }); return lst; } } } }
Now, run the application and select item "Nokia" with mouse. After this, if I press key M on keyboard, Microsoft gets selected. However, if I type Shift + M, all items between Nokia and Microsoft gets selected. How can I disable use of Shift key when I am doing a textsearch using keyboard?
I checked in Windows Explorer and there Shift key is neglected when user is doing a search using keyboard.
Can somebody please help me in this?