views:

59

answers:

1

I have a custom control that inherits from ContentControl. Inside the generic.xaml file is a simple Grid with 2 rows:

  • Row 1 - A toggle button
  • Row 2 - A StackPanel with a TextBlock, named "Stackpanel1"

The ToggleButton has its own nested ControlTemplate which has VisualStates for Checked/Unchecked.

Is it possible to reference "Stackpanel1" from inside the ToggleButton's control template somehow? In order to show or hide the stackpanel.

+1  A: 

The answer is: no.

You'll need to do this with a bit of code in the CustomControl that monitors the IsChecked state of this ToggleButton part that sets a visual state for the custom control so that a VisualStateManager on the Custom control itself.

AnthonyWJones