C# GUI automation using PyWinAuto - c#

I was working with GUI automation for visual studio C# desktop application.
There I have DataGridView and inside the grid I have combo box and check boxes.
I tried to automate these using pywinauto, I can get only grid layout control only
and internal things I cant able to get the controls
(I tried with print _control_identifiers() , Swapy, AutoIT Window Info and winspy also..)
anyone plz tell me how to automate visual studio C# DataGridView and its sub controls using pywinauto for desktop application??

The short answer is that there's no good way to automate sub-controls of a DataGridView using PyWinAuto.
If you want to read data out of a DataGridView (e.g. read the text contents of a cell, or determine whether a checkbox is checked), you are completely out of luck. If you want to control a DataGridView, there are two approaches that you can try:
clicking at various coordinate offsets.
sending keypresses to it to mimic keyboard navigation.
These may work if your DataGridView has a small amount of data in it, but once the DataGridView starts needing scrollbars you're out of luck. Furthermore, clicking at offsets is sensitive to the sizes of the rows and columns, and if the columns can be resized then this approach will never be reliable.

Try the version 0.6.6 of pywinauto which has better support for datagridview now. https://github.com/pywinauto/pywinauto/releases. Dont forget to use uia backend. Example below
Application(backend="uia")

Related

Winform DataGridView Control With Extended Capabilities

I am looking for a DataGridView control for Winforms which has the following capabilities with little or no programming (once the the control is bound to datasource).
Disconnected Search/Filtering
Pagination
Backend/Frontend Column Groupping
Exporting Data
Print Preview
It doesn't matter the control be commercial, free, or open source.
You might want to try the Telerik GridView it pretty much does all you want except for the Print preview.

GridView search button

How to place search button in DataGridView cell in Windows Application like font selecting in control property window in Visual Studio 2010
This may not be a direct answer to your question but you might want to look at Object List View
http://objectlistview.sourceforge.net/cs/index.html
It actually wraps a ListView but has a lot of capabilities including reading data from a database as I recall. This provides for in-cell editors. For standard things like colors it has a built in cell editor. If that does not work then you can roll your own.

Zooming Vertically Through a DatagridView

There is a functionality I was dreaming of implementing one day, and that day is today.
I have a datagrid with hundreds of lines and my client doesn't even want to hear about paging (special use case). So I would like to be able to resize all rows AND content (text) with a "magnifying glass +/- " tool that affects the height of all rows in my DGV and also the Font of the text in it.
There are many ways to perform this and I wanted to ask what was a convenient and advisable way to do this (As I am more of a server-side than GUI oriented developer)
Thanks in advance
I guess you need to use WPF ..
Refer to the following link:
http://blogs.msdn.com/b/ivo_manolov/archive/2007/10/05/ui-scaling-ui-zooming-with-wpf.aspx
You can use host WPF controls in windows-based applications.
Refer to the following links ..
http://msdn.microsoft.com/en-us/library/ms742215.aspx
WPF control in windows forms?
http://www.programmerfish.com/how-to-add-wpf-controls-in-simple-windows-forms/
http://blogs.infragistics.com/wpf/articles/hosting-a-wpf-control-in-a-windows-forms-application.aspx

Make WPF Listview adhere to the Windows theme

I am an experienced coder who is trying to learn C# and WPF. Now, I am a bit of a stickler for detail, and I want to make sure my applications blend in with the rest of the user interface. However, I cannot seem to get this done using a ListView. My setup is simple - add a ListView to my window, bind to an ObservableCollection of my choice, and run the application.
The result is that the items pop up just fine (be it without meaningful contents). However, the selection rectangle on a ListView is always the dark blue that throws me back to the pre-XP days as opposed to the neater themed selection you have using the default Windows 7 visual style. To see that kind of selection in action, just select a file in explorer, or for another example look in the Programs and Features in the Control Panel. That looks nice and slick.
How can I get WPF to properly theme my ListView depending on my user settings? I don't want to reinvent the entire selection code and add tons of styling and doodahs like that - I want a plain Windows application that looks okay. The button works fine, textboxes work fine, comboboxes look fine, etc. It's just the ListView that looks totally crap.
Edit: I have no problems using another (very, very preferably not a thirdparty) control if required, but I do want a list of items that looks native and I approach a layout similar to the Tiles option in Explorer for each selected item (icon, desc, extra line of info). Vertical scrolling only is what I need.
If you use a ListView with ListView.View set to a GridView then you get a pretty similar look as Windows 7 explorer. (Atleast in my opinion, or is this the look you're talking about?). It also follows the active theme
Example 1. ListView with GridView to the right. Selection active
Example 2. ListView with GridView to the right. Selection inactive
Example 3. Using High Contrast Theme #2

Where to start with building a blotter

I need to build a blotter using csharp and WPF. Basically, like an excel sheet but would have the capability of customizing backgrounds of each cell or setting the value of each cell. But not sure where to start.
If anybody build blotters in csharp or WPF, a few pointers on where to get started would be great. If you can suggest some good open source blotters that I can copy and enhance, that would also be great.
I cannot use standard data grids as they lack many of the capabilities I am looking for.
I know windows forms and applications related to that which have standard controls but to create cells that are editable/customizable like excel, not sure where to start....
Take a look at the Adaptable Blotter (www.adaptableblotter.com).
It includes all the functionality that you seek and works with a number of different WPF grid controls, both vendor and open source. There is a single set of screens giving you advanced search, flashing cells, bulk editing etc but with individual implementations for each underlying grid.
You can use a UniformGrid to create the Grid. You can put Textboxes or even more advanced UserControls into the cells.

Categories

Resources