当前位置: 首页>>代码示例>>C#>>正文


C# RadioButton类代码示例

本文整理汇总了C#中RadioButton的典型用法代码示例。如果您正苦于以下问题:C# RadioButton类的具体用法?C# RadioButton怎么用?C# RadioButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RadioButton类属于命名空间,在下文中一共展示了RadioButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnButtonClicked

    protected void OnButtonClicked(object sender, EventArgs e)
    {
        if (sender == button1)
        {

            Gtk.FileChooserDialog dialog = new Gtk.FileChooserDialog ("Choose item...", this, FileChooserAction.Open, "Cancel",  ResponseType.Cancel, "Insert Spacer",  ResponseType.None, "Add", ResponseType.Accept);

            Gtk.Alignment align = new Alignment (1, 0, 0, 1);
            Gtk.Frame frame = new Frame ("Position");
            Gtk.HBox hbox = new HBox (false, 4);

            RadioButton rbRight;
            rbRight = new RadioButton ("Right");
            hbox.PackEnd(rbRight, false, false, 1);
            hbox.PackEnd(new RadioButton (rbRight, "Left"), false, false, 1);

            frame.Add (hbox);
            align.Add (frame);
            align.ShowAll ();
            dialog.ExtraWidget = align;

            ResponseType response = (ResponseType)dialog.Run ();
            if (response == ResponseType.Accept) {
                RunCommand ("defaults write com.apple.dock " + GetAlign(dialog.ExtraWidget) + " -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>" + dialog.Filename + "</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>' && /bin/sleep 1 &&/usr/bin/killall Dock");
            } else if (response == ResponseType.None) {
                RunCommand ("defaults write com.apple.dock " + GetAlign(dialog.ExtraWidget) + " -array-add '{tile-data={}; tile-type=\"spacer-tile\";}' && /bin/sleep 1 &&/usr/bin/killall Dock");
            }
            dialog.Destroy ();

        }
    }
开发者ID:Eun,项目名称:AddAnyDock,代码行数:31,代码来源:MainWindow.cs

示例2: OnBindDialogView

        protected override void OnBindDialogView(View view)
        {
            base.OnBindDialogView(view);

            var currentValue = GetPersistedInt(SettingsScreen.DefaultRadiusValue);

            if (BuildVersionCodes.Honeycomb > Build.VERSION.SdkInt)
            {
                _radioGroup = (RadioGroup)view;
                foreach (var distance in Constants.AlarmRadiusValues)
                {
                    var radioButton = new RadioButton(Context);
                    radioButton.SetText(string.Format(Context.GetString(Resource.String.settings_default_radius_sum), distance), TextView.BufferType.Normal);
                    radioButton.Checked = distance == currentValue;
                    radioButton.Id = distance;
                    _radioGroup.AddView(radioButton);
                }
            }
            else
            {
                _numberPicker = (NumberPicker)view;
                SetNumberPickerTextColor(_numberPicker, Context.Resources.GetColor(Resource.Color.dark));
                _numberPicker.DescendantFocusability = DescendantFocusability.BlockDescendants;
                _numberPicker.SetDisplayedValues(Constants.AlarmRadiusValues.Select(v => v.ToString()).ToArray());
                _numberPicker.MinValue = 0;
                _numberPicker.MaxValue = Constants.AlarmRadiusValues.Count() - 1;
                _numberPicker.WrapSelectorWheel = false;
                _numberPicker.Value = Constants.AlarmRadiusValues.IndexOf(currentValue);
            }
        }
开发者ID:foxanna,项目名称:SimpleLocationAlarm,代码行数:30,代码来源:NumberPickerPreference.cs

示例3: can_format_a_radio_button

 public void can_format_a_radio_button()
 {
     var html = new RadioButton("foo.Bar").Value(10).Format("{0}<br/>").ToString();
     var doc = html.ShouldRenderHtmlDocument();
     var br = doc.ShouldHaveChildNodesCount(2)[1];
     br.ShouldBeNamed("br");
 }
开发者ID:atomicobject,项目名称:mvccontrib,代码行数:7,代码来源:RadioButtonTests.cs

示例4: btnReport_Click

    protected void btnReport_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow gvr in gdvStud.Rows)
        {
            Label lblStudId = new Label();
            RadioButton rdb = new RadioButton();
            rdb = (RadioButton)gvr.Cells[1].FindControl("rdbSelect");
            if (rdb.Checked)
            {
                lblStudId = (Label)gvr.Cells[0].FindControl("lblStudId");
                MyReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
                MyReportViewer.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportsURI"].ToString()); // Report Server URL
                MyReportViewer.ServerReport.ReportPath = ConfigurationManager.AppSettings["ReportsFolder"].ToString() + "StudentIDReport"; // Report Name
                MyReportViewer.ShowParameterPrompts = false;
                MyReportViewer.ShowPrintButton = true;
                MyReportViewer.ShowToolBar = true;

                // Below code demonstrate the Parameter passing method. User only if you have parameters into the reports.

                Microsoft.Reporting.WebForms.ReportParameter[] reportParameterCollection = new Microsoft.Reporting.WebForms.ReportParameter[1];
                reportParameterCollection[0] = new Microsoft.Reporting.WebForms.ReportParameter("StudId", lblStudId.Text);

                MyReportViewer.ServerReport.SetParameters(reportParameterCollection);

                MyReportViewer.ServerReport.Refresh();
                break;
            }
        }
    }
开发者ID:ganreddy,项目名称:college,代码行数:29,代码来源:StdDetailByName.aspx.cs

示例5: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            Dialog.SetTitle("Select marker template");
            _view = inflater.Inflate(Resource.Layout.AddMarker, container, false);

            _btnCancel = _view.FindViewById<Button>(Resource.Id.addMarker_btnCancel);
            _btnCreate = _view.FindViewById<Button>(Resource.Id.addMarker_btnCreate);
            _radioVerse = _view.FindViewById<RadioButton>(Resource.Id.addMarker_radioVerse);
            _radioChorus = _view.FindViewById<RadioButton>(Resource.Id.addMarker_radioChorus);
            _radioBridge = _view.FindViewById<RadioButton>(Resource.Id.addMarker_radioBridge);
            _radioSolo = _view.FindViewById<RadioButton>(Resource.Id.addMarker_radioSolo);
            _btnCancel.Click += (sender, args) => Dismiss();
            _btnCreate.Click += (sender, args) =>
            {
                MarkerTemplateNameType template = MarkerTemplateNameType.None;
                if(_radioVerse.Checked)
                    template = MarkerTemplateNameType.Verse;
                else if (_radioChorus.Checked)
                    template = MarkerTemplateNameType.Chorus;
                else if (_radioBridge.Checked)
                    template = MarkerTemplateNameType.Bridge;
                else if (_radioSolo.Checked)
                    template = MarkerTemplateNameType.Solo;

                OnAddMarker(template);
                Dismiss();
            };
            _radioVerse.Checked = true;

            return _view;
        }
开发者ID:pascalfr,项目名称:MPfm,代码行数:31,代码来源:AddMarkerFragment.cs

示例6: OnCreateDialog

        public override Dialog OnCreateDialog (Bundle savedInstanceState)
        {
            var view = LayoutInflater.From (Activity)
                       .Inflate (Resource.Layout.ChangeTimeEntryStartTimeDialogFragment, null);
            tabsRadioButton = view.FindViewById<RadioGroup> (Resource.Id.TabsRadioGroup);
            timeTabRadioButton = view.FindViewById<RadioButton> (Resource.Id.TimeTabRadioButton).SetFont (Font.Roboto);
            dateTabRadioButton = view.FindViewById<RadioButton> (Resource.Id.DateTabRadioButton).SetFont (Font.Roboto);
            timePicker = view.FindViewById<TimePicker> (Resource.Id.TimePicker);
            datePicker = view.FindViewById<DatePicker> (Resource.Id.DatePicker);

            // WORKAROUND: Without these two lines the app will crash on rotation. See #258.
            timePicker.SaveFromParentEnabled = false;
            timePicker.SaveEnabled = true;

            tabsRadioButton.CheckedChange += OnTabsRadioGroupCheckedChange;

            SetupViews ();
            Rebind ();

            var dia = new AlertDialog.Builder (Activity)
            .SetTitle (DialogTitle)
            .SetView (view)
            .SetPositiveButton (Resource.String.ChangeTimeEntryStartTimeDialogOk, OnOkButtonClicked)
            .Create ();

            return dia;
        }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:27,代码来源:ChangeDateTimeDialogFragment.cs

示例7: addRowToSubsDetailsSection

    public void addRowToSubsDetailsSection(string subscription, string merchantsubscription)
    {
        TableRow rowOne = new TableRow();
        TableCell cellOne = new TableCell();
        cellOne.HorizontalAlign = HorizontalAlign.Right;
        cellOne.CssClass = "cell";
        cellOne.Width = Unit.Pixel(150);
        //cellOne.Text = transaction.ToString();
        RadioButton rbutton = new RadioButton();
        rbutton.Text = subscription.ToString();
        rbutton.GroupName = "SubsDetailsSection";
        rbutton.ID = subscription.ToString();
        cellOne.Controls.Add(rbutton);
        rowOne.Controls.Add(cellOne);
        TableCell CellTwo = new TableCell();
        CellTwo.CssClass = "cell";
        CellTwo.Width = Unit.Pixel(100);
        rowOne.Controls.Add(CellTwo);

        TableCell CellThree = new TableCell();
        CellThree.CssClass = "cell";
        CellThree.HorizontalAlign = HorizontalAlign.Left;
        CellThree.Width = Unit.Pixel(240);
        CellThree.Text = merchantsubscription.ToString();
        rowOne.Controls.Add(CellThree);

        TableCell CellFour = new TableCell();
        CellFour.CssClass = "cell";
        rowOne.Controls.Add(CellFour);

        subsDetailsTable.Controls.Add(rowOne);
    }
开发者ID:patmt,项目名称:API-Platform,代码行数:32,代码来源:Default.aspx.cs

示例8: RadioButtonSample

        public RadioButtonSample()
        {
            var b1 = new RadioButton ("Item 1");
            var b2 = new RadioButton ("Item 2 (red background)");
            b2.BackgroundColor = Xwt.Drawing.Colors.Red;
            var b3 = new RadioButton ("Item 3");
            b2.Group = b3.Group = b1.Group;
            PackStart (b1);
            PackStart (b2);
            PackStart (b3);

            var la = new Label ();
            la.Hide ();
            b1.Group.ActiveRadioButtonChanged += delegate {
                la.Show ();
                la.Text = "Active: " + b1.Group.ActiveRadioButton.Label;
            };
            PackStart (la);

            PackStart (new HSeparator ());

            var box = new VBox ();
            box.PackStart (new Label ("First Option"));
            box.PackStart (new Label ("Second line"));

            var b4 = new RadioButton (box);
            var b5 = new RadioButton ("Second Option");
            var b6 = new RadioButton ("Disabled Option") { Sensitive = false };
            PackStart (b4);
            PackStart (b5);
            PackStart (b6);
            b4.Group = b5.Group = b6.Group;
        }
开发者ID:sergueik,项目名称:xwt_swd,代码行数:33,代码来源:RadoButton.cs

示例9: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            if (IsDarkTheme)
            {
                SetTheme(Resource.Style.Theme_Dark);
            }
            else
            {
                SetTheme(Resource.Style.Theme_Light);
            }

            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            Button button = FindViewById<Button>(Resource.Id.MyButton);
            LightButton = FindViewById<RadioButton>(Resource.Id.radio_light);
            DarkButton = FindViewById<RadioButton>(Resource.Id.radio_dark);

            LightButton.Click += radioButton_Click;
            DarkButton.Click += radioButton_Click;

            button.Click += delegate
            {
                Intent intent = new Intent(this, this.GetType());

                StartActivity(intent);
            };
        }
开发者ID:adbk,项目名称:spikes,代码行数:29,代码来源:MainActivity.cs

示例10: OnActivityCreated

		public override void OnActivityCreated (Bundle savedInstanceState)
		{
			base.OnActivityCreated (savedInstanceState);

			//radiogroup
			radio_advice_Group = View.FindViewById<RadioGroup> (Resource.Id.radio_advice_Group);
			radio_advice_Group.SetOnCheckedChangeListener (this);
			//radiobutton
			rbtn_zixun = View.FindViewById<RadioButton> (Resource.Id.rbtn_zixun);
			rbtn_zixun.Tag = ((int)AdviceType.Consult).ToString();
			//默认咨询选中
			rbtn_zixun.Checked = true;
			rbtn_jianyi = View.FindViewById<RadioButton> (Resource.Id.rbtn_jianyi);
			rbtn_jianyi.Tag =((int)AdviceType.Suggest).ToString ();
			rbtn_tousu = View.FindViewById<RadioButton> (Resource.Id.rbtn_tousu);
			rbtn_tousu.Tag = ((int)AdviceType.Complain).ToString ();
			rbtn_other = View.FindViewById<RadioButton> (Resource.Id.rbtn_other);
			rbtn_other.Tag = ((int)AdviceType.Other).ToString();

			edit_advice_title = View.FindViewById<EditText> (Resource.Id.edit_advice_title);
			edit_advice_content = View.FindViewById<EditText> (Resource.Id.edit_advice_content);
			//发表按钮
			btn_Publish = View.FindViewById<Button> (Resource.Id.btn_Publish);
			btn_Publish.Click += (sender, e) => 
			{
				PublishAdvice();
			};

			//初始化view完成
			IsPrepared = true;
			LasyloadData ();
		}
开发者ID:lq-ever,项目名称:EldYoungAndroidApp,代码行数:32,代码来源:WriteAdviceFragment.cs

示例11: KeepMe

        void KeepMe()
        {
            var txt = new TextView(null);
            txt.Text = txt.Text;

            var iv = new ImageView(null);
            var obj = iv.Drawable;

            var prog = new ProgressBar(null);
            prog.Progress = prog.Progress;

            var cb = new RadioButton(null);
            cb.Checked = cb.Checked;

            var np = new NumberPicker(null);
            np.Value = np.Value;

            var rb = new RatingBar(null);
            rb.Rating = rb.Rating;

            var cv = new CalendarView(null);
            cv.Date = cv.Date;

            var th = new TabHost(null);
            th.CurrentTab = th.CurrentTab;

            var tp = new TimePicker(null);
            tp.CurrentHour = tp.CurrentHour;
            tp.CurrentMinute = tp.CurrentMinute;

            
        }
开发者ID:KimCM,项目名称:ReactiveUI,代码行数:32,代码来源:LinkerOverrides.cs

示例12: InitView

		private void InitView()
		{
			//设置标题栏
			var img_header_back = FindViewById<ImageView> (Resource.Id.img_header_back);
			img_header_back.Click += (sender, e) => 
			{
				this.Finish();
				OverridePendingTransition(Android.Resource.Animation.SlideInLeft,Android.Resource.Animation.SlideOutRight);
			};
		
			var tv_back = FindViewById<TextView> (Resource.Id.tv_back);
			tv_back.Text = "个人信息";
			var tv_desc = FindViewById<TextView> (Resource.Id.tv_desc);
			tv_desc.Text = "性别";
			rbtn_male = FindViewById<RadioButton>(Resource.Id.rbtn_male);
			rbtn_female = FindViewById<RadioButton> (Resource.Id.rbtn_female);
			//性别
			if (!string.IsNullOrEmpty (Global.MyInfo.Gender) && Global.MyInfo.Gender.Equals ("0"))
				rbtn_male.Checked = true;
			else
				rbtn_female.Checked = true;
			btn_Save = FindViewById<Button> (Resource.Id.btn_Save);
			btn_Save.Click += (sender, e) => 
			{
				Save();
			};
		}
开发者ID:lq-ever,项目名称:CommunityCenter,代码行数:27,代码来源:PersonInfoGenderActivity.cs

示例13: VerifyRadioButton

 private void VerifyRadioButton(RadioButton<FindingPage> radioButton)
 {
     VerifyValue(radioButton, "OptionC");
     radioButton.Should.BeUnchecked();
     radioButton.Check();
     radioButton.Should.BeChecked();
 }
开发者ID:atata-framework,项目名称:atata,代码行数:7,代码来源:FindingTest.cs

示例14: MainForm

	public MainForm ()
	{
		// 
		// _dataGridView
		// 
		_dataGridView = new DataGridView ();
		_dataGridView.Dock = DockStyle.Top;
		_dataGridView.Height = 100;
		Controls.Add (_dataGridView);
		// 
		// _nameTextBoxColumn
		// 
		_nameTextBoxColumn = new DataGridViewTextBoxColumn ();
		_nameTextBoxColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
		_nameTextBoxColumn.HeaderText = "Name";
		_dataGridView.Columns.Add (_nameTextBoxColumn);
		// 
		// _columnHeadersHeightSizeModeGroupBox
		// 
		_columnHeadersHeightSizeModeGroupBox = new GroupBox ();
		_columnHeadersHeightSizeModeGroupBox.Dock = DockStyle.Bottom;
		_columnHeadersHeightSizeModeGroupBox.Height = 85;
		_columnHeadersHeightSizeModeGroupBox.Text = "ColumnHeadersHeightSizeMode";
		Controls.Add (_columnHeadersHeightSizeModeGroupBox);
		// 
		// _autoSizeHeightSizeMode
		// 
		_autoSizeHeightSizeMode = new RadioButton ();
		_autoSizeHeightSizeMode.Location = new Point (8, 16);
		_autoSizeHeightSizeMode.Text = "AutoSize";
		_autoSizeHeightSizeMode.CheckedChanged += new EventHandler (AutoSizeHeightSizeMode_CheckedChanged);
		_columnHeadersHeightSizeModeGroupBox.Controls.Add (_autoSizeHeightSizeMode);
		// 
		// _disableResizingHeightSizeMode
		// 
		_disableResizingHeightSizeMode = new RadioButton ();
		_disableResizingHeightSizeMode.Location = new Point (8, 36);
		_disableResizingHeightSizeMode.Text = "DisableResizing";
		_disableResizingHeightSizeMode.CheckedChanged += new EventHandler (DisableResizingHeightSizeMode_CheckedChanged);
		_columnHeadersHeightSizeModeGroupBox.Controls.Add (_disableResizingHeightSizeMode);
		// 
		// _enableResizingHeightSizeMode
		// 
		_enableResizingHeightSizeMode = new RadioButton ();
		_enableResizingHeightSizeMode.Checked = true;
		_enableResizingHeightSizeMode.Location = new Point (8, 56);
		_enableResizingHeightSizeMode.Text = "EnableResizing";
		_enableResizingHeightSizeMode.CheckedChanged += new EventHandler (EnableResizingHeightSizeMode_CheckedChanged);
		_columnHeadersHeightSizeModeGroupBox.Controls.Add (_enableResizingHeightSizeMode);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 195);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #82221";
		Load += new EventHandler (MainForm_Load);
	}
开发者ID:mono,项目名称:gert,代码行数:58,代码来源:MainForm.cs

示例15: CollapseToMediumTest

 public void CollapseToMediumTest()
 {
     RadioButton target = new RadioButton(); // TODO: Initialize to an appropriate value
     ButtonSize expected = new ButtonSize(); // TODO: Initialize to an appropriate value
     ButtonSize actual;
     target.CollapseToMedium = expected;
     actual = target.CollapseToMedium;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:10,代码来源:RadioButtonTest.cs


注:本文中的RadioButton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。