本文整理汇总了C#中UIBarButtonItem.SetCommand方法的典型用法代码示例。如果您正苦于以下问题:C# UIBarButtonItem.SetCommand方法的具体用法?C# UIBarButtonItem.SetCommand怎么用?C# UIBarButtonItem.SetCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIBarButtonItem
的用法示例。
在下文中一共展示了UIBarButtonItem.SetCommand方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
public override void ViewDidLoad()
{
View = new UniversalView();
base.ViewDidLoad();
InitializeComponent();
Title = "Details";
FlowerImage.SetImage(
new NSUrl(Vm.ImageUri.AbsoluteUri),
UIImage.FromBundle("flower_256_magenta.png"));
this.SetBinding(
() => Vm.Model.Name)
.WhenSourceChanges(
() =>
{
// iOS is quite primitive and requires layout recalculation when the content
// of UI elements changes. This is a good place to do that.
NameText.Text = Vm.Model.Name;
NameText.SizeToFit();
NameText.Frame = new CGRect(140, 75, 170, NameText.Bounds.Height);
});
this.SetBinding(
() => Vm.Model.Description)
.WhenSourceChanges(
() =>
{
DescriptionText.Text = Vm.Model.Description;
DescriptionText.SizeToFit();
DescriptionText.Frame = new CGRect(0, 0, 300, DescriptionText.Bounds.Height);
Scroll.ContentSize = new CGSize(300, DescriptionText.Bounds.Height);
Scroll.SetNeedsLayout();
});
SeeCommentButton.Clicked += (s, e) =>
{
// iOS is the only framework where we decided to split the comments
// on a different page. This is a good example that you can easily
// have different UI experience even though the ViewModel and Model are the same
var controller = Vm.Model.Comments.GetController(
CreateCommentCell,
BindCommentCell);
controller.Title = "Comments";
var addCommentButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, null);
addCommentButton.SetCommand("Clicked", Vm.AddCommentCommand);
controller.NavigationItem.SetRightBarButtonItem(addCommentButton, false);
AppDelegate.MainNavigationController.PushViewController(controller, true);
};
}
示例2: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Add the add button to the navigation abr
UIBarButtonItem btnAdd = new UIBarButtonItem();
btnAdd.Title = "Add";
btnAdd.SetCommand("Clicked", App.Bootstrapper.MainViewModel.NavigateToAddCommand);
NavigationItem.RightBarButtonItem = btnAdd;
}
示例3: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Set bindings
NameBinding = this.SetBinding (() => tfTitle.Text)
.UpdateSourceTrigger ("EditingDidEnd")
.WhenSourceChanges (() => MainViewModel.Draft.Title = tfTitle.Text);
ContentBinding = this.SetBinding (() => tfContent.Text)
.UpdateSourceTrigger ("EditingDidEnd")
.WhenSourceChanges (() => MainViewModel.Draft.Content = tfContent.Text);
// Add the add button to the navigation abr
UIBarButtonItem btnAdd = new UIBarButtonItem();
btnAdd.Title = "Add";
btnAdd.SetCommand("Clicked", MainViewModel.AddNoteCommand);
NavigationItem.RightBarButtonItem = btnAdd;
}
示例4: ViewDidLoad
public override void ViewDidLoad()
{
if (NavigationParameter == null)
{
throw new InvalidOperationException("No parameter found after navigation");
}
Vm = (FlowerViewModel)NavigationParameter;
_tableController = Vm.Model.Comments.GetController(
CreateCommentCell,
BindCommentCell);
_tableController.TableView = CommentsTableView;
AddCommentButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, null);
NavigationItem.SetRightBarButtonItem(AddCommentButton, false);
AddCommentButton.SetCommand("Clicked", Vm.AddCommentCommand);
base.ViewDidLoad();
}
示例5: ViewDidLoad
public override void ViewDidLoad()
{
if (NavigationParameter == null)
{
throw new InvalidOperationException("No parameter found after navigation");
}
Vm = (FlowerViewModel)NavigationParameter;
SaveCommentButton = new UIBarButtonItem(UIBarButtonSystemItem.Save, null);
NavigationItem.SetRightBarButtonItem(SaveCommentButton, false);
_commentBinding = this.SetBinding(
() => CommentText.Text)
.UpdateSourceTrigger("Changed");
SaveCommentButton.SetCommand(
"Clicked",
Vm.SaveCommentCommand,
_commentBinding);
base.ViewDidLoad();
}