Styling DataFormItem

Jun 7, 2013 at 12:29 PM
I can not set MaxWidth of TextBox in dataform:DataFormItem.Content:
<dataform:DataForm.Resources>
                    <Style x:Key="WrappingTextStyle" TargetType="{x:Type TextBox}">
                        <Setter Property="TextWrapping" Value="WrapWithOverflow"/>
                        <Setter Property="MaxWidth" Value="200"/>
                    </Style>
</dataform:DataForm.Resources>
Coordinator
Jun 10, 2013 at 8:14 AM
Hi brilkov,

to solve this issue:
  • uncomment the line 1243 in class DataForm:
ctl = new TextBox()
{
  //HorizontalAlignment = HorizontalAlignment.Stretch,
  VerticalAlignment = VerticalAlignment.Center,
};
  • make the style implicit and set the HorizontalAlignment property to Left:
<Style TargetType="{x:Type TextBox}">
    <Setter Property="TextWrapping" Value="WrapWithOverflow"/>
    <Setter Property="HorizontalAlignment" Value="Left"/>
    <Setter Property="MaxWidth" Value="200"/>
</Style>
Cheers,

Jörg