Switch

Hi guys,

I’m using Switch with NativeViewHost:

<NativeViewHost>
	<Switch ux:Name="_sw" Height="25" Width="50">
		<WhileTrue Value="{ReadProperty _sw.Value}">
			<DebugAction Message="Switch.Value = true" />
		 </WhileTrue>
		 <WhileFalse>
			<DebugAction Message="Switch.Value = false" />
		</WhileFalse>
	</Switch>
	<WhileString Value="{status}" Equals="892">
		<Change _sw.Value="True" />
	</WhileString>
</NativeViewHost>

This is a screenshot of the page where I need the switch:

file

And here’s a screenshot of a page where I don’t need the switch:

file

The same thing happens on iOS. The Switch appears in other pages where it isn’t suppose to appear.

Does this have any solution beside using a custom switch? If no, is there a way of changing the color of this switch (without NativeHostView enclosure) when the value is true?

I’m using Fuse version 0.32.0 (build 9613).

Thank you!

AFAIK this is expected behavior. Did you see the docs for NativeViewHost?

Note: Native Controls are always rendered in front of graphics controls.

I’m not sure this is the best way to use it, but one suggestion would be to wrap that component in a Panel and use some combination of While-style triggers. That way, you should be able to control when it is shown and when it is not.

I did see those docs, I thought it was rendered in front of graphics controls in the page.

I wanted something simpler than using While-style triggers, because I only want to use it in one page and don’t want to check in every page if the switch appears.

I will have to use a custom switch. Thanks for your answer.