ListView listView = new ListView(); listView.SetValue(ListView.BackgroundProperty, Colors.LightGray);
ListView listView = new ListView(); listView.SetValue(ListView.SelectedIndexProperty, 2);This sets the selected index of the ListView to 2. Package library: This is a part of the System.Windows.Controls namespace in the WPF (Windows Presentation Foundation) package in C#.