I hate to necro such an old topic but this was the top google result and I found a solution that worked better for me.
After my GUI loads I use the VisualTreeHelper recursively to generate a List<DependencyObject>
of all the GUI objects at runtime. My project required this GUI object list for other reasons, but it also gave me a very simple solution to adding Touch-support for non-Surface controls.
viewObjectList.ForEach(x =>
{
var temp = x as System.Windows.Controls.Primitives.ToggleButton;
if (temp != null)
{
temp.IsManipulationEnabled = true;
temp.TouchUp += TouchUpEvent;
}
});
Iterate through the list of GUI objects, find the ToggleButtons (the actual clickable part of the Expander), turn on their touch-support, and bind an event to them when TouchUp is fired (when a user lifts their finger).
private void TouchUpEvent(object sender, TouchEventArgs e)
{
if (TouchesOver.Count() == 1)
{
var temp = sender as System.Windows.Controls.Primitives.ToggleButton;
temp.IsChecked = !temp.IsChecked;
}
e.Handled = false;
}