public Page createDiscoverPage() { //create main page //onvifs Page page = new Page() { Uri = "main", Name = "main", Title = "Main page", Controls = new ListTS <Control>() { new UI.Forms.Controls.StackPanel() { Items = new ListTS <Control>() { new UI.Forms.Controls.Button() { Name = "add", Text = "Add new Flic(s)", Clicked = btnAdd_Clicked, }, new UI.Forms.Controls.Button() { Name = "remove", Text = "Remove All Flic(s)", Clicked = btnRemoveAll_Clicked, }, } } }, }; if (flicThings.Any()) { var stack = page.Controls[0] as StackPanel; stack?.Items.Add( new UI.Forms.Controls.Label() { Text = "Existing Flic Button(s)", }); foreach (var flic in flicThings) { //var uri = new Uri("BdAsrress" + flic.Key.ToString().Replace(":", "")); stack?.Items.Add( new UI.Forms.Controls.Button() { Tag = flic.Key.ToString(), Name = "config-" + flic.Key, Text = flic.Key.ToString(), Clicked = btn_Clicked }); } } return(page); }