0

I am working on an windows8 application, in which I have a grid to show list of items. Each row has a textbox to take some input, when I enter any value on one of the textbox in a row and then scroll down then other rows (scrolling up from bottom) automatically has this same value set in the textbox. This is causing issues as I am getting unwanted rows in behind code.

Any idea what is this and how to handle it ?

Below is how it looks - See, I am on 3rd line and 6th line already has value.

enter image description here

Rohit
  • 1,520
  • 2
  • 17
  • 36

2 Answers2

1

Be sure that your binding is on TwoWay

<TextBox Text="{Binding MyProperty, Mode=TwoWay}"/>
0

I noticed that the false values were only visible, on textbox but it was not updated in model and I was able to handled it via ValueConverter.

public class DefaultQtyConverter : IValueConverter
{
    object val;

    public object Convert(object value, Type targetType, object parameter, string language)
    {
        try
        {
            if (((<Your Model>)value).<property to check> == 0)
                val = String.Empty; 
            else
                val = ((<Your Model>)value).<property to check>;
        }
        catch { }

        return val;
    }

    public object ConvertBack(object value, Type targetType, object parameter, string language)
    {
        throw new NotImplementedException();
    }
}

Hope this helps someone in future.

Rohit
  • 1,520
  • 2
  • 17
  • 36