Exemple #1
0
        protected override Widget GetMainControl()
        {
            var icon = new DataField <Image> ();
            var name = new DataField <string> ();

            var listStore = new ListStore(icon, name);

            var scaffolders = GetScaffolders().Value;

            foreach (var scaffolder in scaffolders)
            {
                var row = listStore.AddRow();
                var png = ImageService.GetIcon("md-html-file-icon", Gtk.IconSize.Dnd);

                listStore.SetValue(row, icon, png);
                listStore.SetValue(row, name, scaffolder.Name);
            }

            listBox = new ListBox();
            listBox.Views.Add(new ImageCellView(icon));
            listBox.Views.Add(new TextCellView(name));

            listBox.DataSource        = listStore;
            listBox.HeightRequest     = 300;
            listBox.WidthRequest      = 300;
            listBox.SelectionChanged += (sender, e) => Args.Scaffolder = scaffolders [listBox.SelectedRow];
            listBox.RowActivated     += (sender, e) => ScaffolderSelected?.Invoke(sender, e);
            listBox.SelectRow(0);
            listBox.FocusedRow = 0;
            listBox.SetFocus();
            return(listBox);
        }
Exemple #2
0
 void RowActivated(object sender, EventArgs e)
 {
     ScaffolderSelected?.Invoke(sender, e);
 }