protected void grid_RowDataBound(object sender, C1GridViewRowEventArgs e) { if (e.Row.RowType != C1GridViewRowType.DataRow) { return; } var parametro = e.Row.DataItem as TipoParametroDispositivo; var row = new Parameter(e.Row); row.Bind(parametro); }
private Parameter CreateParameter(DependencyObject target, string parameter) { var actualParameter = new Parameter(); if (parameter.StartsWith("'") && parameter.EndsWith("'")) { actualParameter.Value = parameter.Substring(1, parameter.Length - 2); } else if (_messageBinder.IsSpecialValue(parameter) || char.IsNumber(parameter[0])) { actualParameter.Value = parameter; } else { #if !SILVERLIGHT var nameAndBindingMode = parameter.Split(':') .Select(x => x.Trim()).ToArray(); var index = nameAndBindingMode[0].IndexOf('.'); if (index == -1) { actualParameter.Bind(target, parameter, null); } else { var elementName = nameAndBindingMode[0].Substring(0, index); var path = new PropertyPath(nameAndBindingMode[0].Substring(index + 1)); var binding = elementName == "$this" ? new Binding { Path = path, Source = target, UpdateSourceTrigger = _defaultTrigger } : new Binding { Path = path, ElementName = elementName, UpdateSourceTrigger = _defaultTrigger }; if (nameAndBindingMode.Length == 2) { binding.Mode = (BindingMode)Enum.Parse(typeof(BindingMode), nameAndBindingMode[1]); } BindingOperations.SetBinding(actualParameter, Parameter.ValueProperty, binding); } #else var index = parameter.IndexOf('.'); if (index > 0) { actualParameter.ElementName = parameter.Substring(0, index); actualParameter.Path = parameter.Substring(index + 1); } else { actualParameter.ElementName = parameter; } #endif } return(actualParameter); }