Skip to content

Commit

Permalink
Merge pull request #55 from FrancescoBull/patch-1
Browse files Browse the repository at this point in the history
Fix Combobox
  • Loading branch information
leocb authored Feb 10, 2020
2 parents c29fd4e + 62eb10c commit bd69e96
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion MaterialSkin/Controls/MaterialComboBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,21 @@ private void CustomDrawItem(object sender, System.Windows.Forms.DrawItemEventArg
{
g.FillRectangle(SkinManager.BackgroundHoverBrush, e.Bounds);
}

string Text = "";
if (!string.IsNullOrWhiteSpace(DisplayMember))
{
Text = Items[e.Index].GetType().GetProperty(DisplayMember).GetValue(Items[e.Index], null).ToString();
}
else
{
Text = Items[e.Index].ToString();
}

using (NativeTextRenderer NativeText = new NativeTextRenderer(g))
{
NativeText.DrawTransparentText(
Items[e.Index].ToString(),
Text,
SkinManager.getFontByType(MaterialSkinManager.fontType.Subtitle1),
SkinManager.TextHighEmphasisColor,
new Point(e.Bounds.Location.X + SkinManager.FORM_PADDING, e.Bounds.Location.Y),
Expand Down

0 comments on commit bd69e96

Please sign in to comment.