C1.WPF.DataGrid Namespace > DataGridColumn Class : BindCellContent Method |
'Declaration
Public Overridable Sub BindCellContent( _ ByVal cellContent As System.Windows.FrameworkElement, _ ByVal row As DataGridRow _ )
public virtual void BindCellContent( System.Windows.FrameworkElement cellContent, DataGridRow row )
This method must include cellContent property settings, SetBinding of the corresponding dependency property being "row.DataItem" the source which can be set directly in the binding or as DataContext of the cellContent.
This method is called after a cell content is created or a recycled one is taken.
var txt = (TextBlock)cellContent;
txt.HorizontalAlignment = HorizontalAlignment;
txt.VerticalAlignment = VerticalAlignment;
Binding newBinding = CopyBinding(Binding);
newBinding.Source = row.DataItem;
txt.SetBinding(TextBlock.TextProperty, newBinding);
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2