WPF Quick Tip: How to get WPF Window client area size

Sunday, September 20, 2009

This time my quick tip will be not about the Silverlight, but about WPF. When you have WPF window, the runtime size of it could be discovered by ActualWidth/ActualHeight properties. In most cases this is enough. But what about the case, when you need to perform some mathematical calculations based on the real size of client area? What is this client area? Well, the second question is really easy one – the client area is the area available to user defined UI (controls, panes, etc.): At the screenshot - client area is...

Silverlight Quick Tip: How to Perform a Hit Test

Tuesday, August 11, 2009

In some cases, especially when developing rich UI application developer need to identify which control were clicked or under mouse pointer at some point of time or just under some coordinate at the UI. For those purposes Silverlight provides “FindElementsInHostCoordinates” function in VisualTreeHelper class. The function gets the Point (coordinate on the screen) or Rect (rectangular area) and UIElement which will be checked recursively to have any visual child's in desired coordinate/area. The function returns IEnumerable<UIElement>. In most cases, especially when using custom controls the returned list will have many UIElements. They need to be filtered out....