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


C# ToggleButton类代码示例

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


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

示例1: FromStockIcon

		/// <summary>Constructs a Button from a stock.</summary>
		/// <param name="Name">Name of the stock.</param>
		/// <param name="Label">Label to display.</param>
		/// <param name="Large"><b>true</b> if the image should be large, <b>false</b> otherwise.</param>
		public static ToggleButton FromStockIcon (string Name, string Label, bool Large)
		{
			Image img = new Image (Name, Large ? IconSize.LargeToolbar : IconSize.SmallToolbar);
			ToggleButton btn = new ToggleButton (img, Label);
			if(!Large) btn.ImagePosition = PositionType.Left;
			return btn;
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:11,代码来源:ToggleButton.cs

示例2: Initialise

        public void Initialise(string[] milestoneTexts, string[] milestoneNumbers)
        {
            //add milestone buttons
            milestoneButtons = new ToggleButton[milestoneTexts.Length];
            for (int iMilestone = 0; iMilestone < milestoneTexts.Length; iMilestone++)
            {
                ToggleButton milestoneButton = new ToggleButton();
                milestoneButton.Template = (ControlTemplate)FindResource("MilestoneControlTemplate");
                milestoneButton.Margin = new Thickness(0.0, 0.0, 0.0, 0.0);

                uniformGrid.Children.Add(milestoneButton);

                bool ok = milestoneButton.ApplyTemplate();
                Grid grid = (Grid)milestoneButton.Template.FindName("grid2", milestoneButton);

                //set milestone number
                TextBlock numberTextBlock = (TextBlock)grid.FindName("number");
                numberTextBlock.Text = milestoneNumbers[iMilestone];

                //set milestone description
                TextBlock descriptionTextBlock = (TextBlock)grid.FindName("description");
                descriptionTextBlock.Text = (string)milestoneTexts[iMilestone];

                milestoneButton.PreviewMouseDown += new MouseButtonEventHandler(milestoneButton_PreviewMouseDown);

                milestoneButtons[iMilestone] = milestoneButton;
            }
        }
开发者ID:vmendi,项目名称:AirbusMilitarySurface,代码行数:28,代码来源:MissionTimelineUserControl.xaml.cs

示例3: StockViewCell

        /// <summary>
        /// Initializes a new instance of the <see cref="SimplyMobile.Plugins.StockView.Android.StockView"/> class.
        /// </summary>
        /// <param name="context">Context.</param>
        public StockViewCell (Context context) : base(context)
        {
            this.Orientation = Orientation.Vertical;

            textName = new TextView (this.Context);
            this.AddView (textName);

            textLast = new TextView (this.Context);
            this.AddView (textLast);

            this.toggleUpdate = new ToggleButton (this.Context) 
            {
                Text = "Click to update",
                TextOff = "Click to update",
                TextOn = "Updating..."
            };

            this.AddView (this.toggleUpdate);

            this.toggleUpdate.Click += async (sender, e) => 
            {
                if (this.toggleUpdate.Checked)
                {
                    await StockViewModel.StockModel.RefreshOrAdd(this.stockQuote.Symbol);
                    this.toggleUpdate.Checked = false;
                }
            };
        }
开发者ID:Qwin,项目名称:SimplyMobile,代码行数:32,代码来源:StockViewCell.Android.cs

示例4: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Zone);

            id = Intent.GetIntExtra("Id", 0);
            uri = new Uri(Intent.GetStringExtra("Uri"));

            timer = new Timer();
            timer.Interval = 5000;
            timer.Elapsed += timer_Elapsed;

            powerButton = FindViewById<ToggleButton>(Resource.Id.powerButton);
            powerButton.Click += powerButton_Click;

            volumeSeekBar = FindViewById<SeekBar>(Resource.Id.volumeSeekBar);
            volumeSeekBar.ProgressChanged += volumeSeekBar_ProgressChanged;

            sourceSpinner = FindViewById<Spinner>(Resource.Id.sourceSpinner);
            sourceSpinner.Adapter = new ArrayAdapter<string>(this, global::Android.Resource.Layout.SimpleSpinnerDropDownItem, AUDIO_SOURCES);
            sourceSpinner.ItemSelected += sourceSpinner_ItemSelected;

            // schedule load
            Task.Run(async () => await Load());
        }
开发者ID:wasabii,项目名称:rnet,代码行数:25,代码来源:ZoneActivity.cs

示例5: GetView

        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            View toggleButtonView;
            View view = DroidResources.LoadBooleanElementLayout(context, convertView, parent, LayoutId, out _caption, out _subCaption, out toggleButtonView);

            if (view != null)
            {
                _caption.Text = Caption;
                _toggleButton = (ToggleButton)toggleButtonView;
                _toggleButton.SetOnCheckedChangeListener(null);
                _toggleButton.Checked = Value;
                _toggleButton.SetOnCheckedChangeListener(this);

                if (TextOff != null)
                {
                    _toggleButton.TextOff = TextOff;
                    if (!Value)
                        _toggleButton.Text = TextOff;
                }

                if (TextOn != null)
                {
                    _toggleButton.TextOn = TextOn;
                    if (Value)
                        _toggleButton.Text = TextOn;
                }
            }
            return view;
        }
开发者ID:sam-lippert,项目名称:Android.Dialog,代码行数:29,代码来源:BooleanElement.cs

示例6: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            Console.WriteLine("EqualizerPresetsActivity - OnCreate");
            base.OnCreate(bundle);

            _navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            SetContentView(Resource.Layout.EqualizerPresets);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            _seekBarVolume = FindViewById<SeekBar>(Resource.Id.equalizerPresets_seekBarVolume);
            _seekBarVolume.ProgressChanged += (sender, args) => OnSetVolume(1);

            _btnBypass = FindViewById<ToggleButton>(Resource.Id.equalizerPresets_btnBypass);
            _btnBypass.Click += (sender, args) => OnBypassEqualizer();

            _outputMeter = FindViewById<OutputMeterView>(Resource.Id.equalizerPresets_outputMeterView);

            _listView = FindViewById<ListView>(Resource.Id.equalizerPresets_listView);
            _listAdapter = new EqualizerPresetsListAdapter(this, _listView, new List<EQPreset>());
            _listView.SetAdapter(_listAdapter);
            _listView.ItemClick += ListViewOnItemClick;
            _listView.ItemLongClick += ListViewOnItemLongClick;

            // Save the source activity type for later (for providing Up navigation)
            _sourceActivityType = Intent.GetStringExtra("sourceActivity");

            // Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready
            //((AndroidNavigationManager)_navigationManager).SetEqualizerPresetsActivityInstance(this);
            _navigationManager.BindEqualizerPresetsView(null, this);
        }
开发者ID:pascalfr,项目名称:MPfm,代码行数:31,代码来源:EqualizerPresetsActivity.cs

示例7: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            ActionBar.Hide();
            SetContentView(Resource.Layout.Main);
            cover = FindViewById<RelativeLayout>(Resource.Id.titleScreen);
            player = MediaPlayer.Create(this, Resource.Raw.avril_14th);
            toggleMusic = FindViewById<ToggleButton>(Resource.Id.toggleMusic);
            player.Start();
            player.Looping = true;

            cover.Click += delegate
            {
                StartActivity(typeof(Login));
            };


            toggleMusic.Click += (o, s) =>

            {
                if (toggleMusic.Checked)
                {
                    player.Start();
                    toggleMusic.SetBackgroundResource(Android.Resource.Drawable.IcMediaPause);

                }
                else
                {
                    toggleMusic.SetBackgroundResource(Android.Resource.Drawable.IcMediaPlay);
                    player.Pause();
                }
            };


        }
开发者ID:knervous,项目名称:MemoryBox,代码行数:35,代码来源:MainActivity.cs

示例8: Gallery

        /// <summary>Default constructor.</summary>
        public Gallery()
        {
            this.SetFlag (WidgetFlags.NoWindow);

            this.AddEvents ((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask));

            this.tiles = new List<Tile> ();
            this.selectedTiles = new List<Tile> ();

            this.defaultTilesPerRow = 3;
            this.firstDisplayedTileIndex = 0;
            this.lastDisplayedTileIndex = -1;
            this.multiSelect = false;

            this.tileHeight = 56;
            this.tileWidth = 72;
            this.tileSpacing = 0;
            this.BorderWidth = 2;

            this.up = new Button ("\u25B2");
            this.up.Parent = this;
            this.up.Padding = 0;
            this.up.Clicked += up_Clicked;

            this.down = new Button ("\u25BC");
            this.down.Parent = this;
            this.down.Padding = 0;
            this.down.Clicked += down_Clicked;

            this.expand = new ToggleButton ("\u2193");
            this.expand.Parent = this;
            this.expand.Padding = 0;
            this.expand.ValueChanged += expand_ValueChanged;
        }
开发者ID:MASGAU,项目名称:gtk-sharp-ribbon,代码行数:35,代码来源:Gallery.cs

示例9: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.HomeScreen, container, false);
            infoButton = view.FindViewById<Button>(Resource.Id.infoButton);
            player = MediaPlayer.Create(view.Context, Resource.Raw.avril_14th);
            toggleMusic = view.FindViewById<ToggleButton>(Resource.Id.toggleMusic);
            cover = view.FindViewById<RelativeLayout>(Resource.Id.titleScreen);

            Xamarin.Insights.Initialize(XamarinInsights.ApiKey, view.Context);
            CurrentPlatform.Init();

            player.Start();
            player.Looping = true;

            cover.Click += delegate
            {
                facebookLogin.Invoke(this, new LoginEventArgs());
            };

            toggleMusic.Click += (o, s) => {

                if (toggleMusic.Checked)
                {
                    player.Start();
                    toggleMusic.SetBackgroundResource(Android.Resource.Drawable.IcMediaPause);
                }
                else {
                    toggleMusic.SetBackgroundResource(Android.Resource.Drawable.IcMediaPlay);
                    player.Pause();
                }
            };

            return view;
        }
开发者ID:knervous,项目名称:MemBox1,代码行数:34,代码来源:HomeScreenFragment.cs

示例10: OnCreateDialogView

      protected override View OnCreateDialogView()
      {
         
         LayoutInflater inflator = LayoutInflater.FromContext(this.Context);
         View dialog = inflator.Inflate(Resource.Layout.opencl_preference, null);

         _openCLToggleButton = dialog.FindViewById<ToggleButton>(Resource.Id.opencl_preference_toggleButton);

         AppPreference preference = new AppPreference();
         _openCLToggleButton.Checked = preference.UseOpenCL;

         _openCLToggleButton.CheckedChange += (sender, args) =>
         {
            bool isChecked = args.IsChecked;

            if (isChecked && !CvInvoke.HaveOpenCL)
            {
               _openCLToggleButton.Checked = false;
               Toast.MakeText(Context, "No OpenCL compatible device found.", ToastLength.Long).Show();
               isChecked = false;
            }

            preference.UseOpenCL = isChecked;
         };

         return dialog;
      }
开发者ID:reidblomquist,项目名称:emgucv,代码行数:27,代码来源:OpenCLDialogPreference.cs

示例11: OnCreateOptionsMenu

		public override bool OnCreateOptionsMenu (Android.Views.IMenu menu)
		{
			MenuInflater.Inflate (Resource.Menu.main_screen, menu);

			_addAlarmMenuButton = menu.FindItem (Resource.Id.add_alarm);
			_acceptMenuButton = menu.FindItem (Resource.Id.accept);
			_alarmNameMenuItem = menu.FindItem (Resource.Id.alarm_name);
			_deleteAlarmMenuItem = menu.FindItem (Resource.Id.delete);
			_disableAlarmMenuItem = menu.FindItem (Resource.Id.switch_button);
			_alarmRadiusMenuItem = menu.FindItem (Resource.Id.alarm_radius);
			_settingsMenuItem = menu.FindItem (Resource.Id.action_settings);
            
			_alarmNameEditText = MenuItemCompat.GetActionView (_alarmNameMenuItem) as EditText;
			_alarmNameEditText.Hint = Resources.GetString (Resource.String.alarm_name);
			_alarmNameEditText.SetWidth (Resources.GetDimensionPixelSize (Resource.Dimension.abc_search_view_preferred_width));

			_enableAlarmToggleButton = MenuItemCompat.GetActionView (_disableAlarmMenuItem) as ToggleButton;
			_enableAlarmToggleButton.CheckedChange += AlarmEnabledChange;

			_alarmRadiusSpinner = MenuItemCompat.GetActionView (_alarmRadiusMenuItem) as Spinner;
			var adapter = new ArrayAdapter (this, Resource.Layout.support_simple_spinner_dropdown_item, 
				              Android.Resource.Id.Text1, Constants.AlarmRadiusValues.Select (r => string.Format ("{0} m", r)).ToList ());
			adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
			_alarmRadiusSpinner.Adapter = adapter;
			_alarmRadiusSpinner.ItemSelected += (s, e) => RedrawAddCircle ();

			ManageMenuItemsVisibilityForMode ();

			_addAlarmMenuButton.SetVisible (_isGooglePlayServicesAvailable == ConnectionResult.Success);

			return base.OnCreateOptionsMenu (menu);
		}
开发者ID:foxanna,项目名称:SimpleLocationAlarm,代码行数:32,代码来源:HomeActivityAddMode.cs

示例12: SetDisplayMode_Should_Update_Existing_DisplayMode

 public void SetDisplayMode_Should_Update_Existing_DisplayMode()
 {
     var sut = new ToggleButton();
     var actual = ToggleButtonDisplayMode.Large;
     sut.SetDisplayMode(ToggleButtonDisplayMode.Medium);
     sut.SetDisplayMode(actual);
     Assert.AreEqual(actual.ToString(), sut.GetDisplayMode());
 }
开发者ID:ThorstenHans,项目名称:FluentSPRibbon,代码行数:8,代码来源:InteractiveRibbonElement_Tests.cs

示例13: GetToggleButton_Should_Find_And_Return_Correct_ToggleButton

 public void GetToggleButton_Should_Find_And_Return_Correct_ToggleButton()
 {
     var actual = new ToggleButton("MyToggleButton");
     var fake = new ToggleButton("MyToggleBUtton");
     _sut._toggleButtons.Add(fake);
     _sut._toggleButtons.Add(actual);
     Assert.AreEqual(actual, _sut.GetToggleButton("MyToggleButton"));
 }
开发者ID:ThorstenHans,项目名称:FluentSPRibbon,代码行数:8,代码来源:MenuSection_Tests.cs

示例14: OnCreate

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.Main);
			manager = (UsbManager)this.GetSystemService (Context.UsbService);
			tgConnect = FindViewById<ToggleButton>(Resource.Id.toggleButton1);
			Result = FindViewById<TextView>(Resource.Id.textView1);
			tgConnect.CheckedChange += tgConnect_HandleCheckedChange;
		}
开发者ID:EnriqueProinfo,项目名称:Mono,代码行数:9,代码来源:MainActivity.cs

示例15: BoolFormatCell

		public BoolFormatCell (Context ctxt) : base (ctxt)
		{
			isOpen = new ToggleButton (ctxt);
			isOpen.SetTextColor (Color.Rgb (51, 51, 51));
			isOpen.TextOn = "Open";
			isOpen.TextOff = "Closed";
			isOpen.Click += isOpen_Click;
			CanRenderUnLoad = false;
			this.AddView (isOpen);
		}
开发者ID:IanLeatherbury,项目名称:tryfsharpforms,代码行数:10,代码来源:FormattedCell.cs


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