Event handling in Usercontrol in winform - winforms

I have a usercontrol to provide a data grid view and using it in a form. I have a decorator for this data grid view which provides the grouping functionality to this data grid view. Now all times a cell is clicked, the data grid view cell changed event is fired first and then the grouper event. Is there any way to change the event firing sequence?

You need to unregister the event from the datagridview, attach the decorator and then reregister the event.

Related

Updating Main Window from page in a frame

I'm currently developing a WPF application using the MVVM framework. And I have this functionality:
I have a main window which has a combo box and frame (where I put my pages) and a view model. One of the pages in that frame is where a user can add a data and these data are used to populate the combo box in the main window. My problem is how to automatically update the items in the combo box after adding a data from that page. Btw, this page has a different view model too.
Thanks.
You can establish an event in the page viewmodel for changed data. Then subscribe to those events within the window viewmodel and update the combobox items accordingly.
You have access to the parent window from iframe via window.top. You have to write this code in your page what you have loaded in iFrame.
window.top.document.getElementById("combobox_element_id").value='Your New Value';
best of luck
You can pass the Source DataContext of ComboBox (ObservableCollection) to page ViewModel so you can simply modify the collection from Page view model.

Is there the event in Ext.grid.Panel that fires when the data and rows have been reloaded and rendered

The main point of the question: I need the event that fires when the new rows have been rendered and the selection has been restored.
I refresh my grid by calling store.load method. I have a handler for store.load event. It fires when data have been loaded, but before new rows rendering.
I tried afterrender, viewready, selectionchange both in Ext.grid.Panel and Ext.view.Table (the view of the gird), but these events don't fire after every store.load event.
I need this event to work with the restored selection and perform some operations.
instead of calling the load call doRefresh() it will fire beforechange event and change events on the paging toolbar then handle those things in those events do what ever you want todo
you can use:
grid.getView().refresh();
method after store load. It will refresh grid view content.

Xtragrid: Apply custom filter without rebinding the datasource

I am using Xtragrid control and BindingList as data source, and CustomRowFilter event of gridView control. It works fine when I call BindingList.ResetBindings, but it resets the current selection.
Is there a way to force new filter (through CustomRowFilter event handler) without calling BindingList.ResetBindings?
Use the RefreshDataSource method to update data displayed within the grid control's View as:
//Refresh the grid control
gridControl1.RefreshDataSource();
I suggest you to go through the below reference links:
Refreshing the GridControl
GridControl.RefreshDataSource
I found solution myself:
xtraGrid.RefreshDataSource()

WPF Telerik gridview click events

I have a telerik gridview that I need to add both a single click and double click event. Basically the user can click a row once for a distinct event and then can also double click for a different event.
Initially I was using the SelectionChanged event to differentiate the two... but now I am having issues with anytime anything changes on the page, this event is fired.
If I implement a single click (MouseDown) event and a MouseDoubleClick event. The single click always overrides the double click and it cannot distinguish between the two - thus never making it to the double click event.
If you're using MVVM, you would probably prefer to attach an ICommand, which will be passed the DataContext of the row that has been clicked on, as a parameter.

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.

Resources