private void InitializeColorComboBox(Gtk.ComboBox colorChooser, ObservableCollection <FileNodeColorViewModel> colors, MenuLayoutViewModel dataContext) { colorChooser.SetValue(IFakeDependencyObjectHelpers.DataContextPropertyName, dataContext); colorChooser.TooltipText = MenuLayoutViewModel.ColorTip; foreach (var color in colors) { var pixbufColor = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, 14, 14); var uintColor = (uint)((color.Fill.Red & 0xFF) << 24) | (uint)((color.Fill.Green & 0xFF) << 16) | (uint)((color.Fill.Blue & 0xFF) << 8) | 0xFF; pixbufColor.Fill(uintColor); var pixbuf = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, 16, 16); pixbuf.Fill(0xFF); // black background pixbufColor.CopyArea(0, 0, 14, 14, pixbuf, 1, 1); ColorPixbufs[color.IntvColor] = pixbuf; } Gtk.CellRenderer cellRenderer = new Gtk.CellRendererPixbuf() { Xalign = 0 }; colorChooser.PackStart(cellRenderer, false); colorChooser.SetCellDataFunc(cellRenderer, (l, e, m, i) => VisualHelpers.CellImageRenderer <FileNodeColorViewModel>(l, e, m, i, c => ColorPixbufs[c.IntvColor])); cellRenderer = new Gtk.CellRendererCombo() { Xalign = 0, Xpad = 4 }; colorChooser.PackEnd(cellRenderer, true); colorChooser.SetCellDataFunc(cellRenderer, (l, e, m, i) => VisualHelpers.CellTextRenderer <FileNodeColorViewModel>(l, e, m, i, c => c.Name)); var colorListStore = new Gtk.ListStore(typeof(FileNodeColorViewModel)); colorListStore.SynchronizeCollection(colors); colorChooser.Model = colorListStore; MenuLayoutCommandGroup.SetColorCommand.CanExecuteChanged += HandleCanExecuteSetColorChanged; }