Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
160
Again rounded borders in XAMTEXTEDITOR
posted

 

I have this style from my XAMTEXTEDITORS

    <Style TargetType="{x:Type igEditors:XamTextEditor}" >
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
        <Setter Property="BorderBrush" Value="Black" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Padding" Value="2,2,2,2" />
        <Setter Property="Margin" Value="{DynamicResource {x:Static igEditors:EditorsBrushKeys.TextEditorMarginKey}}" />
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}">
                    <Border x:Name="MainBorder"
                                CornerRadius="1"
         Background="{TemplateBinding Background}"
         BorderBrush="{TemplateBinding BorderBrush}"
         BorderThickness="{TemplateBinding BorderThickness}"
         SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
       >
                        <TextBlock x:Name="TextBlock"
       Margin="{TemplateBinding Padding}"
       Text="{TemplateBinding DisplayText}"
       TextWrapping="{TemplateBinding TextWrapping}"
       HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
       VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
       TextAlignment="{TemplateBinding TextAlignmentResolved}"
        />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="EditTemplate">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}">
                    <Border
      x:Name="MainBorder"
      Background="{TemplateBinding Background}"
      BorderBrush="{TemplateBinding BorderBrush}"
      BorderThickness="{TemplateBinding BorderThickness}" 
                                                            CornerRadius="5">

                        <TextBox
       Name="PART_FocusSite"
       Padding="{TemplateBinding Padding}"
       Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
       TextWrapping="{TemplateBinding TextWrapping}"
       HorizontalScrollBarVisibility="{TemplateBinding HorizontalScrollBarVisibility}"
       VerticalScrollBarVisibility="{TemplateBinding VerticalScrollBarVisibility}"
       HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
       VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
       TextAlignment="{TemplateBinding TextAlignmentResolved}"
                            MaxLength="{Binding Path=ValueConstraint.MaxLength, Mode=TwoWay}"                           
       IsReadOnly="{TemplateBinding ReadOnly}"
       Background="Transparent"
       BorderBrush="Transparent"
       BorderThickness="0,0,0,0"        
       Foreground="{TemplateBinding Foreground}"
       ContextMenu="{TemplateBinding ContextMenu}"
                            SpellCheck.IsEnabled="{TemplateBinding SpellCheck.IsEnabled}"
                            SpellCheck.SpellingReform="{TemplateBinding SpellCheck.SpellingReform}"
       />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsInEditMode" Value="True">
                            <Setter Property="IsTabStop" Value="False" />
                            <Setter Property="Padding" Value="0,2,2,2"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEmbedded" Value="True"/>
                    <Condition Property="IsInEditMode" Value="False"/>
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="{x:Null}"/>
                <Setter Property="BorderBrush" Value="{x:Null}"/>
                <Setter Property="Padding" Value="2,2,2,2"/>
            </MultiTrigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.InactiveBorderBrushKey}}"/>
                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
            </Trigger>
        </Style.Triggers>
    </Style>

 

My problem is that I want change the editor maxlength at runtime because I have this data at runtime form Database.

I have tried with this code

 

 

 

vc.MaxLength = 25 (Data form Database)

 

Dim setter4 As New Setter(XamTextEditor.ValueConstraintProperty, vc)

XamDGFormasPago.Records.FieldLayout.Fields(

"COD").Settings.EditorType = GetType(XamTextEditor)

st3.TargetType =

GetType(XamTextEditor)

st3.Setters.Add(setter4)

XamDGFormasPago.Records.FieldLayout.Fields(

"COD").Settings.EditorStyle = st3

The problem is that my text editor maxlength is 25 but the editor doesn`t have rounded borders.

Can yo explain me how can I do it.

Parents
No Data
Reply
  • 138253
    Offline posted

    Hello,

     

    It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into your post I can suggest you set the CornerRadius  Property of the “MainBorder” Border that is in the Template to 5.

     

    Feel free to write me if you have further questions.

Children
No Data