I have a very simple XAML Visibility="Collapsed" X1="1" Margin="-35 0 0 0" Y1="0.4">
<Label.Content> <Slider Grid.Column="0" Width="20" Height="65" IsDirectionReversed="True" Maximum="0.1" Minimum="-4" Orientation="Vertical" x:Name="Slider1" Value="{Binding Source={x:Reference scaleFactorModifier}, Path=ZoomScaleFactor, Mode=TwoWay}" /> </Label.Content> </Label> </SciChart:CustomAnnotation.Content> </SciChart:CustomAnnotation> Now for some reason I need to set the CustomControl.Content property from code behind. Is there any possibility I move all the label control to some style and template and set the CustomControl content property at runtime with that particular style or template.
Update
Reason for using Code behind
Actually I have Annotations property in my control which could have any control in it as we required. Previously I had used hard coded annotations in my control and placed the controls manually. Now I want to bind the Annotations property. I could create a property of this type and add CustomAnnotation objects in it. But customAnnotation objects need to have labels and other controls in them, how could I do that?