Several RadioButtons in a group unhandling event - wpf

If you have several radiobuttons in a group, and you have Checked event handlers in your code behind, if a radiobutton is checked how do you cancel this event handling so that the new radiobutton clicked does not get selected and your original checked button stays checked? The code in the event handler in the code behind distinguishes this - radiobutton is clicked the event handler checks some condition, if condition is false do not check new button.

On Mouse PreviewDown event, you can check the condition and set
e.Handled=true (IF you don't want to check or uncheck)

Related

React-Admin: Is there an event which is triggered when a list/datagrid item is selected?

I'm looking for the event which displays the bulkaction-toolbar (the "xx items selected reset view-button delete-button"-toolbar) when a list/datagrid-item is selected. Here is an gif-example: bulkaction-toolbar
the following event is fired when the 'select-all' checkbox is clicked by the user
<Datagrid onSelect={arr=> console.debug('datagrid->onselect:', arr)}>
additional question: if I use this event like above the checkbox is never checked when the user clicked on it. Is this a bug or how i make working it?

Windows Forms Combo Box Changed Event

I have a Windows Form project, and I am looking to fire an event whenever the contents of a combo box are changed. The default event handler, SelectedIndexChanged, works fine when the user selects an item from a dropdown menu, but is not fired if the user manually types something in. I have tried other, similar events listed the documentation, but none of them have the required behavior. How can I fire an event under both circumstances?
The event you are looking for is TextChanged. This event isn't listed as a ComboBox event because it is inherited; however, the full list can be found here. To add this event, place the following line in your Form constructor, after InitializeComponents():
yourComboBox->TextChanged +=
gcnew System::EventHandler(this, &MyForm::yourComboBox_TextChanged);
There is no need to duplicate code between TextChanged and the default SelectedIndexChanged. The TextChanged event will be fired both for manual text changes and for changes via the dropdown.

How to detect a click on the selected row of a RadGridView control

My WPF application uses the Telerik RadGridView control on a few of its screens. I have a requirement that says that whenever the user clicks on a row in the RadGridView, I'm supposed to switch to another screen and display detail information about that row. I hooked up a handler to the SelectionChanged event and this works, except that nothing happens if the user clicks on the selected row a second time. This makes sense, as the selected row isn't being changed.
How can I detect a second click on the same row and have the second screen displayed?
Tony
You could just attach a handler to the MouseUp event on the GridView. Check if there are any selected cells and respond from there. This will fire even if there is already a selection.
The MouseDown event will fire on the mouse click, but before the gridview updates the selction, mouse up should fire when the selection has already been adjusted
You can also attach a handler to each individual cell in code-behind as follows
(this.GridView as RadGridView).AddHandler(
GridViewCell.MouseUpEvent,
new EventHandler<Telerik.Windows.RadRoutedEventArgs>(this.OnMouseUp));
I think you may try to achieve this through the MouseLeftButtonDown event or PreviewMouseLeftButtonDown event.

TabControl TabIndexChanged won't fire

The TabIndexChanged event of the Windows Forms TabControl doesn't fire when I change between tabs. But the SelectedIndexChanged event is fired.
What is the explanation for this?
The TabIndexChanged event fires when you change the TabIndex property of the control-- the order of controls related to the parent form, etc. It has nothing to do with when the user is switching tabs.
Besides the SelectedIndexChanged event, you probably want to explore the Selected, Selecting, Deselected, and Deselecting events to determine what to do when the user is changing tabs.

wpf- Unwanted Selection Change

in my Main Tab,I have some controls,
in my first control I have a Combobox.
I wrote an SelectionChange for MainTab ,
but it also fires when it accoured in combobox,I hadnt add any selection change event to my combobox,
but when I add selection change to Combobox and set e.erouted=true , the maintab selection changed will not be fired.
what Can I do to prevent firing maintab selectionchange when I change another control selected item ?
In the Main tab selection change event
if (e.OriginalSource.GetType() != typeof(ComboBox))
{
//do the code of main tab selection here..
}
I have hit this problem as well, and have not yet found the cause or correct solution. My current (albeit simple) workaround for this is to check that the sender is the object you are expecting.
In this case it would mean something like this:
if (sender != MainTab)
return;
Setting e.Handled to true will stop the event from bubbling up from child control (ComboBox) to the parent control (TabControl)

Resources