public override ValidationResult Validate(object value, CultureInfo cultureInfo) { bool result = true; if (value is string path) { if (!File.Exists(path)) { result = false; } if (LooseyBinding.IsBindingFormat(path)) { return(new ValidationResult(true, null)); } if (result) { try { ResourceManager.GetImageSourceFromPath(path); } catch { result = false; } } } return(new ValidationResult(result, null)); }
public override ImageSource Convert(string value, object parameter) { if (LooseyBinding.IsBindingFormat(value)) { return(null); } var img = ResourceManager.GetImageSourceFromPath(value); return(img); }
private void Source_Changed(object sender, EventArgs e) { if (LooseyBinding.IsBindingFormat(this.Model.Source)) { this.SetLooseyBinding( PImage.SourceProperty, LooseyBinding.GetBindingPropertyName(this.Model.Source)); } else { this.RemoveLooseyBinding(PImage.SourceProperty); } }
private void Text_Changed(object sender, EventArgs e) { if (LooseyBinding.IsBindingFormat(this.Model.Text)) { this.SetLooseyBinding( PLabel.TextProperty, LooseyBinding.GetBindingPropertyName(this.Model.Text)); } else { this.RemoveLooseyBinding(PLabel.TextProperty); } }