public override void Run(Window window) { Background bg = new Background(window); bg.Color = Color.White; bg.Move(0, 0); bg.Resize(window.ScreenSize.Width, window.ScreenSize.Height); bg.Show(); MultiButtonEntry mbe = new MultiButtonEntry(window) { IsEditable = true, IsExpanded = true, Text = "To: " }; mbe.Append("Append1"); mbe.Append("Append2"); mbe.Append("Append3"); mbe.Append("Append4"); mbe.Append("Append5"); mbe.Append("Append6"); mbe.Append("Append7"); mbe.Append("Append8"); mbe.Append("Append9"); mbe.Append("Append10"); mbe.Append("Append11"); mbe.Append("Append12"); Label label1 = new Label(window) { Text = "MultiButtonEntry Test", Color = Color.Blue }; var createButton = new Button(window) { Text = "Change the status of IsExpanded", AlignmentX = -1, WeightX = 1, }; var deleteButton = new Button(window) { Text = "Delete", AlignmentX = -1, WeightX = 1, }; createButton.Clicked += (sender, e) => { mbe.IsExpanded = !mbe.IsExpanded; }; deleteButton.Clicked += (sender, e) => { mbe.Unrealize(); }; label1.Resize(600, 100); label1.Move(50, 50); label1.Show(); mbe.Resize(600, 600); mbe.Move(0, 100); mbe.Show(); createButton.Resize(200, 100); createButton.Move(50, 700); createButton.Show(); deleteButton.Resize(200, 100); deleteButton.Move(300, 700); deleteButton.Show(); }
public override void Run(Window window) { Background bg = new Background(window); bg.Color = Color.White; bg.Move(0, 0); bg.Resize(window.ScreenSize.Width, window.ScreenSize.Height); bg.Show(); MultiButtonEntry mbe = new MultiButtonEntry(window) { IsEditable = true, IsExpanded = true, Text = "To: " }; mbe.Append("Append1"); mbe.Append("Append2"); mbe.Append("Append3"); mbe.Append("Append4"); mbe.Append("Append5"); mbe.Append("Append6"); mbe.Append("Append7"); mbe.Append("Append8"); mbe.Append("Append9"); mbe.Append("Append10"); mbe.Append("Append11"); mbe.Append("Append12"); Label label1 = new Label(window) { Text = "MultiButtonEntry Test", Color = Color.Blue }; var expandButton = new Button(window) { Text = "IsExpanded", AlignmentX = -1, WeightX = 1, }; var formatButton = new Button(window) { Text = "format", AlignmentX = -1, WeightX = 1, }; expandButton.Clicked += (sender, e) => { mbe.IsExpanded = !mbe.IsExpanded; }; formatButton.Clicked += (sender, e) => { if (_setCallback) { mbe.SetFormatCallback(null); _setCallback = false; } else { mbe.SetFormatCallback((count) => { return("(" + count + ")"); }); _setCallback = true; } }; label1.Resize(600, 100); label1.Move(50, 50); label1.Show(); mbe.Resize(600, 600); mbe.Move(0, 100); mbe.Show(); expandButton.Resize(200, 100); expandButton.Move(50, 700); expandButton.Show(); formatButton.Resize(200, 100); formatButton.Move(300, 700); formatButton.Show(); }
public override void Run(Window window) { Background bg = new Background(window); bg.Color = Color.White; bg.Move(0, 0); bg.Resize(window.ScreenSize.Width, window.ScreenSize.Height); bg.Show(); MultiButtonEntry mbe = new MultiButtonEntry(window) { IsEditable = true, IsExpanded = true, Text = "To: " }; var test = mbe.Append("test"); mbe.Prepend("prepend"); mbe.Append("append"); mbe.InsertBefore(test, "insertBefore"); mbe.InsertAfter(test, "insertAfter"); mbe.ItemSelected += (s, e) => { Console.WriteLine("item selected: " + e.Item.Label); if (e.Item.Next != null) { Console.WriteLine("next item: " + e.Item.Next); } if (e.Item.Prev != null) { Console.WriteLine("previous item: " + e.Item.Prev); } }; mbe.ItemClicked += (s, e) => { Console.WriteLine("item clicked: " + e.Item.Label); }; mbe.ItemLongPressed += (s, e) => { Console.WriteLine("item longpressed: " + e.Item.Label); }; mbe.ItemAdded += (s, e) => { Console.WriteLine("item added: " + e.Item.Label); }; mbe.ItemDeleted += (s, e) => { Console.WriteLine("item deleted: " + e.Item.Label); }; mbe.AppendFilter((label) => { if (label.Contains("a")) { Console.WriteLine("appended filter : Item has 'a', It won't be added until 'a' is removed."); return(false); } else { return(true); } }); mbe.PrependFilter((label) => { if (label.Contains("p")) { Console.WriteLine("prepended filter : Item has 'p', It won't be added until 'p' is removed."); return(false); } else { return(true); } }); Label label1 = new Label(window) { Text = "MultiButtonEntry Test", Color = Color.Blue }; label1.Resize(600, 100); label1.Move(50, 50); label1.Show(); mbe.Resize(600, 600); mbe.Move(0, 100); mbe.Show(); }