Skip to content

Commit

Permalink
Merge pull request #12 from limefrogyank/patch-1
Browse files Browse the repository at this point in the history
Update ToolbarRenderer.cs for CommandParameter
  • Loading branch information
KeithJRome authored Oct 24, 2016
2 parents 8374224 + fa5702c commit d48ee19
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions SecondaryToolbarDemo/iOS/ToolbarRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ToolbarRenderer : PageRenderer
{
UIToolbar _toolbar;
List<ToolbarItem> _secondaryItems;
readonly Dictionary<UIBarButtonItem, ICommand> _buttonCommands = new Dictionary<UIBarButtonItem, ICommand> ();
readonly Dictionary<UIBarButtonItem, ToolbarItem> _buttonCommands = new Dictionary<UIBarButtonItem, ToolbarItem> ();

protected override void OnElementChanged (VisualElementChangedEventArgs e)
{
Expand All @@ -41,7 +41,7 @@ public override void ViewWillAppear (bool animated)
button = Enum.TryParse<UIBarButtonSystemItem> (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);
}

Expand All @@ -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)
Expand Down

0 comments on commit d48ee19

Please sign in to comment.