I am trying to apply the same `Margin` style to a lot of `RadWatermarkTextBox` controls by defining the `Margin` as a Style resource:
<Window.Resources>
<Style TargetType="{x:Type telerik:RadWatermarkTextBox}">
<Setter Property="Margin">
<Setter.Value>
<Thickness Bottom="{x:Static controls:Measurements.UnrelatedDistance}" />
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
Using the Style above makes the control look different compared to explicitly setting the `Margin` property for each control like below:
<telerik:RadWatermarkTextBox Text="Hello world">
<telerik:RadWatermarkTextBox.Margin>
<Thickness Bottom="{x:Static controls:Measurements.UnrelatedDistance}" />
</telerik:RadWatermarkTextBox.Margin>
</telerik:RadWatermarkTextBox>
I am wondering what's the reason for this difference and how to use a Style resource to the make the control look like the way it does when explicitly setting the `Margin` property within the control.
Thank you.
What do you mean by saying that the control look different? Do you mean that the Margin doesn't work when setting it through the Style, or the visualization of the control is different?
Note that, if you use the Telerik's NoXaml assemblies, you will need also to set the BasedOn property on the Style object.
<Style TargetType="{x:Type telerik:RadWatermarkTextBox}" BasedOn="{StaticResource RadWatermarkTextBoxStyle}">