本文整理汇总了C#中Android.Widget.TextView.SetCommand方法的典型用法代码示例。如果您正苦于以下问题:C# TextView.SetCommand方法的具体用法?C# TextView.SetCommand怎么用?C# TextView.SetCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Widget.TextView
的用法示例。
在下文中一共展示了TextView.SetCommand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
_viewModel = _navigationService.GetAndRemoveParameter(Intent) as CommentViewModel;
SetContentView(Resource.Layout.Comments);
SetSupportActionBar(FindViewById<Toolbar>(Resource.Id.CommentsToolbar));
SupportActionBar.SetDisplayHomeAsUpEnabled(true);
Title = _viewModel.Title;
_commentsList = FindViewById<ListView>(Resource.Id.CommentsListView);
_replyButton = FindViewById<TextView>(Resource.Id.CommentReplyButton);
_replyButton.SetCommand("Click", _viewModel.ReplyCommand);
_replyButton.Enabled = false;
_comment = FindViewById<EditText>(Resource.Id.CommentReplyText);
_comment.Hint = _viewModel.CommentPlaceholder;
_commentsList.Adapter = new ObservableAdapter<IListItem>()
{
DataSource = _viewModel.CardViewModels,
GetTemplateDelegate = GetCell,
};
var footer = new View(this);
footer.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)Math.Ceiling(TypedValue.ApplyDimension(ComplexUnitType.Dip, 50f, Application.Context.Resources.DisplayMetrics)));
_commentsList.AddFooterView(footer);
_comment.TextChanged += (sender, e) => _viewModel.Comments = _comment.Text;
_viewModel.RequestDismissKeyboard = () =>
{
InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
imm.HideSoftInputFromWindow(_comment.WindowToken, 0);
};
_viewModel.RequestCanExecute = (enabled) => _replyButton.Enabled = enabled;
_viewModel.PropertyChanged += (sender, e) =>
{
switch(e.PropertyName)
{
case "Comments":
if(!_comment.Text.Equals(_viewModel.Comments))
_comment.Text = _viewModel.Comments;
break;
}
};
}