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
1025
How to set a value on a cell for each row.
posted

I have an unbound field that is a boolean checkbox. I would like set this value based on something (I would have a method to determine if I should be checked based on some value in a different cell in the same row) either during the initialization of the row or maybe even after all the rows are rendered. It doesn't really matter. Which ever is easier.

 Thanks,

Rod Yager

Parents
  • 932
    posted

    Hi Rod,

    For that particular field define a binding as:

    CellValueFormatter foramtter = new CellValueFormatter();

    Binding binding = new Binding("Cells");binding.Mode = BindingMode.OneWay;

    binding.Converter = foramtter;

    field.Settings.EditorStyle = new Style(typeof(XamMaskedEditor));

    field.Settings.EditorStyle.Setters.Add(new Setter(XamMaskedEditor.ValueProperty, binding));

    Define CellValueFormatter as following:

    internal sealed class CellValueFormatter : IValueConverter
      {

       public object Convert(object value_, Type targetType_, object parameter_, CultureInfo culture_)
        {
          if (value_ != null)
          {
              CellCollection cells = value_ as  CellCollection;

              // Access cell here and return appropriate value.
           }

        }   

       public object ConvertBack(object value_, Type targetTypes_, object parameter_, CultureInfo culture_)
        {
          return null;
        }
    }

Reply Children
No Data