diff --git a/SecondaryToolbarDemo/iOS/ToolbarRenderer.cs b/SecondaryToolbarDemo/iOS/ToolbarRenderer.cs index daffca0..2661196 100644 --- a/SecondaryToolbarDemo/iOS/ToolbarRenderer.cs +++ b/SecondaryToolbarDemo/iOS/ToolbarRenderer.cs @@ -15,7 +15,7 @@ public class ToolbarRenderer : PageRenderer { UIToolbar _toolbar; List _secondaryItems; - readonly Dictionary _buttonCommands = new Dictionary (); + readonly Dictionary _buttonCommands = new Dictionary (); protected override void OnElementChanged (VisualElementChangedEventArgs e) { @@ -41,7 +41,7 @@ public override void ViewWillAppear (bool animated) button = Enum.TryParse (systemItemName, out systemItem) ? new UIBarButtonItem (systemItem, ToolClicked) : new UIBarButtonItem (tool.Text, UIBarButtonItemStyle.Plain, ToolClicked); - _buttonCommands.Add (button, tool.Command); + _buttonCommands.Add (button, tool); tools.Add (button); } @@ -56,8 +56,8 @@ public override void ViewWillAppear (bool animated) void ToolClicked(object sender, EventArgs args) { var tool = sender as UIBarButtonItem; - var command = _buttonCommands [tool]; - command.Execute (null); + var command = _buttonCommands[tool].Command; + command.Execute(_buttonCommands[tool].CommandParameter); } public override void ViewWillDisappear (bool animated)