I got a couple of queries from the readers asking if I could provide a slightly non-trivial sample of using automation. So I created a split button user control which looks something like this If there are no items then you get a checkable button. The items are created in a popup and are generated on demand. This makes the automation a bit interesting. As you can see the control supports 3 patterns – · Invoke (for the button) · ExpandCollapse (for the drop down) · Toggle (for the checkable option) – This is just for demo purposes You will need to specify this in the GetPattern function which overrides the one in the base AutomationPeer. The other function that you might want to override is GetChildrenCore in case of popups. The default behavior is to go through the visual tree and get the children. However, popups are in a separate visual tree. The sample overrides the function since the items are displayed as part of a popup J Also for each of the patterns, it is necessary that we implement
Read More...