WPF SDK 分析 目录 0

下载到一套NET3.0 SDK,1.16G大小,关于WPF的例子达300之多,准备挨个介绍一遍。
所有程序基于Framework3.0,要在VS2005上运行(经测试,VS2008需要转换)。
目录如下:
一级目录 二级目录

案例简介

Accessibility FindText

This sample shows how to use Microsoft UI Automation and the TextPattern class to find user-specified text and echo user-highlighted text.

FragmentProvider

This sample demonstrates how to support Microsoft UI Automation in a complex custom control. The control is a simple list box hosted in a Windows Forms window. The list box is a UI Automation fragment root, and the items in the list box are elements of the fragment.

After running the sample, open UISpy.exe to see a UI Automation tree of the custom control.

InsertText

This sample demonstrates how to use both Microsoft UI Automation and unmanaged methods to input text into standard Microsoft Win32 text controls from a WinFX application. The target text controls are a single-line text box, a multi-line text box and a rich text box.

Since the TextPatterncontrol pattern does not support the setting of text values in a control, the Microsoft UI Automation sample code shows how to use either the ValuePattern control pattern or standard keyboard input to simulate text input depending on the target control type.

The sample defines two applications, a target and a client that operates against the target application.

InvokePatternApp

This sample demonstrates how to use Microsoft UI Automation to navigate the menu structure of an application with the ExpandCollapsePattern and the InvokePatterncontrol patterns.

The sample illustrates how identical controls may provide different control pattern support depending on their location within the control view of the Microsoft UI Automation raw tree[Glossary Lookup Failure: raw_tree#c3949c20-8548-4a60-9966-b23ded1e1043] and their function within an application. Specifically, how a menu item may support the InvokePattern control pattern if the menu item is a leaf-node and initiates a single, unambiguous action such as the "About Notepad" menu item.

This sample defines two applications; an instance of Notepad used as a UI Automation provider, or target application, and a UI Automation client that operates against this target application.

NavigatingWithTreeWalker his sample shows how to use Microsoft UI Automation to recursively navigate the element tree using the TreeWalker class, and how to get property information for elements in the tree.

The sample defines two applications, a target and a client that operates against the target application. The target should be running before you click Start UI Automation in the client.

RecordAndPlaybackSample This sample uses UI Automation control patterns and event handling to record user interaction with a UI Automation provider, or target application. The UI Automation client that made the recording is then able to play back the recording.
SimpleProvider

This sample demonstrates how to support Microsoft UI Automation in a simple custom control. The control is a button hosted in a Windows Forms window.

After running the sample, open UISpy.exe to see a UI Automation tree of the custom control.

TrackFocus

This sample tracks the input focus on the desktop and displays information about focus changes, using Microsoft UI Automation. This is a simple console application that might be used as a starting-point for an application that uses UI Automation to track events on the desktop.

The program announces when the input focus changes. If the focus moves to a different application window, the caption of the window is announced. If the focus moves within an application window, the type and name of the control being read are announced.

To know when the focus switches from one application to another, the program keeps a list of the runtime identifiers of all open top-level windows. In response to each focus-changed event, a TreeWalker is used to find the parent window, and that window is compared with the last window that had focus.

The program subscribes to three event types:

  • Structure changed. The only event of interest is the addition of a new top-level window.

  • Focus changed. All events are captured.

  • Window closed. When a top-level window is closed, its runtime ID is removed from the list.

For simplicity, no caching is done. A full-scale application would likely cache all immediate children of an application window as soon as that window received focus.

WindowMove

This sample demonstrates how to use the WindowPatterncontrol pattern to control the screen location of a top-level window as well as register and listen for standard window events.

This sample defines two applications; an instance of Notepad used as a UI Automation provider, or target application, and a UI Automation client that operates against this target application.

AppModel
原文地址:https://www.cnblogs.com/Jax/p/1054181.html