views:

14

answers:

1

I am trying to use the Expander control in the surface application. I have seen its not a surface control so application compiles and control shows up but the contacts are not working.

Is there anyway I can modify the contact events and make it work in surface applications.

A: 

To do that, all you have to do is change the Expander's template to use Surface controls instead of the regular controls.

The Expander's default template can be found at http://msdn.microsoft.com/en-us/library/ms753296.aspx.

All you need to change is the ToggleButton:

<ToggleButton OverridesDefaultStyle="True"
              Template="{StaticResource ExpanderToggleButton}"
              IsChecked="{Binding IsExpanded, Mode=TwoWay, 
              RelativeSource={RelativeSource TemplatedParent}}">

changes to

<s:SurfaceToggleButton OverridesDefaultStyle="True"
                       Template="{StaticResource ExpanderToggleButton}"
                       IsChecked="{Binding IsExpanded, Mode=TwoWay, 
                       RelativeSource={RelativeSource TemplatedParent}}">

(closing tags omitted)

This assumes s is bound to the Surface XML Namespace:

xmlns:s="http://schemas.microsoft.com/surface/2008"
robertos