本文整理汇总了C#中System.Windows.FrameworkElementFactory.AddHandler方法的典型用法代码示例。如果您正苦于以下问题:C# FrameworkElementFactory.AddHandler方法的具体用法?C# FrameworkElementFactory.AddHandler怎么用?C# FrameworkElementFactory.AddHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.FrameworkElementFactory
的用法示例。
在下文中一共展示了FrameworkElementFactory.AddHandler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EditableTextBlock
public EditableTextBlock()
{
var textBox = new FrameworkElementFactory(typeof(TextBox));
textBox.SetValue(Control.PaddingProperty, new Thickness(1)); // 1px for border
textBox.AddHandler(FrameworkElement.LoadedEvent, new RoutedEventHandler(TextBox_Loaded));
textBox.AddHandler(UIElement.KeyDownEvent, new KeyEventHandler(TextBox_KeyDown));
textBox.AddHandler(UIElement.LostFocusEvent, new RoutedEventHandler(TextBox_LostFocus));
textBox.SetBinding(TextBox.TextProperty, new System.Windows.Data.Binding("Text") { Source = this, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged });
var editTemplate = new DataTemplate { VisualTree = textBox };
var textBlock = new FrameworkElementFactory(typeof(TextBlock));
textBlock.SetValue(FrameworkElement.MarginProperty, new Thickness(2));
textBlock.AddHandler(UIElement.MouseDownEvent, new MouseButtonEventHandler(TextBlock_MouseDown));
textBlock.SetBinding(TextBlock.TextProperty, new System.Windows.Data.Binding("Text") { Source = this });
var viewTemplate = new DataTemplate { VisualTree = textBlock };
var style = new System.Windows.Style(typeof(EditableTextBlock));
var trigger = new Trigger { Property = IsInEditModeProperty, Value = true };
trigger.Setters.Add(new Setter { Property = ContentTemplateProperty, Value = editTemplate });
style.Triggers.Add(trigger);
trigger = new Trigger { Property = IsInEditModeProperty, Value = false };
trigger.Setters.Add(new Setter { Property = ContentTemplateProperty, Value = viewTemplate });
style.Triggers.Add(trigger);
Style = style;
}
示例2: CreateOnOffSensorButtonTemplate
public FrameworkElementFactory CreateOnOffSensorButtonTemplate()
{
FrameworkElementFactory buttonTemplate = new FrameworkElementFactory(typeof (CheckBox));
buttonTemplate.SetValue(UIElement.ClipToBoundsProperty, true);
buttonTemplate.SetBinding(ToggleButton.IsCheckedProperty, new Binding("IsOffByUser")
{
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
});
buttonTemplate.AddHandler(
ToggleButton.CheckedEvent,
new RoutedEventHandler((o, e) =>
{
DataGridSensorView dataGridSensorView = ((FrameworkElement) o).DataContext as DataGridSensorView;
if (dataGridSensorView != null)
{
dataGridSensorView.IsOffByUser = true.ToString();
}
}));
buttonTemplate.AddHandler(
ToggleButton.UncheckedEvent,
new RoutedEventHandler((o, e) =>
{
DataGridSensorView dataGridSensorView = ((FrameworkElement) o).DataContext as DataGridSensorView;
if (dataGridSensorView != null)
{
dataGridSensorView.IsOffByUser = false.ToString();
}
}));
return buttonTemplate;
}
示例3: SelectTemplate
public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
{
var datatemplate = new DataTemplate();
if (item == null)
return datatemplate;
if (_edit)
{
datatemplate.VisualTree = new FrameworkElementFactory(typeof(StackPanel));
var converter = new EnumValueConverter(item,property);
foreach (object value in Enum.GetValues(enumType))
{
var cbox = new FrameworkElementFactory(typeof(CheckBox));
cbox.SetValue(CheckBox.ContentProperty, value.ToString());
Delegate add = (RoutedEventHandler)delegate(object obj, RoutedEventArgs e) { };
var b = new Binding(property);
b.Converter = converter;
b.ConverterParameter = value;
b.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
cbox.SetValue(CheckBox.IsCheckedProperty, b);
cbox.AddHandler(CheckBox.CheckedEvent, add);
cbox.AddHandler(CheckBox.UncheckedEvent, add);
datatemplate.VisualTree.AppendChild(cbox);
}
}
else
{
datatemplate.VisualTree = new FrameworkElementFactory(typeof(Label));
datatemplate.VisualTree.SetValue(Label.ContentProperty, new Binding(property));
}
return datatemplate;
}
示例4: AddButtonColumn
public void AddButtonColumn(string buttonText, int widthPercent, RoutedEventHandler clickHandler,Style style = null)
{
FrameworkElementFactory ef = new FrameworkElementFactory(typeof(Button));
ef.SetValue(Button.StyleProperty, ResourceLoader.GetControlStyle("ButtonStyle"));
ef.SetValue(Button.ContentProperty, buttonText);
ef.AddHandler(Button.ClickEvent, clickHandler, true);
AddColumn(ef, widthPercent, "","",style);
}
示例5: addCustomColumn
private void addCustomColumn(string columnName)
{
DataGridTemplateColumn dt = new DataGridTemplateColumn();
dt.Header = columnName;
FrameworkElementFactory editButton = new FrameworkElementFactory(typeof(Button), string.Format("{0}Button", columnName.ToLower()));
editButton.SetValue(Button.ContentProperty, columnName);
editButton.SetValue(Button.NameProperty, string.Format("{0}Button", columnName.ToLower()));
editButton.AddHandler(Button.ClickEvent, new RoutedEventHandler(delete_Click));
DataTemplate cellTemplate = new DataTemplate();
cellTemplate.VisualTree = editButton;
dt.CellTemplate = cellTemplate;
resultsGrid.Columns.Add(dt);
}
示例6: UcTableView_SizeChanged
void UcTableView_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (dt == null)
{
return;
}
_gridview.Columns.Clear();
foreach (DataColumn c in dt.Columns)
{
GridViewColumn gvc = new GridViewColumn();
gvc.Header = c.ColumnName;
if (BShowDetails)
{
gvc.Width = (_listview.ActualWidth - 65) / dt.Columns.Count;
}
else
{
gvc.Width = (_listview.ActualWidth - 25) / dt.Columns.Count;
}
gvc.SetValue(HorizontalAlignmentProperty, HorizontalAlignment.Center);
//gvc.DisplayMemberBinding = (new Binding(c.ColumnName));
FrameworkElementFactory text = new FrameworkElementFactory(typeof(TextBlock));
text.SetValue(TextBlock.HorizontalAlignmentProperty, HorizontalAlignment.Center);
text.SetValue(TextBlock.TextAlignmentProperty, TextAlignment.Center);
text.SetBinding(TextBlock.TextProperty, new Binding(c.ColumnName));
DataTemplate dataTemplate = new DataTemplate() { VisualTree = text };
gvc.CellTemplate = dataTemplate;
_gridview.Columns.Add(gvc);
}
if (BShowDetails)
{
GridViewColumn gvc_details = new GridViewColumn();
gvc_details.Header = "详情";
FrameworkElementFactory button_details = new FrameworkElementFactory(typeof(Button));
button_details.SetResourceReference(Button.HorizontalContentAlignmentProperty, HorizontalAlignment.Center);
button_details.SetValue(Button.WidthProperty, 40.0);
button_details.AddHandler(Button.ClickEvent, new RoutedEventHandler(details_Click));
button_details.SetBinding(Button.TagProperty, new Binding(dt.Columns[1].ColumnName));
button_details.SetValue(Button.ContentProperty, ">>");
button_details.SetValue(Button.ForegroundProperty, Brushes.Blue);
button_details.SetValue(Button.FontSizeProperty, 14.0);
button_details.SetBinding(Button.VisibilityProperty, new Binding(dt.Columns[0].ColumnName) { Converter = new VisibleBtnConverter() });
DataTemplate dataTemplate_details = new DataTemplate() { VisualTree = button_details };
gvc_details.CellTemplate = dataTemplate_details;
_gridview.Columns.Add(gvc_details);
}
_listview.ItemsSource = null;
_listview.ItemsSource = dt.DefaultView;
}
示例7: DataTemplateImpl
static DataTemplateImpl()
{
//set up the grid
FrameworkElementFactory gridFactory = new FrameworkElementFactory(typeof(Grid));
gridFactory.SetValue(Grid.HorizontalAlignmentProperty, HorizontalAlignment.Stretch);
gridFactory.AddHandler(Grid.LoadedEvent, (RoutedEventHandler)OnExpanderHeaderItemLoaded);
//set up the content presenter
FrameworkElementFactory presenterHolder = new FrameworkElementFactory(typeof(ContentPresenter));
presenterHolder.SetBinding(ContentPresenter.ContentProperty,
new Binding("Content") { RelativeSource = RelativeSource.TemplatedParent });
gridFactory.AppendChild(presenterHolder);
GridFactory = gridFactory;
}
示例8: CreateCellEditingTemplate
internal static System.Windows.DataTemplate CreateCellEditingTemplate(EntityFieldInfo entityFieldInfo,DataGrid dataGrid)
{
DataTemplate dataTemplate = new DataTemplate();
FrameworkElementFactory contentControl = new FrameworkElementFactory(typeof(ContentControl));
contentControl.SetBinding(ContentControl.ContentProperty, new Binding());
Style contentControlStyle = new Style();
contentControlStyle.Triggers.Add(CreateTrigger(entityFieldInfo, GenericDataListState.Search, dataGrid));
contentControlStyle.Triggers.Add(CreateTrigger(entityFieldInfo, GenericDataListState.Display, dataGrid));
contentControlStyle.Triggers.Add(CreateTrigger(entityFieldInfo, GenericDataListState.InsertingEmpty, dataGrid));
contentControlStyle.Triggers.Add(CreateTrigger(entityFieldInfo, GenericDataListState.Updating, dataGrid));
contentControlStyle.Triggers.Add(CreateTrigger(entityFieldInfo, GenericDataListState.InsertingDisplay, dataGrid));
contentControl.SetValue(ContentControl.StyleProperty, contentControlStyle);
contentControl.AddHandler(ContentControl.GotFocusEvent, new RoutedEventHandler(OnContentControlGotFocus));
dataTemplate.VisualTree = contentControl;
return dataTemplate;
}
示例9: OnApplyTemplate
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
//ItemTemplateをプロパティ値から動的に作成
var elementFactory = new FrameworkElementFactory(typeof(RadioButton));
if (!string.IsNullOrEmpty(TitleMemberPath))
{
elementFactory.SetValue(RadioButton.ContentProperty, new Binding(TitleMemberPath));
}
if (!string.IsNullOrEmpty(IsCheckedMemberPath))
{
elementFactory.SetValue(RadioButton.IsCheckedProperty, new Binding(IsCheckedMemberPath));
}
elementFactory.SetValue(RadioButton.GroupNameProperty, string.IsNullOrEmpty(GroupName) ? Guid.NewGuid().ToString() : GroupName);
elementFactory.AddHandler(RadioButton.CheckedEvent, new RoutedEventHandler(CheckedMethod));
this.ItemTemplate = new DataTemplate { VisualTree = elementFactory };
}
示例10: DataGridDbObjectColumn
public DataGridDbObjectColumn(string bindingPath, Action<DbObject,string,DbObject> clickHandler)
{
this.bindingPath = bindingPath;
this.clickHandler = clickHandler;
// var stackPanelFactory = new FrameworkElementFactory(typeof (StackPanel));
// stackPanelFactory.SetValue(StackPanel.OrientationProperty,Orientation.Horizontal);
// stackPanelFactory.SetValue(Control.MarginProperty, new Thickness(1));
// stackPanelFactory.SetValue(Control.WidthProperty,300.0);
var gridFactory = new FrameworkElementFactory(typeof (Grid));
gridFactory.SetValue(Control.MarginProperty, new Thickness(1));
var columnDefinitionFactory1 = new FrameworkElementFactory(typeof(ColumnDefinition));
columnDefinitionFactory1.SetValue(ColumnDefinition.WidthProperty,new GridLength(1,GridUnitType.Star));
gridFactory.AppendChild(columnDefinitionFactory1);
var columnDefinitionFactory2 = new FrameworkElementFactory(typeof(ColumnDefinition));
columnDefinitionFactory2.SetValue(ColumnDefinition.WidthProperty,GridLength.Auto);
gridFactory.AppendChild(columnDefinitionFactory2);
var textBlockFactory = new FrameworkElementFactory(typeof(TextBlock));
textBlockFactory.SetBinding(TextBlock.TextProperty,new Binding(bindingPath));
textBlockFactory.SetValue(Control.HorizontalAlignmentProperty, HorizontalAlignment.Stretch);
// textBlockFactory.AddHandler(UIElement.MouseDownEvent,new MouseButtonEventHandler(OnClick));
var buttonFactory = new FrameworkElementFactory(typeof (Button));
buttonFactory.AddHandler(Button.ClickEvent, new RoutedEventHandler(OnClick),true);
buttonFactory.SetValue(Button.ContentProperty,"...");
// buttonFactory.SetValue(Button.ContentProperty,new Viewbox);
buttonFactory.SetValue(Button.HeightProperty,16.0);
buttonFactory.SetValue(Button.PaddingProperty,new Thickness(1));
buttonFactory.SetValue(Button.HorizontalAlignmentProperty,HorizontalAlignment.Right);
// buttonFactory.SetValue(Button.MarginProperty,new Thickness(1));
// stackPanelFactory.AppendChild(textBlockFactory);
// stackPanelFactory.AppendChild(buttonFactory);
gridFactory.AppendChild(textBlockFactory);
gridFactory.AppendChild(buttonFactory);
CellTemplate = new DataTemplate(){VisualTree = gridFactory};
// CellTemplate.Seal();
// CellEditingTemplate = CellTemplate;
}
示例11: OnTimingsSourceChanged
private static void OnTimingsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var listView = d as ListView;
var data = e.NewValue as IEnumerable<Timing>;
var gridView = listView.View as GridView;
// Remove generated columns
var toRemove = gridView.Columns.Where(c => GetGeneratedColumn(c)).ToList();
foreach (var column in toRemove)
gridView.Columns.Remove(column);
listView.ItemsSource = data;
// Generate new columns
var customColumns = extractCustomTimings(data);
foreach (var columnName in customColumns)
{
var content = new FrameworkElementFactory(typeof(TextBlock));
content.SetBinding(TextBlock.TextProperty, new Binding
{
Converter = CustomTimingConverter.Instance,
ConverterParameter = columnName,
Mode = BindingMode.OneTime
});
content.AddHandler(UIElement.MouseDownEvent, buildMouseHandler(listView));
var gridViewColumn = new GridViewColumn
{
Header = columnName,
CellTemplate = new DataTemplate
{
DataType = typeof(Timing),
VisualTree = content
}
};
SetGeneratedColumn(gridViewColumn, true);
gridView.Columns.Add(gridViewColumn);
}
}
示例12: SetFocusEventHandlerToTextBox
public static void SetFocusEventHandlerToTextBox(FrameworkElementFactory textBox)
{
textBox.AddHandler(TextBox.GotFocusEvent,
new RoutedEventHandler(TextBoxGotFocusEventHandler));
}
示例13: CreateHierarchicalDataTemplate
/// <summary>
/// Creates a new HierarchicalDataTemplate for the internal tree view
/// when the property PropertyName or ChildPropertyName is changed.
/// </summary>
private void CreateHierarchicalDataTemplate()
{
var textBoxFactory = new FrameworkElementFactory(typeof(EditableTextBlock));
var template = new HierarchicalDataTemplate
{
ItemsSource = new Binding("Children")
};
textBoxFactory.SetBinding(EditableTextBlock.TextProperty, new Binding("Name"));
// set up the event handlers
textBoxFactory.AddHandler(MouseDoubleClickEvent, new MouseButtonEventHandler(EditableTextBlockMouseDoubleClick));
textBoxFactory.AddHandler(KeyDownEvent, new KeyEventHandler(EditableTextBlockKeyDown));
textBoxFactory.AddHandler(MouseUpEvent, new MouseButtonEventHandler(EditableTextBlockMouseUp));
// attach the textbox to the tempaltes visual tree.
template.VisualTree = textBoxFactory;
// attach the template to the tree view
TView.ItemTemplate = template;
}
示例14: OnValidar_TipoOrigen
private void OnValidar_TipoOrigen(object sender, SelectionChangedEventArgs e)
{
GridViewColumn Columna;
FrameworkElementFactory Txt;
Assembly assembly;
string TipoDato;
IList<MMaster> ListadoAliado = service.GetMMaster(new MMaster { MetaType = new MType { Code = "ALIADO" } });
Columna = new GridViewColumn();
assembly = Assembly.GetAssembly(Type.GetType("System.Windows.Controls.ComboBox, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"));
TipoDato = "System.Windows.Controls.ComboBox";
Columna.Header = "Origen";
Txt = new FrameworkElementFactory(assembly.GetType(TipoDato));
Txt.SetValue(ComboBox.ItemsSourceProperty, View.Model.ListadoAliado.Where(f => f.Name.StartsWith(((ComboBox)sender).SelectedValue.ToString())));
Txt.SetValue(ComboBox.DisplayMemberPathProperty, "Name");
Txt.SetValue(ComboBox.SelectedValuePathProperty, "Code");
Txt.SetBinding(ComboBox.SelectedValueProperty, new System.Windows.Data.Binding("ORIGEN"));//cambia la columna serial
Txt.SetValue(ComboBox.WidthProperty, (double)130);
Txt.SetBinding(ComboBox.TagProperty, new System.Windows.Data.Binding("Serial"));//obtiene el dato de origen
Txt.AddHandler(System.Windows.Controls.ComboBox.SelectionChangedEvent, new SelectionChangedEventHandler(OnValidarOrigen)); //NUEVO EVENTO
// add textbox template
Columna.CellTemplate = new DataTemplate();
Columna.CellTemplate.VisualTree = Txt;
// View.ListadoEquipos.Columns.Add(Columna); //Creacion de la columna en el GridView
int cont = 0;
//var yourListViewItem = (ListViewItem)View.ListadoEquiposAProcesar.ItemContainerGenerator.ContainerFromItem(View.ListadoEquiposAProcesar.SelectedItem);
//ComboBox cb = FindByName("", yourListViewItem) as ComboBox;
// Util.ShowMessage(cb.Content + " IsChecked :" + cb.IsChecked);
foreach (GridViewColumn rere in View.ListadoEquipos.Columns)
{
if (cont == 7)
{
//Util.ShowMessage(i.GetType().ToString());
//i.CellTemplate = new DataTemplate();
//i.CellTemplate.VisualTree = Txt;
}
cont++;
}
//DataRowView dataRow = (DataRowView)View.ListadoEquiposAProcesar.SelectedItem;
//Object[] cellValue = dataRow.Row.ItemArray;
//int cont = 0;
//foreach (GridViewColumn i in View.ListadoEquipos.Columns)
//{
// Console.WriteLine("------------- "+i.Header.ToString()+" "+cont);
// cont++;
//}
//foreach (DataRowView dr in View.ListadoEquiposAProcesar.Items)
//{
// if (dr[0].ToString() == ((ComboBox)sender).Tag.ToString())
// {
// dr[7] =
// }
//}
//ComboBox.ItemsSourceProperty, ComboBox.ItemsSourceProperty, View.Model.ListadoAliado.Where(f => f.Name.StartsWith(filtro)));
//GridViewColumn Columna;
//FrameworkElementFactory Txt;
//Assembly assembly;
//string TipoDato;
//IList<MMaster> ListadoAliado = service.GetMMaster(new MMaster { MetaType = new MType { Code = "ALIADO" } });
//Columna = new GridViewColumn();
//assembly = Assembly.GetAssembly(Type.GetType("System.Windows.Controls.ComboBox, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"));
//TipoDato = "System.Windows.Controls.ComboBox";
//Columna.Header = "Origen";
//Txt = new FrameworkElementFactory(assembly.GetType(TipoDato));
//String filtro = "";
//foreach (DataRowView dr in View.ListadoEquiposAProcesar.Items)
//{
// if (dr[0].ToString() == ((ComboBox)sender).Tag.ToString())
// {
// filtro = dr[6].ToString();
// Txt.SetValue(ComboBox.ItemsSourceProperty, View.Model.ListadoAliado.Where(f => f.Name.StartsWith(filtro)));
// Txt.SetValue(ComboBox.DisplayMemberPathProperty, "Name");
// Txt.SetValue(ComboBox.SelectedValuePathProperty, "Code");
// Txt.SetBinding(ComboBox.SelectedValueProperty, new System.Windows.Data.Binding("ORIGEN"));//cambia la columna serial
// Txt.SetValue(ComboBox.WidthProperty, (double)130);
// Txt.SetBinding(ComboBox.TagProperty, new System.Windows.Data.Binding("Serial"));//obtiene el dato de origen
// Txt.AddHandler(System.Windows.Controls.ComboBox.SelectionChangedEvent, new SelectionChangedEventHandler(OnValidarOrigen)); //NUEVO EVENTO
// // add textbox template
// Columna.CellTemplate = new DataTemplate();
// Columna.CellTemplate.VisualTree = Txt;
// // View.ListadoEquipos.Columns.Add(Columna); //Creacion de la columna en el GridView
//.........这里部分代码省略.........
示例15: GenerarColumnasDinamicas
public void GenerarColumnasDinamicas()
{
//Variables Auxiliares
GridViewColumn Columna;
FrameworkElementFactory Txt;
Assembly assembly;
string TipoDato;
#region Columna Estatus Diagnostico
//IList<MMaster> ListadoStatusDiagnostico = service.GetMMaster(new MMaster { MetaType = new MType { Code = "ESTATUSD" } });
//Columna = new GridViewColumn();
//assembly = Assembly.GetAssembly(Type.GetType("System.Windows.Controls.ComboBox, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"));
//TipoDato = "System.Windows.Controls.ComboBox";
//Columna.Header = "Status Diagnostico";
//Txt = new FrameworkElementFactory(assembly.GetType(TipoDato));
//Txt.SetValue(ComboBox.ItemsSourceProperty, ListadoStatusDiagnostico);
//Txt.SetValue(ComboBox.DisplayMemberPathProperty, "Name");
//Txt.SetValue(ComboBox.SelectedValuePathProperty, "Code");
//Txt.SetBinding(ComboBox.SelectedValueProperty, new System.Windows.Data.Binding("Estatus_Diagnostico"));
//Txt.SetValue(ComboBox.WidthProperty, (double)110);
//// add textbox template
//Columna.CellTemplate = new DataTemplate();
//Columna.CellTemplate.VisualTree = Txt;
//View.ListadoEquipos.Columns.Add(Columna); //Creacion de la columna en el GridView
//View.Model.ListRecords.Columns.Add("Estatus_Diagnostico", typeof(String)); //Creacion de la columna en el DataTable
Columna = new GridViewColumn();
assembly = Assembly.GetAssembly(Type.GetType("System.Windows.Controls.TextBlock, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"));
TipoDato = "System.Windows.Controls.TextBlock";
Columna.Header = "Status Diagnostico";
Txt = new FrameworkElementFactory(assembly.GetType(TipoDato));
Txt.SetValue(TextBlock.MinWidthProperty, (double)100);
Txt.SetBinding(TextBlock.TextProperty, new System.Windows.Data.Binding("Estatus_Diagnostico"));
// add textbox template
Columna.CellTemplate = new DataTemplate();
Columna.CellTemplate.VisualTree = Txt;
View.ListadoEquipos.Columns.Add(Columna); //Creacion de la columna en el GridView
View.Model.ListRecords.Columns.Add("Estatus_Diagnostico", typeof(String)); //Creacion de la columna en el DataTable
#endregion
#region Columna Tipo Diagnostico
Columna = new GridViewColumn();
assembly = Assembly.GetAssembly(Type.GetType("System.Windows.Controls.TextBox, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"));
TipoDato = "System.Windows.Controls.TextBox";
Columna.Header = "Tipo Diagnostico";
Txt = new FrameworkElementFactory(assembly.GetType(TipoDato));
Txt.SetValue(TextBox.MinWidthProperty, (double)100);
Txt.SetBinding(TextBox.TextProperty, new System.Windows.Data.Binding("TIPO_DIAGNOSTICO"));
Txt.SetValue(TextBox.TabIndexProperty, (int)0);//Interruption Point
Txt.SetValue(TextBox.IsTabStopProperty, true);
// add textbox template
Columna.CellTemplate = new DataTemplate();
Columna.CellTemplate.VisualTree = Txt;
View.ListadoEquipos.Columns.Add(Columna); //Creacion de la columna en el GridView
View.Model.ListRecords.Columns.Add("TIPO_DIAGNOSTICO", typeof(String)); //Creacion de la columna en el DataTable
#endregion
#region Columna Falla Equipo
IList<MMaster> ListadoFallaEquipoDiagnostico = service.GetMMaster(new MMaster { MetaType = new MType { Code = "FALLADIR" } });
Columna = new GridViewColumn();
assembly = Assembly.GetAssembly(Type.GetType("System.Windows.Controls.ComboBox, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"));
TipoDato = "System.Windows.Controls.ComboBox";
Columna.Header = "Falla Equipo";
Txt = new FrameworkElementFactory(assembly.GetType(TipoDato));
Txt.SetValue(ComboBox.ItemsSourceProperty, ListadoFallaEquipoDiagnostico);
Txt.SetValue(ComboBox.DisplayMemberPathProperty, "Name");
Txt.SetValue(ComboBox.SelectedValuePathProperty, "Code");
Txt.SetBinding(ComboBox.SelectedValueProperty, new System.Windows.Data.Binding("FALLA_DIAGNOSTICO"));
Txt.SetValue(ComboBox.WidthProperty, (double)110);
Txt.SetBinding(ComboBox.TagProperty, new System.Windows.Data.Binding("Serial"));
Txt.AddHandler(System.Windows.Controls.ComboBox.SelectionChangedEvent, new SelectionChangedEventHandler(OnValidarDiagnostico)); //NUEVO EVENTO
// add textbox template
Columna.CellTemplate = new DataTemplate();
Columna.CellTemplate.VisualTree = Txt;
View.ListadoEquipos.Columns.Add(Columna); //Creacion de la columna en el GridView
View.Model.ListRecords.Columns.Add("FALLA_DIAGNOSTICO", typeof(String)); //Creacion de la columna en el DataTable
#endregion
#region Columna Tecnico Diagnosticador
//IList<Rol> ObtRol1 = service.GetRol(new Rol { RolCode = "DTVDIAG" });
//String ObtRol = service.GetUserByRol(new UserByRol { Rol = (Rol)ObtRol1 }).Select(f => f.Rol).ToString();
//IList<SysUser> ListadoTecnicoDiagnosticadorCalidad = service.GetSysUser(new SysUser { UserRols = (List<UserByRol>)ObtRol });
IList<SysUser> ListadoTecnicoDiagnosticadorCalidad = service.GetSysUser(new SysUser());
Columna = new GridViewColumn();
assembly = Assembly.GetAssembly(Type.GetType("System.Windows.Controls.ComboBox, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"));
TipoDato = "System.Windows.Controls.ComboBox";
//.........这里部分代码省略.........