Skip to content

NathanielACollier/dotnetLib_nac.Forms

Repository files navigation

nac.Forms

Description

Provides a quick way to create a GUI application for Linux, macOS, and Windows. Provides model binding with INotifyPropertyChange using both a dynamic bindable dictionary as the default and typed classes by setting DataContext.

Control Examples

  • Textbox
    • Code
     var f = nac.Forms.Form.NewForm();
     f.TextFor("txt2", "Type here")
      .TextBoxFor("txt2")
      .Display();
    • Result
  • Button with click count
    • Code
     var f = nac.Forms.Form.NewForm();
     f.TextFor("txt1", "When you click button I'll change to count!")
     .Button("Click Me!", arg =>
     {
     	var current = child.Model.GetOrDefault<int>("txt1", 0);
     	++current;
     	child.Model["txt1"] = current;
     })
     .Display();
    • Result
  • Horizontal Group
    • Code
     var f = nac.Forms.Form.NewForm();
     f.HorizontalGroup(hori =>
     {
     	hori.Text("Click Count: ")
     		.TextBoxFor("clickCount")
     		.Button("Click Me!", arg =>
     		{
     			var current = child.Model.GetOrDefault<int>("clickCount", 0);
     			++current;
     			hori.Model["clickCount"] = current;
     		});
     })
     .Display();
    • Result
  • Tabs
    • Code
     var f = nac.Forms.Form.NewForm();
     
     f.Tabs(t=> {
     	t.Header = "Tab 1";
     	t.Populate = f => {
     		f.Text("Hello from tab 1");
     	};
     }, t => {
     	t.Header = "Tab 2";
     	t.Populate = f => {
     		f.Text("Hello from tab 2");
     	};
     })
     .Display();
    • Result