How can I give some space in C1NumericBox

Posted by: ronen.hong on 31 July 2022, 7:21 pm EST

  • Posted 31 July 2022, 7:21 pm EST

    Hi,
    Currently I am using C1NumericBox as below and I want to give some padding for room in right side of text keeping text align right but I couldn't achieve this. How can I do that?


    <c1:C1NumericBox Grid.Row="0" Grid.Column="1" x:Name="nmClsPrice" Margin="1,0,1,0" Padding="0,0,2,0" HorizontalContentAlignment="Right" FontWeight="Bold" Background="#F0CAA6"
    TextOptions.TextFormattingMode="Display" TextOptions.TextRenderingMode="Aliased" />



  • Marked as Answer

    Replied 31 July 2022, 8:36 pm EST

    Hi,

    You can customize the template of C1NumericBox by overriding its OnApplyTemplate() method and set the desired padding. Please refer the following code snippet for the same:

    public override void OnApplyTemplate()
    {
    base.OnApplyTemplate();
    var txtBox = GetTemplateChild("Text") as C1TextBoxBase;
    txtBox.Padding = new Thickness(0, 0, 2, 0);
    }


    Please refer to the attached sample for full implementation: NumericBoxRightPadding.zip

    Best Regards,
    Nitin
  • Replied 1 August 2022, 12:47 pm EST

    Wow, so fast! Thanks a lot!!!!
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels