|
this.sfDataGrid.DrawCell += SfDataGrid_DrawCell;
private void SfDataGrid_DrawCell(object sender, Syncfusion.WinForms.DataGrid.Events.DrawCellEventArgs e)
{
if(e.Column.MappingName == "ShipCountry" && string.IsNullOrEmpty(e.DisplayText))
{
e.Style.TextColor = Color.Gray;
e.DisplayText = "Select Item";
}
} |
|
<Page.Resources>
<local:ComboBoxValueConverter x:Key="comboBoxValueConverter"/>
</Page.Resources>
<syncfusion:GridComboBoxColumn MappingName="ReportsTo" ItemsSource="{Binding Reporters}" DisplayBinding="{Binding Path=ReportsTo, Converter={StaticResource comboBoxValueConverter}}"/>
public class ComboBoxValueConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (string.IsNullOrEmpty(value.ToString()))
value = "Select a Value";
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
} |