Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Restrict characters in decimal field in WPF (MVVM)

$
0
0

Hi,

My application is WPF with MVVM.

I have a decima field which is binded to a text box. I want to restrict the characters to that textbox. How can i achieve this?

public Nullable<Decimal> Weight
        {
            get { return _item.Weight; }
            set
            {
                if (value.HasValue)
                {
                    _item.Weight = value.Value;
                    _isDirty = true;
                    OnPropertyChanged(PropertyNames.Item_Weight);
                }
            }
        }

Here _item is an entity.

If the value is any character then default value is 0.

If i input the value some characters then it is not debugging at all...

Thanks, Sai


Viewing all articles
Browse latest Browse all 18858

Trending Articles