numeric column accepts integer only

Good morning,

in a gant control i added a new column as follow


 Dim ColumnPriorità As New Syncfusion.UI.Xaml.TreeGrid.TreeGridNumericColumn

                ColumnPriorità.HeaderText = "Priorità"

                ColumnPriorità.MappingName = "Prior"

                ColumnPriorità.NumberDecimalDigits = 2

                ColumnPriorità.Width = 100

                ColumnPriorità.AllowEditing = True

                GanttComm.GanttGrid.Columns.Insert(8, ColumnPriorità)


Everithing is ok but i cannot add decimal values. They always are trunked to te nearest integer.

Can You please help me?

thank You

Best regards

MArco Del Frate



2 Replies

VR Vallarasu Ravichandran Syncfusion Team October 28, 2025 01:07 PM UTC

Hi marco del frate,


# Regarding issue WPF Gantt Control Fails to Handle Decimal Input in Numeric Column.

We have checked, and we can replicate the reported issue from our end. We have logged an issue report for the same; we will fix this issue and include the issue fix in our weekly NuGet release update which is expected to be available by November 11, 2025. We appreciate your patience until then.

You can track the status of this report through the following feedback link: 
https://www.syncfusion.com/feedback/70921/wpf-gantt-control-fails-to-handle-decimal-input-in-numeri…

Note: The provided feedback link is private, and you need to log in to view this feedback.

 

Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.

 

Regards,

Vallarasu R.




VO Vishal Omprasad Syncfusion Team November 11, 2025 02:33 PM UTC

Hi marco del frate,


Based on the shared details we have checked the reported query “WPF Gantt Control Fails to Handle Decimal Input in Numeric Column”.


As per the current implementation, the numeric column in WPF GanttControl is based on DoubleTextBox, hence it follows that behavior and does not support precise decimal input by design.


To overcome this scenario, we suggest a sample-level solution by creating a new custom column for Numeric text using TreeGridCellTextBoxRenderer, to allow precise decimal values. Please find the code snippet below:

[C#]:

internal class NumericTextColumn : TreeGridTextColumn

{

    public NumericTextColumn()

    {

        this.SetCellType("NumericTextRenderer");

    }

}

 

public class NumericTextBoxRenderer : TreeGridCellTextBoxRenderer

{

    public override void OnInitializeEditElement(TreeDataColumnBase dataColumn, TextBox textBox, object dataContext)

    {

        base.OnInitializeEditElement(dataColumn, textBox, dataContext);

        textBox.PreviewTextInput += OnPreviewTextInput;

        DataObject.AddPastingHandler(textBox, OnPaste);

    }

 

    protected override void OnUnwireEditUIElement(TextBox textBox)

    {

        textBox.PreviewTextInput -= OnPreviewTextInput;

        DataObject.RemovePastingHandler(textBox, OnPaste);

        base.OnUnwireEditUIElement(textBox);

    }

 

    protected override void OnEditElementUnloaded(object sender, RoutedEventArgs e)

    {

        base.OnEditElementUnloaded(sender, e);

        var textBox = (TextBox)sender;

        textBox.PreviewTextInput -= OnPreviewTextInput;

        DataObject.RemovePastingHandler(textBox, OnPaste);

    }

 

    private void OnPreviewTextInput(object sender, TextCompositionEventArgs e)

    {

        e.Handled = !IsTextAllowed((TextBox)sender, e.Text);

    }

 

    private void OnPaste(object sender, DataObjectPastingEventArgs e)

    {

        if (!e.SourceDataObject.GetDataPresent(DataFormats.Text)) return;

 

        var tb = (TextBox)sender;

        string s = e.SourceDataObject.GetData(DataFormats.Text) as string ?? string.Empty;

 

        if (!IsTextAllowed(tb, s))

            e.CancelCommand();

    }

 

    private static bool IsTextAllowed(TextBox textBox, string newText)

    {

        string preview = textBox.Text.Remove(textBox.SelectionStart, textBox.SelectionLength)

                           .Insert(textBox.SelectionStart, newText);

        if (string.IsNullOrEmpty(preview)) return true;

        var style = NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign;

        return double.TryParse(preview, style, CultureInfo.CurrentCulture, out _);

    }

}


We have prepared an example sample demonstrating the above suggested approach and have attached the sample below for your reference. Please check the attached sample and let us know whether this meets your requirements.


We apologize for any inconvenience caused. Additionally, we have logged this as a feature request for future consideration.


Feedback link: https://www.syncfusion.com/feedback/70921/provide-support-for-precise-decimal-input-in-numeric-columns-of-the-wpf-gantt.


We hope that this helps you. Please let us know if you need further assistance.


Regards,
Vishal O.


Attachment: WPFGanttDemo_465ea74a.zip

Loader.
Up arrow icon