private ListagemRegistros InicializarListagem() { var bounds = this.Bounds; var frame = new Rect(1, 2, bounds.Width - 4, (bounds.Height - this._menuBar.Bounds.Height) - 4); var lv = new ListagemRegistros(frame, " Registros disponíveis") { AllowsMarking = true, SourceList = ListarRegistrados, ConfigExibicao = new ListagemRegistros.ConfigExibicaoLista() { Cabecalhos = new[] { new { Nome = "ID", Tamanho = 04, Alinhamento = TextAlignment.Left }, new { Nome = "NOME", Tamanho = 30, Alinhamento = TextAlignment.Left }, new { Nome = "TELEFONE", Tamanho = 20, Alinhamento = TextAlignment.Left }, new { Nome = "E-MAIL", Tamanho = 40, Alinhamento = TextAlignment.Left } }, UsarElipsesTextosLongos = true, Separador = "||", RenderizacaoItem = (registro) => { return(new string[] { registro.Id.ToString("D3"), registro.Nome, registro.Telefone, registro.Email.Address }); } }, CanFocus = true, }; lv.SelectedChanged += SelectedChanged; return(lv); }
private void InicializarControles(Toplevel top) { _menuBar = new MenuBar(new MenuBarItem[] { new MenuBarItem("_Registros", new MenuItem[] { new MenuItem("_Novo", "Novo registro", () => ExceptionSafeAction(CriarNovoRegistro)), new MenuItem("_Detalhar", "Exibir campos ", () => ExceptionSafeAction(ExibirDetalhado)), new MenuItem("_Atualizar", "Atualizar", () => ExceptionSafeAction(Atualizar)), new MenuItem("_Remover", "Remover selecionado", () => ExceptionSafeAction(RemoverSelecionado)), }), new MenuBarItem("_Sair", new MenuItem[] { new MenuItem("_Sair", "", () => { if (ConfirmarSaida()) { Application.RequestStop(); } }), }) }); this.Add(_menuBar); _listagem = InicializarListagem(); this.Add(_listagem); Atualizar(); Application.Refresh(); }