From f85e1c85eac4ea3271e53b6fea6c5bda94e6a8d6 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Mon, 13 Sep 2021 05:27:50 +0000 Subject: wip, save commit before trying to allow 'ItemTemplate' in style --- Samples/common/src/SampleBase.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Samples/common/src/SampleBase.cs') diff --git a/Samples/common/src/SampleBase.cs b/Samples/common/src/SampleBase.cs index 5b33444a..fa6d1cde 100644 --- a/Samples/common/src/SampleBase.cs +++ b/Samples/common/src/SampleBase.cs @@ -49,7 +49,7 @@ namespace Samples static void showMsgBox (object sender) { Widget w = sender as Widget; Command cmd = w.DataSource as Command; - MessageBox.ShowModal(w.IFace, MessageBox.Type.Information, $"{cmd.Caption} CLICKED"); + MessageBox.ShowModal(w.IFace, MessageBox.Type.Information, $"{cmd?.Caption} CLICKED"); } #region Test values for Binding @@ -62,13 +62,14 @@ namespace Samples new Command("Subedit command 1", (sender) => showMsgBox (sender)), new Command("Subedit command 2 a bit longer", (sender) => showMsgBox (sender), null, false), new Command("Subedit command three", (sender) => showMsgBox (sender)) - ) + ) ); public CommandGroup FileCommands = new CommandGroup("File Commands", - new Command("File command 1", (sender) => showMsgBox (sender)), + new Command("File command 1", (sender) => showMsgBox (sender), "#Icons.gavel.svg"), new Command("File command 2 a bit longer", (sender) => showMsgBox (sender)), new Command("File command three", (sender) => showMsgBox (sender)) ); + public Command SingleCommand => new Command("Single command 1", (sender) => showMsgBox (sender), "#Icons.gavel.svg"); void initCommands() { -- cgit v1.3.1-4-g156e