Im working on a WPF Custom Control that takes Elements and hides/shows them with a Toggle Button.
The Elements to be hidden should be defined by the User of the Control during Design Time.
The important part of my Control Looks like this:
MyCustomControl.cs
...
public UIElement InnerContent
{
get { return (UIElement)GetValue(InnerContentProperty); }
set { SetValue(InnerContentProperty, value); }
}
public static readonly DependencyProperty InnerContentProperty =
DependencyProperty.Register("InnerContent", typeof(UIElement), typeof(MyCustomControl));
...
And the corresponding ContentPresenter like this:
<ContentPresenter Height="0"
x:Name="ToggleRegion"
Content="{Binding Path=InnerContent, RelativeSource={RelativeSource AncestorType=local:MyCustomControl}}">
</ContentPresenter>
My Problem now is it, that i need to make the Height of the ContentPresenter at 0 because i want the Content to be hidden at the Start. Is there a Way i can allow the user of my Control to add Elements by Drag and Drop during his Design Time? This Control should work completly in XAML. The only things defined in Code Behind are the Properties.
Thanks for your help.