×
Namespaces

Variants
Actions

Talk:How to style the ToggleSwitch from the Windows Phone ToolKit

From Nokia Developer Wiki
Jump to: navigation, search

Hamishwillee - Thanks Matt

Hi Matt

I subedited this and added a couple of headings. I think a "minor" improvement.

What would be good is a few words on how the style modification works - so that if someone wanted to play with the styling they could change it as needed.

I think how this works is that there are a bunch of setters for properties like the foreground and background, which are given default values from the phone styling PhoneForegroundBrush. These are then used to define the colour of the button in the different states by TemplateBinding. The FixedToggleSwitchStyle defines the appearance of the switch text and includes the definition of the button style (FixedToggleSwitchButtonStyle). Is there anything much more that can/should be said?

Regards

Hamish

hamishwillee (talk) 07:53, 18 November 2013 (EET)

Max Meng - Need more instructions

This method looks promising. However I receive the following errors when trying to implement it:

Error 1 The type 'toolkitPrimitives:ToggleSwitchButton' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

Error 2 The namespace prefix "toolkitPrimitives" is not defined.

Error 3 ToggleSwitchButton is not supported in a Silverlight project.


If I change TargetType="toolkitPrimitives:ToggleSwitchButton" to TargetType="toolkit:ToggleSwitch"

It does fix the light theme problem, however, the switch button doesn't work any more, I mean, you cannot turn the switch ON or OFF by click or tap it.

Well, add xmlns:toolkitPrimitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls.Toolkit" to the <phone:PhoneApplicationPage ... > block solve the problem.

Max Meng (talk) 05:24, 13 February 2014 (EET)