private void DatePicker_Tapped(object sender, EventArgs e) { if ((this.BindingContext as OrdonnanceCreateEditViewModel).CanEdit) { MyDatePicker.Focus(); } }
protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); MyDatePicker Content = sender as MyDatePicker; Control.BorderStyle = UITextBorderStyle.None; if (e.PropertyName == MyDatePicker.TextColorProperty.PropertyName) { SetTextColor(Content); } if (e.PropertyName == MyDatePicker.FontSizeProperty.PropertyName) { SetFontSize(Content); } if (e.PropertyName == MyDatePicker.HorizontalTextAlignmentProperty.PropertyName) { SetXAlign(Content); } if (e.PropertyName == MyDatePicker.IsFocusedProperty.PropertyName) { this.Control.Text = Content.Date.ToString(Content.Format); this.Control.TextColor = Content.TextColor.ToUIColor(); } }
private void SetTitle(MyDatePicker Content) { if (!string.IsNullOrEmpty(Content.Title)) { this.Control.Text = Content.Title; this.Control.TextColor = Content.PlaceholderColor.ToUIColor(); } }
private void SetFontSize(MyDatePicker Content) { Typeface font = Typeface.CreateFromAsset(Forms.Context.Assets, "MyriadProRegular.ttf"); TextView label = (TextView)Control; label.Typeface = font; this.Control.TextSize = Content.FontSize; }
private void OnMyButtonClicked(object sender, EventArgs e) { Device.BeginInvokeOnMainThread(() => { if (MyDatePicker.IsFocused) { MyDatePicker.Unfocus(); } MyDatePicker.Focus(); }); }
protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.DatePicker> e) { base.OnElementChanged(e); if (e.NewElement != null) { MyDatePicker Content = e.NewElement as MyDatePicker; SetTextColor(Content); SetFontSize(Content); SetXAlign(Content); SetTitle(Content); } }
protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.DatePicker> e) { base.OnElementChanged(e); if (e.NewElement != null) { MyDatePicker Content = e.NewElement as MyDatePicker; SetTextColor(Content); SetFontSize(Content); SetXAlign(Content); SetTitle(Content); ShapeDrawable shape = new ShapeDrawable(new RectShape()); shape.Paint.Color = Xamarin.Forms.Color.Transparent.ToAndroid(); shape.Paint.StrokeWidth = 5; shape.Paint.SetStyle(Paint.Style.Stroke); this.Control.SetBackground(shape); } }
public void InitializeComponent() { if (this._contentLoaded) { return; } this._contentLoaded = true; Application.LoadComponent(this, new Uri("/VKClient.Common;component/SettingsEditProfilePage.xaml", UriKind.Relative)); this.ucHeader = (GenericHeaderUC)base.FindName("ucHeader"); this.scrollViewer = (ScrollViewer)base.FindName("scrollViewer"); this.stackPanel = (StackPanel)base.FindName("stackPanel"); this.PhotoMenu = (ContextMenu)base.FindName("PhotoMenu"); this.datePicker = (MyDatePicker)base.FindName("datePicker"); this.textBoxPanel = (TextBoxPanelControl)base.FindName("textBoxPanel"); // this.rectangleGeometry = (RectangleGeometry)base.FindName("rectangleGeometry"); this.rectangleGeometry2 = (RectangleGeometry)base.FindName("rectangleGeometry2"); this.rectangleGeometry3 = (RectangleGeometry)base.FindName("rectangleGeometry3"); }
private void SetXAlign(MyDatePicker Content) { this.Control.TextAlignment = IosUtilits.ToUITextAlignment(Content.HorizontalTextAlignment); }
private void SetFontSize(MyDatePicker Content) { Control.Font = UIFont.FromName("Myriad Pro", Content.FontSize); }
private void SetTextColor(MyDatePicker Content) { this.Control.TextColor = Content.TextColor.ToUIColor(); }
private void SetTextColor(MyDatePicker Content) { this.Control.SetTextColor(Content.TextColor.ToAndroid()); }
public void OnTodayClicked(object sender, EventArgs args) { MyDatePicker.SelectItemForce(DateTime.Now); }