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


C# EditText.SetBinding方法代码示例

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


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

示例1: UserRegistrationView

		public UserRegistrationView ()
		{

			BindingContext = new UserViewModel(this.Navigation);

			 indicator = new ActivityIndicator
			{
				Color = Colors.DarkGray.ToFormsColor(),
				HorizontalOptions=LayoutOptions.Center,
				VerticalOptions=LayoutOptions.Center,
			};
			//indicator.SetBinding (ActivityIndicator.IsRunningProperty, "IsLoading");
			//indicator.SetBinding (ActivityIndicator.IsVisibleProperty, "IsLoading");
			stack_CoverPage = new StackLayout
			{
				WidthRequest=Width,
				HeightRequest = Width/4,
				//BackgroundColor=Color.Red,
				BackgroundColor=Colors.DarkGray.ToFormsColor(),
			
			};
			img_User = new CircleImage
			{
				WidthRequest = Width/4,
				HeightRequest = Width/4,

				HorizontalOptions = LayoutOptions.Center,
				//BackgroundColor=Color.Yellow,
				TranslationY=-((Width/4)/2+10),
				Aspect=Aspect.Fill,
				Source="CircleImage.png",
			};
			img_User.SetBinding(CircleImage.SourceProperty, "ImageSource", BindingMode.Default);

		
			ViewModel.ProfilePicture = img_User;
			btn_camera = new Image
			{
				Source="camera.png",
				WidthRequest=Width/8,
				HeightRequest=Height/8,
				HorizontalOptions=LayoutOptions.Start,
				VerticalOptions = LayoutOptions.Center,
				BackgroundColor=Xamarin.Forms.Color.Red,

			};

			var Cameratap = new TapGestureRecognizer(OnCameraTapped);
			btn_camera.IsEnabled = true;
			btn_camera.GestureRecognizers.Clear();
			btn_camera.GestureRecognizers.Add(Cameratap);

			btn_gallery = new Image
			{
				Source="gallery.png",
				WidthRequest=Width/8,
				HeightRequest=Height/8,
				HorizontalOptions=LayoutOptions.End,
				VerticalOptions = LayoutOptions.Center,
				BackgroundColor=Xamarin.Forms.Color.Green,

			};
			var Gallerytap = new TapGestureRecognizer(OnGalleryTapped);
			btn_gallery.IsEnabled = true;
			btn_gallery.GestureRecognizers.Clear();
			btn_gallery.GestureRecognizers.Add(Gallerytap);

			stack_pop = new StackLayout
			{
				HeightRequest = Width / 2,
				WidthRequest = Width / 2,
				VerticalOptions = LayoutOptions.Center,
				HorizontalOptions = LayoutOptions.Center,
				BackgroundColor = Xamarin.Forms.Color.White,
				TranslationY=Width / 2,
				Opacity = 1,
				Children = 
				{
					new StackLayout
					{
						VerticalOptions = LayoutOptions.Center,
						HorizontalOptions = LayoutOptions.Center,
						Orientation = StackOrientation.Horizontal,
						TranslationY=Width/6,
						Children=
						{
							btn_camera, btn_gallery
						}
						
					}
				}
			};
			stack_popup = new StackLayout
			{ 
				WidthRequest = Width,
				HeightRequest = Height,
				BackgroundColor=Xamarin.Forms.Color.Transparent,
				Children=
				{
					stack_pop
//.........这里部分代码省略.........
开发者ID:XnainA,项目名称:XamarinProfile,代码行数:101,代码来源:UserRegistrationView.cs

示例2: UserLoginView

		public UserLoginView ()
		{
			
			BindingContext = new UserViewModel(this.Navigation);


			var indicator = new ActivityIndicator
			{
				Color = Colors.DarkGray.ToFormsColor(),

			};
			indicator.SetBinding (ActivityIndicator.IsRunningProperty, "IsLoading");
			indicator.SetBinding (ActivityIndicator.IsVisibleProperty, "IsLoading");

			img_Logo = new Image
			{
				HeightRequest = Width/4,
				WidthRequest = Width/4,
				HorizontalOptions = LayoutOptions.Center,
				Source="AppLogo.png",
			};

			txt_Email = new EditText
			{
				WidthRequest = Width,
				HorizontalOptions = LayoutOptions.Center,
				Keyboard=Keyboard.Email,
				Placeholder="Email",
				TextColor=Colors.DarkGray.ToFormsColor(),
				BackgroundColor=Color.Transparent,
				HeightRequest=Width/10,
				Text="[email protected]"
			};
			txt_Email.SetBinding(Entry.TextProperty, "Username");

			txt_Password = new EditText
			{
				WidthRequest = Width,
				HorizontalOptions = LayoutOptions.Center,
				IsPassword=true,
				Placeholder="Password",
				TextColor=Colors.DarkGray.ToFormsColor(),
				BackgroundColor=Color.Transparent,
				HeightRequest=Width/10,
				Text="123"
					
			};
			txt_Password.SetBinding(Entry.TextProperty, "Password");

			btn_Login= new Button
			{
				WidthRequest = Width/2,
				HorizontalOptions = LayoutOptions.Center,
				HeightRequest=Width/8,			
				Text="Login",	
				FontSize=17,
				TextColor=Color.White,
				BackgroundColor=Colors.DarkGray.ToFormsColor(),
				CommandParameter=1,
				Command=ViewModel.LoginUser
			};

			lbl_Registration = new ExtendedLabel
			{
				WidthRequest = Width,
				Text="Sing Up",
				HorizontalOptions = LayoutOptions.Start,
				TextColor=Colors.DarkGray.ToFormsColor(),
				BackgroundColor=Color.Transparent,
				FontSize=18,
				IsUnderline=true

			};
			var Regtap = new TapGestureRecognizer(OnRegistrationTapped);
			Regtap.NumberOfTapsRequired = 1;
			lbl_Registration.IsEnabled = true;
			lbl_Registration.GestureRecognizers.Clear();
			lbl_Registration.GestureRecognizers.Add(Regtap);

			lbl_Forgot = new ExtendedLabel
			{
				WidthRequest = Width,
				Text="Forgot Password ?",
				HorizontalOptions = LayoutOptions.End,
				TextColor=Colors.DarkGray.ToFormsColor(),
				BackgroundColor=Color.Transparent,
				FontSize=18,
				IsUnderline=true

			};
			var Forgottap = new TapGestureRecognizer(OnForgotPasswordTapped);
			Forgottap.NumberOfTapsRequired = 1;
			lbl_Forgot.IsEnabled = true;
			lbl_Forgot.GestureRecognizers.Clear();
			lbl_Forgot.GestureRecognizers.Add(Forgottap);

			 stack_BottomView = new StackLayout
			{
				HorizontalOptions = LayoutOptions.StartAndExpand,
				VerticalOptions=LayoutOptions.Fill,
//.........这里部分代码省略.........
开发者ID:XnainA,项目名称:XamarinProfile,代码行数:101,代码来源:UserLoginView.cs


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