c# - WPF: DataGrid Find and Replace -


I use DataGrid to display the properties of specific properties of a collection of objects I have applied the search and cell highlighting to one of the following methods.

However, now I need to implement the type of ' find / change ' functionality. I think that through the data grid cells I highlight and replace Will be able to re-enable, but it does not seem to be an easy way to do this.

Any thoughts?

I think that in this scenario you probably have a wrong mindset, maybe you can win WinForms in the WPF world Coming in ...

In WPF DataGrid you do not basically manipulate data through the datagrid, you always work directly on datasource. As is "not an easy way to do this" - you are right

If I want to apply a search / change feature - then each click will highlight the next one on the next, then I Except for / find_next - then how do I do this:

1) We need to know our current status - DataGrid. CurrentType returns the current (data source) object; 2) Now the time that comes before the current object space (eg <. Code> var indx = List & lt; Object & gt; .FindIndex (...) since var nextItem = To search, find the list on the data source list & object; gt; [indx] )
3) Then we need to scroll the datagrid to the object and bring the datagrams to the view - DataGrid.ScrollIntoView (nextItem); (You may have to do DataGrid.UpdateLayout (before calling), in my experience some quarks with the .NET 4 underlying datagrid); 4) You should already know how to highlight a cell ..; 5) Wait for user input, either leave or change;
6) If we replace, we can either use the DataGrid.CurrentItem or nextItem variable and replace some value with a new value . Depending on how your datagrid is installed, you might get some refresh () / updateout () calls or a binding operation. Gatebunging Exposure (...) may be required. UpdateTarget () Call to update DataGrid; 7) Finally go back to Step 1 and repeat;


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -