<DataGridTemplateColumn Header="{x:Static Resources:AppStrings.Tree}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Controls:MBFontAwsome MBForeground="{DynamicResource SideBar.Icon.Normal}" MBFontsType="lockIcon" Visibility="{Binding RevLock, Converter={StaticResource BoolToVisibilityConverter}}" MBFontSize="12" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
I have written the above code to bind a font awesome to a DataGrid Template Column using XAML.
This works fine and now um in the verge of doing the same thing using Code behind file . So far I have tried up to this level
var projectDocumentColumnHeaderWidth = new DataGridLength(1.0, DataGridLengthUnitType.SizeToHeader);
var collectionToBoolConverter = new CollectionToBooleanConverter();
/**************************************************************************************/
var faw = new MBFontAwsome();
faw.MBFontsType = MBFonts.documents;
faw.MBFontSize = 12;
faw.Visibility = Visibility.Visible;
var widh = new DataGridLength(1.0, DataGridLengthUnitType.SizeToHeader);
/***************************************************************************************/
var templateColumn = new DataGridTemplateColumn()
{
Header = "AttachedProjectDocumentList",
SortMemberPath = "AttachedProjectDocumentList",
IsReadOnly = true,
CellTemplate = new DataTemplate
{
}
};
templateColumn.Width = widh;
DoorsGrid.Columns.Add(templateColumn);
How may I bind a font awesome to a cell ?