public override void BindCellContent(System.Windows.FrameworkElement cellContent, C1.WPF.DataGrid.DataGridRow row) { Button button = (Button)cellContent; button.HorizontalAlignment = base.HorizontalAlignment; button.VerticalAlignment = base.VerticalAlignment; button.Margin = new Thickness(4, 4, 4, 4); if (FlowDirection != null) { button.FlowDirection = (FlowDirection)FlowDirection; } if (!string.IsNullOrEmpty(Text)) { button.DataContext = new { Text = this.Text } } ; Binding bindCommand = new Binding("Command") { Source = this }; Binding bindCommandParameter = new Binding("DataItem") { Source = row }; button.SetBinding(Button.CommandProperty, bindCommand); button.SetBinding(Button.CommandParameterProperty, bindCommandParameter); button.Template = buttonTemplate; }
public override object GetCellContentRecyclingKey(C1.WPF.DataGrid.DataGridRow row) { return(typeof(Button)); }
public override System.Windows.FrameworkElement CreateCellContent(C1.WPF.DataGrid.DataGridRow row) { return(new Button()); }
public override void BindCellContent(System.Windows.FrameworkElement cellContent, C1.WPF.DataGrid.DataGridRow row) { Button button = (Button)cellContent; button.HorizontalAlignment = HorizontalAlignment.Center; button.VerticalAlignment = VerticalAlignment.Center; button.Margin = new Thickness(0, 0, 0, 0); button.DataContext = ViewModel; if (ToolTip != null) { Binding bindToolTip = new Binding("ToolTip") { Source = this }; button.SetBinding(Button.ToolTipProperty, bindToolTip); } else { Binding bindToolTip = new Binding("Header") { Source = this }; button.SetBinding(Button.ToolTipProperty, bindToolTip); } Binding bindCommand = new Binding("Command") { Source = this }; Binding bindCommandParameter = new Binding("DataItem") { Source = row }; button.SetBinding(Button.CommandProperty, bindCommand); button.SetBinding(Button.CommandParameterProperty, bindCommandParameter); button.Template = buttonTemplate; }