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


C# CheckBox.SetBinding方法代码示例

本文整理汇总了C#中CheckBox.SetBinding方法的典型用法代码示例。如果您正苦于以下问题:C# CheckBox.SetBinding方法的具体用法?C# CheckBox.SetBinding怎么用?C# CheckBox.SetBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CheckBox的用法示例。


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

示例1: LoginView

        public LoginView()
        {
            InitializeComponent ();

            grd.Padding = Device.OnPlatform (10, 8, 10);
            grd.WidthRequest = Device.OnPlatform (300, 400, 300);
            grd.RowSpacing = Device.OnPlatform (10, 8, 10);

            lblName.FontSize = Device.OnPlatform (13, 14, 0);
            lblPassword.FontSize = Device.OnPlatform (13, 14, 0);

            if (Device.OS == TargetPlatform.Android) {
                var chk = new CheckBox (){ DefaultText = "Запомнить пароль" };
                chk.SetBinding (CheckBox.CheckedProperty, new Binding ("RememberPassword"));
                stkRemember.Children.Add (chk);
            } else {
                var grd = new Grid ();
                grd.ColumnDefinitions.Add (new ColumnDefinition ());
                grd.ColumnDefinitions.Add (new ColumnDefinition (){ Width = GridLength.Auto });
                {
                    var lbl = new Label (){ Text = "Запомнить пароль?", VerticalOptions = LayoutOptions.Center, FontSize = 13 };
                    Grid.SetColumn (lbl, 0);
                    grd.Children.Add (lbl);

                    var swt = new ExtendedSwitch (){ HorizontalOptions = LayoutOptions.End, TintColor = Color.FromHex ("#6f80a4") };
                    swt.SetBinding (Switch.IsToggledProperty, new Binding ("RememberPassword"));
                    Grid.SetColumn (swt, 1);
                    grd.Children.Add (swt);
                }

                stkRemember.Children.Add (grd);
            }

            btnLogin.WidthRequest = Device.OnPlatform (-1, 150, 150);

            Device.StartTimer (TimeSpan.FromSeconds (1), OnTimerTick);
        }
开发者ID:LordOfSmiles,项目名称:MatrixBuilderTest,代码行数:37,代码来源:LoginView.xaml.cs

示例2: SetDifferentModesWithoutIsReadOnly

        public void SetDifferentModesWithoutIsReadOnly()
        {
            CheckBox checkBox = new CheckBox();
            checkBox.SetBinding(CheckBox.IsCheckedProperty, new Binding("BoolProperty") { Mode = BindingMode.TwoWay });
            this._dataField.Content = checkBox;
            this._dataField.Mode = DataFieldMode.ReadOnly;

            this.AddToPanelAndWaitForLoad();

            this.EnqueueCallback(() =>
            {
                Assert.IsFalse(checkBox.IsEnabled);
                this._dataField.Mode = DataFieldMode.Edit;
                this.ExpectFieldContentLoaded();
            });

            this.WaitForFieldContentLoaded();

            this.EnqueueCallback(() =>
            {
                Assert.IsTrue(checkBox.IsEnabled);
                this._dataField.Mode = DataFieldMode.AddNew;
                this.ExpectFieldContentLoaded();
            });

            this.WaitForFieldContentLoaded();

            this.EnqueueCallback(() =>
            {
                Assert.IsTrue(checkBox.IsEnabled);
            });

            this.EnqueueTestComplete();
        }
开发者ID:shijiaxing,项目名称:SilverlightToolkit,代码行数:34,代码来源:DataFieldTests.cs

示例3: Get_e_24_Items

 private static System.Collections.ObjectModel.ObservableCollection<object> Get_e_24_Items() {
     System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
     // e_25 element
     TabItem e_25 = new TabItem();
     e_25.Name = "e_25";
     e_25.HorizontalContentAlignment = HorizontalAlignment.Stretch;
     e_25.SetResourceReference(TabItem.HeaderProperty, "GameText");
     // e_26 element
     Grid e_26 = new Grid();
     e_25.Content = e_26;
     e_26.Name = "e_26";
     e_26.Margin = new Thickness(10F, 10F, 10F, 10F);
     RowDefinition row_e_26_0 = new RowDefinition();
     row_e_26_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_26.RowDefinitions.Add(row_e_26_0);
     RowDefinition row_e_26_1 = new RowDefinition();
     row_e_26_1.Height = new GridLength(1F, GridUnitType.Auto);
     e_26.RowDefinitions.Add(row_e_26_1);
     RowDefinition row_e_26_2 = new RowDefinition();
     row_e_26_2.Height = new GridLength(1F, GridUnitType.Auto);
     e_26.RowDefinitions.Add(row_e_26_2);
     RowDefinition row_e_26_3 = new RowDefinition();
     row_e_26_3.Height = new GridLength(1F, GridUnitType.Auto);
     e_26.RowDefinitions.Add(row_e_26_3);
     RowDefinition row_e_26_4 = new RowDefinition();
     row_e_26_4.Height = new GridLength(1F, GridUnitType.Auto);
     e_26.RowDefinitions.Add(row_e_26_4);
     ColumnDefinition col_e_26_0 = new ColumnDefinition();
     col_e_26_0.Width = new GridLength(58F, GridUnitType.Star);
     e_26.ColumnDefinitions.Add(col_e_26_0);
     ColumnDefinition col_e_26_1 = new ColumnDefinition();
     col_e_26_1.Width = new GridLength(134F, GridUnitType.Star);
     e_26.ColumnDefinitions.Add(col_e_26_1);
     ColumnDefinition col_e_26_2 = new ColumnDefinition();
     col_e_26_2.Width = new GridLength(193F, GridUnitType.Star);
     e_26.ColumnDefinitions.Add(col_e_26_2);
     ColumnDefinition col_e_26_3 = new ColumnDefinition();
     col_e_26_3.Width = new GridLength(192F, GridUnitType.Star);
     e_26.ColumnDefinitions.Add(col_e_26_3);
     ColumnDefinition col_e_26_4 = new ColumnDefinition();
     col_e_26_4.Width = new GridLength(193F, GridUnitType.Star);
     e_26.ColumnDefinitions.Add(col_e_26_4);
     // e_27 element
     TextBlock e_27 = new TextBlock();
     e_26.Children.Add(e_27);
     e_27.Name = "e_27";
     e_27.Margin = new Thickness(0F, 6F, 0F, 5F);
     e_27.VerticalAlignment = VerticalAlignment.Center;
     e_27.Foreground = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     Grid.SetColumnSpan(e_27, 2);
     e_27.SetResourceReference(TextBlock.TextProperty, "DifficultyText");
     // cbDifficulty element
     ComboBox cbDifficulty = new ComboBox();
     e_26.Children.Add(cbDifficulty);
     cbDifficulty.Name = "cbDifficulty";
     cbDifficulty.Margin = new Thickness(2F, 2F, 2F, 3F);
     cbDifficulty.VerticalAlignment = VerticalAlignment.Center;
     cbDifficulty.ItemsSource = Get_cbDifficulty_Items();
     Grid.SetColumn(cbDifficulty, 2);
     Binding binding_cbDifficulty_SelectedIndex = new Binding("Difficulty");
     cbDifficulty.SetBinding(ComboBox.SelectedIndexProperty, binding_cbDifficulty_SelectedIndex);
     // e_31 element
     TextBlock e_31 = new TextBlock();
     e_26.Children.Add(e_31);
     e_31.Name = "e_31";
     e_31.Margin = new Thickness(0F, 6F, 0F, 5F);
     e_31.VerticalAlignment = VerticalAlignment.Center;
     e_31.Foreground = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     Grid.SetRow(e_31, 1);
     Grid.SetColumnSpan(e_31, 2);
     e_31.SetResourceReference(TextBlock.TextProperty, "LanguageText");
     // cbLanguage element
     ComboBox cbLanguage = new ComboBox();
     e_26.Children.Add(cbLanguage);
     cbLanguage.Name = "cbLanguage";
     cbLanguage.Margin = new Thickness(2F, 3F, 2F, 2F);
     cbLanguage.VerticalAlignment = VerticalAlignment.Center;
     cbLanguage.ItemsSource = Get_cbLanguage_Items();
     Grid.SetColumn(cbLanguage, 2);
     Grid.SetRow(cbLanguage, 1);
     Binding binding_cbLanguage_SelectedIndex = new Binding("Language");
     cbLanguage.SetBinding(ComboBox.SelectedIndexProperty, binding_cbLanguage_SelectedIndex);
     items.Add(e_25);
     // e_36 element
     TabItem e_36 = new TabItem();
     e_36.Name = "e_36";
     e_36.SetResourceReference(TabItem.HeaderProperty, "VideoText");
     // e_37 element
     Grid e_37 = new Grid();
     e_36.Content = e_37;
     e_37.Name = "e_37";
     e_37.Margin = new Thickness(10F, 10F, 10F, 10F);
     RowDefinition row_e_37_0 = new RowDefinition();
     row_e_37_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_37.RowDefinitions.Add(row_e_37_0);
     RowDefinition row_e_37_1 = new RowDefinition();
     row_e_37_1.Height = new GridLength(1F, GridUnitType.Auto);
     e_37.RowDefinitions.Add(row_e_37_1);
     RowDefinition row_e_37_2 = new RowDefinition();
     row_e_37_2.Height = new GridLength(1F, GridUnitType.Auto);
//.........这里部分代码省略.........
开发者ID:charbean,项目名称:StrategyClean,代码行数:101,代码来源:Options.xaml.cs

示例4: Get_TabControl_Items

 private static System.Collections.ObjectModel.ObservableCollection<object> Get_TabControl_Items() {
     System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
     // e_1 element
     TabItem e_1 = new TabItem();
     e_1.Name = "e_1";
     e_1.Header = "Players";
     // e_2 element
     Grid e_2 = new Grid();
     e_1.Content = e_2;
     e_2.Name = "e_2";
     // PlayersDataGrid element
     DataGrid PlayersDataGrid = new DataGrid();
     e_2.Children.Add(PlayersDataGrid);
     PlayersDataGrid.Name = "PlayersDataGrid";
     PlayersDataGrid.AutoGenerateColumns = false;
     DataGridTextColumn PlayersDataGrid_Col0 = new DataGridTextColumn();
     PlayersDataGrid_Col0.Header = "#";
     Binding PlayersDataGrid_Col0_b = new Binding("Number");
     PlayersDataGrid_Col0.Binding = PlayersDataGrid_Col0_b;
     PlayersDataGrid.Columns.Add(PlayersDataGrid_Col0);
     DataGridTextColumn PlayersDataGrid_Col1 = new DataGridTextColumn();
     PlayersDataGrid_Col1.Header = "Name";
     Binding PlayersDataGrid_Col1_b = new Binding("Name");
     PlayersDataGrid_Col1.Binding = PlayersDataGrid_Col1_b;
     PlayersDataGrid.Columns.Add(PlayersDataGrid_Col1);
     DataGridTextColumn PlayersDataGrid_Col2 = new DataGridTextColumn();
     PlayersDataGrid_Col2.Header = "GameJolt ID";
     Binding PlayersDataGrid_Col2_b = new Binding("GameJoltID");
     PlayersDataGrid_Col2.Binding = PlayersDataGrid_Col2_b;
     PlayersDataGrid.Columns.Add(PlayersDataGrid_Col2);
     DataGridTextColumn PlayersDataGrid_Col3 = new DataGridTextColumn();
     PlayersDataGrid_Col3.Header = "Location";
     Binding PlayersDataGrid_Col3_b = new Binding("LevelFile");
     PlayersDataGrid_Col3.Binding = PlayersDataGrid_Col3_b;
     PlayersDataGrid.Columns.Add(PlayersDataGrid_Col3);
     DataGridTextColumn PlayersDataGrid_Col4 = new DataGridTextColumn();
     PlayersDataGrid_Col4.Header = "Play Time";
     Binding PlayersDataGrid_Col4_b = new Binding("PlayTime");
     PlayersDataGrid_Col4.Binding = PlayersDataGrid_Col4_b;
     PlayersDataGrid.Columns.Add(PlayersDataGrid_Col4);
     DataGridTextColumn PlayersDataGrid_Col5 = new DataGridTextColumn();
     PlayersDataGrid_Col5.Header = "IP";
     Binding PlayersDataGrid_Col5_b = new Binding("IP");
     PlayersDataGrid_Col5.Binding = PlayersDataGrid_Col5_b;
     PlayersDataGrid.Columns.Add(PlayersDataGrid_Col5);
     DataGridTextColumn PlayersDataGrid_Col6 = new DataGridTextColumn();
     PlayersDataGrid_Col6.Header = "Ping";
     Binding PlayersDataGrid_Col6_b = new Binding("Ping");
     PlayersDataGrid_Col6.Binding = PlayersDataGrid_Col6_b;
     PlayersDataGrid.Columns.Add(PlayersDataGrid_Col6);
     Grid.SetColumnSpan(PlayersDataGrid, 2);
     Binding binding_PlayersDataGrid_ItemsSource = new Binding("PlayersGridDataList");
     PlayersDataGrid.SetBinding(DataGrid.ItemsSourceProperty, binding_PlayersDataGrid_ItemsSource);
     items.Add(e_1);
     // e_3 element
     TabItem e_3 = new TabItem();
     e_3.Name = "e_3";
     e_3.Header = "Bans";
     // e_4 element
     Grid e_4 = new Grid();
     e_3.Content = e_4;
     e_4.Name = "e_4";
     // BansDataGrid element
     DataGrid BansDataGrid = new DataGrid();
     e_4.Children.Add(BansDataGrid);
     BansDataGrid.Name = "BansDataGrid";
     BansDataGrid.AutoGenerateColumns = false;
     DataGridTextColumn BansDataGrid_Col0 = new DataGridTextColumn();
     BansDataGrid_Col0.Header = "#";
     Binding BansDataGrid_Col0_b = new Binding("Number");
     BansDataGrid_Col0.Binding = BansDataGrid_Col0_b;
     BansDataGrid.Columns.Add(BansDataGrid_Col0);
     DataGridTextColumn BansDataGrid_Col1 = new DataGridTextColumn();
     BansDataGrid_Col1.Header = "Name";
     Binding BansDataGrid_Col1_b = new Binding("Name");
     BansDataGrid_Col1.Binding = BansDataGrid_Col1_b;
     BansDataGrid.Columns.Add(BansDataGrid_Col1);
     DataGridTextColumn BansDataGrid_Col2 = new DataGridTextColumn();
     BansDataGrid_Col2.Header = "GameJolt ID";
     Binding BansDataGrid_Col2_b = new Binding("GameJoltID");
     BansDataGrid_Col2.Binding = BansDataGrid_Col2_b;
     BansDataGrid.Columns.Add(BansDataGrid_Col2);
     DataGridTextColumn BansDataGrid_Col3 = new DataGridTextColumn();
     BansDataGrid_Col3.Header = "IP";
     Binding BansDataGrid_Col3_b = new Binding("IP");
     BansDataGrid_Col3.Binding = BansDataGrid_Col3_b;
     BansDataGrid.Columns.Add(BansDataGrid_Col3);
     DataGridTextColumn BansDataGrid_Col4 = new DataGridTextColumn();
     BansDataGrid_Col4.Header = "Minutes Left";
     Binding BansDataGrid_Col4_b = new Binding("MinutesLeft");
     BansDataGrid_Col4.Binding = BansDataGrid_Col4_b;
     BansDataGrid.Columns.Add(BansDataGrid_Col4);
     DataGridTextColumn BansDataGrid_Col5 = new DataGridTextColumn();
     BansDataGrid_Col5.Header = "Reason";
     Binding BansDataGrid_Col5_b = new Binding("Reason");
     BansDataGrid_Col5.Binding = BansDataGrid_Col5_b;
     BansDataGrid.Columns.Add(BansDataGrid_Col5);
     Binding binding_BansDataGrid_ItemsSource = new Binding("BansGridDataList");
     BansDataGrid.SetBinding(DataGrid.ItemsSourceProperty, binding_BansDataGrid_ItemsSource);
     items.Add(e_3);
//.........这里部分代码省略.........
开发者ID:PokeD,项目名称:PokeD.SCON,代码行数:101,代码来源:BasicUI.xaml.cs

示例5: LoginPage

		public LoginPage (RootPage rootPage)
		{
			this._rootPage = rootPage;
			_db = new GroupsterDatabase();

			_viewModel = new LoginViewModel (Navigation, new User(), rootPage);
			BindingContext = _viewModel;

			Padding = 0;

			// Create layout and bind where appropriate.
			var loginMessageLabel = new LargeLabel {
				HorizontalOptions = LayoutOptions.Center,
				VerticalOptions = LayoutOptions.Start,
				HeightRequest = 50,
				TextColor = Color.White,
				Text = "Welcome to Groupster",
				FontSize = 30 //Device.GetNamedSize(NamedSize.Large, typeof(Label))
			};

			BackgroundColor = AppColors.BaseColor;

			var loginImage = new Image ();

			loginImage.SetBinding<LoginViewModel> (Image.SourceProperty, vm => vm.LoginImage);

			var usernameEntry = new Entry {
				Placeholder = "Email",
			};

			usernameEntry.SetBinding(Entry.TextProperty, "UserNameMessage");

			var passwordEntry = new Entry {
				Placeholder = "Password",
				IsPassword = true
			};

			passwordEntry.SetBinding(Entry.TextProperty, "PasswordMessage");

			var switchLabel = new Label {
				HorizontalOptions = LayoutOptions.Start,
				VerticalOptions = LayoutOptions.Center,
				Text = "Remember Me?",
			};

			var rememberMeOption = new  CheckBox {
				BackgroundColor = AppColors.BaseColor
			};

			rememberMeOption.SetBinding(CheckBox.CheckedProperty, "RememberMe");

			var switchStackLayout = new StackLayout {
				HorizontalOptions = LayoutOptions.Center,
				Spacing = 10,

				Orientation = StackOrientation.Horizontal,
				Children = {
					switchLabel,
					rememberMeOption
				}
			};

			var loginButton = new Button { 
				Text = "Login", 
				HorizontalOptions = LayoutOptions.Center,
				BackgroundColor = AppColors.Button	
			};
			loginButton.Clicked += LogMeIn;

//			var registerButton = new Button { 
//				Text = "Close", 
//				HorizontalOptions = LayoutOptions.Center 
//			};
//
//			var buttonLayout = new StackLayout {
//				HorizontalOptions = LayoutOptions.Center,
//				Spacing = 10,
//				Orientation = StackOrientation.Horizontal,
//				Children = {
//					loginButton,
//					registerButton
//				}
//			};

			var registerLabel = new Label {
				HorizontalOptions = LayoutOptions.Start,
				VerticalOptions = LayoutOptions.End,
				HeightRequest = 40,
				Text = "New to Groupster?",
				FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
			};

			var registerLink = new Label {
				HorizontalOptions = LayoutOptions.Start,
				VerticalOptions = LayoutOptions.End,
				HeightRequest = 40,
				Text = "Register here",
				FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
				FontAttributes = FontAttributes.Italic
			};
//.........这里部分代码省略.........
开发者ID:jsbuck,项目名称:Groupster,代码行数:101,代码来源:LoginPage.cs

示例6: UpdateMods

    protected void UpdateMods()
    {
        foreach (KeyValuePair<string, Mod> kv in Mod.Mods)
        {
            bool add = true;
            ModViewModel alreadyVM = null;
            foreach (ListViewItem i in _Mods)
            {
                ModViewModel vm = ((ModViewModel)i.DataContext);
                if (vm.versions.Values.Contains(kv.Value))
                {
                    add = false;
                }
                if (vm.ID == kv.Value.ID)
                {
                    alreadyVM = vm;
                }
            }
            if (add)
            {
                Mod mod = kv.Value;
                if (alreadyVM != null)
                {
                    alreadyVM.versions.Add(Mod.Header.ParseModVersion(mod.header.GetVersion()), mod);
                    alreadyVM.OnPropertyChanged("Version");
                    alreadyVM.OnPropertyChanged("Name");
                }
                else
                {
                    ListViewItem item = new ListViewItem();

                    StackPanel outerPanel = new StackPanel();
                    outerPanel.Orientation = Orientation.Horizontal;
                    outerPanel.Margin = new Thickness(-5, 0, 0, 0);
                    CheckBox checkBox = new CheckBox();
                    checkBox.SetBinding(CheckBox.IsCheckedProperty, "Selected");
                    outerPanel.Children.Add(checkBox);

                    StackPanel panel = new StackPanel();

                    TextBlock textBlock = new TextBlock();
                    textBlock.SetBinding(TextBlock.TextProperty, "Name");
                    panel.Children.Add(textBlock);

                    TextBlock textBlock2 = new TextBlock();
                    textBlock2.SetBinding(TextBlock.TextProperty, "Version");
                    textBlock2.FontSize = 14;
                    panel.Children.Add(textBlock2);
                    outerPanel.Children.Add(panel);

                    ModViewModel mvm = new ModViewModel(mod);
                    item.DataContext = mvm;
                    item.Content = outerPanel;
                    _Mods.Add(item);
                }
            }
        }

        foreach (ListViewItem item in _Mods)
        {
            ModViewModel vm = (ModViewModel)item.DataContext;
            vm.Initialized();
        }
        _FirstBatchLoaded = true;
        if (_SelectNewestModVersions)
            SelectNewestVersions();
    }
开发者ID:hamada147,项目名称:ModAPI,代码行数:67,代码来源:ModsViewModel.cs


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