コード例 #1
0
            protected View CreateRow(ActionSheetItem item, bool isDestructive)
            {
                var row = new LinearLayout(this.Activity)
                {
                    Clickable        = true,
                    Orientation      = Orientation.Horizontal,
                    LayoutParameters = new LinearLayout.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, this.DpToPixels(48))
                };

                Color?textColor = null;

                if (item.TextColor != null)
                {
                    textColor = item.TextColor.Value.ToNativeColor();
                }

                row.AddView(this.GetText(item.Text, item.ItemIcon, isDestructive, textColor));

                // row.SetGravity(GravityFlags.CenterHorizontal | GravityFlags.CenterVertical);

                row.Click += (sender, args) =>
                {
                    item.Action?.Invoke();

                    Clicked?.Invoke();
                };

                return(row);
            }
コード例 #2
0
ファイル: ActionSheet.xaml.cs プロジェクト: rahulyhg/cms-cli
        private void Action_Tap(object sender, GestureEventArgs e)
        {
            if (resultCallback != null)
            {
                // launch the action
                ActionSheetItem selection = MainListBox.SelectedItem as ActionSheetItem;

                if (selection != null)
                {
                    resultCallback(selection.Index);
                }

                // hide the pop-up
                Core.UI.HideOverlay();
            }
        }
コード例 #3
0
        protected View CreateRow(ActionSheetItem option, bool isDestructive, ActionSheetItemTextAlgin textAlgin)
        {
            var row = new LinearLayout(this.Activity)
            {
                Clickable        = true,
                Orientation      = Orientation.Horizontal,
                LayoutParameters = new LinearLayout.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, this.DpToPixels(48))
            };

            row.AddView(this.GetText(option.Text, option.ItemIcon, isDestructive, textAlgin));

            row.Click += (sender, args) =>
            {
                option.Action?.Invoke();

                Clicked?.Invoke();
            };

            return(row);
        }