Helpful Notes on SemanticZoom
A partner was recently having difficulties getting SemanticZoom to display the data he wanted. I realized quickly that there was a misunderstanding about how the control works. Here are the notes I shared with him that helped him get back on track:
- SemanticZoom is a control that “wraps” two other controls by assigning those controls to the ZoomedOutView and ZoomedInView properties or by nesting those controls in the <SemanticZoom.ZoomedOutView> and <SemanticZoom.ZoomedInView> child tags
- ZoomedInView is the control that the user will interact with most of the time
- ZoomedOutView is the control the user will interact with when they semantic zoom
- When the user does the pinch gesture, SemanticZoom automatically scales and cross-fades between the two controls to give the illusion of zooming in or out
- Any control can be supplied for ZoomedOutView or ZoomedInView but the control must implement the ISemanticZoomInfo interface
- Controls that inherit from ListViewBase (ListView, GridView, etc) already implement the ISemanticZoomInfo interface
- Note that ListBox does not inherit from ListViewBase and therefore does not implement ISemanticZoomInfo so it cannot be used in SemanticZoom. However, ListView functions almost identically to ListBox.
- Usually (but not always) the data source for SemanticZoom is a grouped CollectionViewSource (see the IsSourceGrouped property)
- Usually ZoomedInView displays the items in the CollectionViewSource and ZoomedOutView displays the groups.
- ZoomedInView can use one DataTemplate to represent the items and ZoomedOutView can use an entirely different DataTemplate to represent the groups.
- There is a good sample on MSDN called XAML GridView grouping and SemanticZoom
- There is also a great article titled Guidelines for SemanticZoom