Questions tagged [selectionchanged]

263 questions
108
votes
19 answers

ComboBox- SelectionChanged event has old value, not new value

C#, .NET 4.0, VS2010. New to WPF. I have a ComboBox on my MainWindow. I hooked the SelectionChanged event of said combo box. However, if I examine the value of the combo box in the event handler, it has the old value. This sounds more like a…
Matt
  • 41,216
  • 30
  • 109
  • 147
27
votes
7 answers

How to cancel a ComboBox SelectionChanged event?

Is there an easy method to prompt the user to confirm a combo box selection change and not process the change if the user selected no? We have a combo box where changing the selection will cause loss of data. Basically the user selects a type, then…
WPFNewbie
  • 2,464
  • 6
  • 34
  • 45
14
votes
5 answers

WPF Listview SelectionChanged event

I have a ListView binding to an ItemsSource and the SelectionChanged event is firing on the load/databound events? I assume that it is because a 'default' items ie index 0 is selected. How can I disable this?
Petrus
  • 213
  • 1
  • 3
  • 6
12
votes
4 answers

DataGridView selectionChanged event firing multiple times

In my application I am using DataGridView to display the list. When user select a record in the datagridview, it should display details in the other panel. For selection I was asked to use DataGridView1_SelectionChanged event. The DataGridView…
Sanjeev4evr
  • 403
  • 2
  • 11
  • 23
9
votes
3 answers

preventing row change in datagrid

I have researched this and am stumped: I have a WPF DataGrid, and using an MVVM model. I want to, under certain circumstances, prevent the ability to change a row in the DataGrid. I have researched this and have tried techniques like the one found…
Mani5556
  • 394
  • 2
  • 12
  • 33
9
votes
2 answers

XAML ComboBox SelectionChanged Fires OnLoad

If I have a ComboBox that has a SelectionChanged event, it fires when I'm loading the control. So at page load I set the SelectedValue and the SelectionChanged event fires which is not what I want to happen. What is the accepted apporach to stopping…
griegs
  • 22,624
  • 33
  • 128
  • 205
9
votes
4 answers

could the SelectionChanged event in WPF be handled only for user interaction?

I would like to handled SelectionChanged event in WPF DataGrid element for user interaction/selection only and skip if it's due to binding or other set values. Any idea how I will determine if the Selection is changed by user interaction? Or any…
binyame tiruneh
  • 103
  • 1
  • 5
8
votes
4 answers

Combobox selectionchanged event triggers without even changing the selection in the ComboBox

Could you help me find the error in this one: The event triggers before even the windows form is loaded. I start to see the message Box and then I click OK,after that it loads the main screen.After that everything works perfectly, I wonder what…
MangoTable
  • 695
  • 3
  • 8
  • 13
6
votes
1 answer

WPF TabControl On SelectionChanged, set focus to a text field

I have a tab control, and a few tab items. I am successfully listening to the SelectionChanged event, and checking if the tab I'm interested in is the currently selected one. I'm using this code (below), and stepping through the debugger, I can see…
Nate
  • 30,286
  • 23
  • 113
  • 184
6
votes
1 answer

Getting object from SelectionChangedEventArgs e Windows Phone 8

I am using Telerik Slide View control and it supports a SelectionChanged event private void radSlideView_SelectionChanged(object sender, SelectionChangedEventArgs e) { var addedItems = e.AddedItems; } e contains the MainViewModel object…
PutraKg
  • 2,226
  • 3
  • 31
  • 60
5
votes
5 answers

How can I realize SelectionChanged in MVVM ListBox Silverlight

The ListBox control does not implement a Command property. I have to attach some functionality to the SelectionChanged event. Somebody knows how can I do it? Please help me
5
votes
3 answers

RichTextBox Save "Selection Direction"

I have a WinForms program where, whenever you change your selection, the RichTextBox needs to change the colour of certain other text. In order to do this, it has to select that text, and therefore I lose my current selection. I can save and load…
Migwell
  • 18,631
  • 21
  • 91
  • 160
5
votes
4 answers

avoid list view selected index changed firing twice

Quite a simple question, when the selected index of a list view is changed, the event fires twice, once for deselection and a second time to select the next item. I need to use the event when selecting or deselecting at different times however whan…
Alex
  • 718
  • 3
  • 11
  • 26
5
votes
3 answers

Animation during SelectionChanged

I have a TabControl where each TabItem has a separate control as its Content element. Now, I can easily execute a storyboard when switching to a tab by using a UserControl.Loaded EventTrigger. However, I also want to run an exit animation when…
sohum
  • 3,207
  • 2
  • 39
  • 63
4
votes
2 answers

onchange display/change a partial

There is a drop down using select <%= select("array", "folder", @rows.keys, {}, :onchange =>"?" )%> There is a partial called "form" <%= render "form"%> I need to render the partial whenever there is a change in the selection. Please, let me know…
user1455116
  • 2,034
  • 4
  • 24
  • 48
1
2 3
17 18