public void Init() { ViewHelper.DefaultViewProperties(this); this.IsPassword = Me.IsPassword; Device.OnPlatform( Android: () => { this.Text = OnPlatformString.GetAndroidValue(Me.Text); this.Placeholder = OnPlatformString.GetAndroidValue(Me.Placeholder); if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.TextColor))) { this.TextColor = Color.FromHex(OnPlatformString.GetAndroidValue(Me.TextColor)); } }, iOS: () => { this.Text = OnPlatformString.GetiOSValue(Me.Text); this.Placeholder = OnPlatformString.GetiOSValue(Me.Placeholder); if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.TextColor))) { this.TextColor = Color.FromHex(OnPlatformString.GetiOSValue(Me.TextColor)); } }, WinPhone: () => { this.Text = OnPlatformString.GetWinPhoneValue(Me.Text); this.Placeholder = OnPlatformString.GetWinPhoneValue(Me.Placeholder); if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.TextColor))) { this.TextColor = Color.FromHex(OnPlatformString.GetWinPhoneValue(Me.TextColor)); } } ); }
private IView GetView(Page page, MobileScreen screen, BaseControl control) { return(ViewHelper.GetView(page, screen, control)); }
public void Init() { ViewHelper.DefaultViewProperties(this); Device.OnPlatform( Android: () => { //this.BorderWidth = OnPlatformInt.GetAndroidValue(Me.BorderWidth); //this.BorderRadius = OnPlatformInt.GetAndroidValue(Me.BorderRadius); if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.BorderColor))) { this.BorderColor = Color.FromHex(OnPlatformString.GetAndroidValue(Me.BorderColor)); } if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.Image))) { try { this.Image = ImageSource.FromFile(OnPlatformString.GetAndroidValue(Me.Image)) as FileImageSource; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Error while trying to load button image {1}: {0} ", ex.Message, Me.Image); } } this.Text = OnPlatformString.GetAndroidValue(Me.Text); if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.TextColor))) { this.TextColor = Color.FromHex(OnPlatformString.GetAndroidValue(Me.TextColor)); } }, iOS: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.BorderColor))) { this.BorderColor = Color.FromHex(OnPlatformString.GetiOSValue(Me.BorderColor)); } if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.Image))) { try { this.Image = ImageSource.FromFile(OnPlatformString.GetiOSValue(Me.Image)) as FileImageSource; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Error while trying to load button image {1}: {0} ", ex.Message, Me.Image); } } this.Text = OnPlatformString.GetiOSValue(Me.Text); if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.TextColor))) { this.TextColor = Color.FromHex(OnPlatformString.GetiOSValue(Me.TextColor)); } }, WinPhone: () => { if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.BorderColor))) { this.BorderColor = Color.FromHex(OnPlatformString.GetWinPhoneValue(Me.BorderColor)); } if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.Image))) { try { this.Image = ImageSource.FromFile(OnPlatformString.GetWinPhoneValue(Me.Image)) as FileImageSource; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Error while trying to load button image {1}: {0} ", ex.Message, Me.Image); } } this.Text = OnPlatformString.GetWinPhoneValue(Me.Text); if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.TextColor))) { this.TextColor = Color.FromHex(OnPlatformString.GetWinPhoneValue(Me.TextColor)); } } ); this.Clicked += Button_Clicked; }