Пример #1
0
 /// <summary>
 /// It seems WinForm doesn't allow simple one-way from model to form control.
 /// If it is possible, this code should be replaced
 /// StringByValue should take value. Creator of this binding should control the real type of the value.
 /// </summary>
 /// <returns>new binding</returns>
 public static Binding CreateOneWayReadToString(string propertyName, object dataSource, string dataMember, StringByValue oneWayConverter)
 {
     OneWayBindingToString bind = new OneWayBindingToString(propertyName, dataSource, dataMember, oneWayConverter);
     bind.FormattingEnabled = true;
     bind.Format += new ConvertEventHandler(BindingHelper.Invert);
     bind.Parse += new ConvertEventHandler(BindingHelper.Invert);
     return bind;
 }
Пример #2
0
        /// <summary>
        /// It seems WinForm doesn't allow simple one-way from model to form control.
        /// If it is possible, this code should be replaced
        /// StringByValue should take value. Creator of this binding should control the real type of the value.
        /// </summary>
        /// <returns>new binding</returns>
        public static Binding CreateOneWayReadToString(string propertyName, object dataSource, string dataMember, StringByValue oneWayConverter)
        {
            OneWayBindingToString bind = new OneWayBindingToString(propertyName, dataSource, dataMember, oneWayConverter);

            bind.FormattingEnabled = true;
            bind.Format           += new ConvertEventHandler(BindingHelper.Invert);
            bind.Parse            += new ConvertEventHandler(BindingHelper.Invert);
            return(bind);
        }