}
}
- /* open when ImageView using Uri not string
- /// <summary>
- /// Image image's resource url in DefaultGridItem.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public string ImageUrl
- {
- get
- {
- return Image.ResourceUrl;
- }
- set
- {
- Image.ResourceUrl = value;
- }
- }
- */
+ /// <summary>
+ /// Image image's resource url in DefaultGridItem.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string ImageUrl
+ {
+ get => GetValue(ImageUrlProperty) as string;
+ set
+ {
+ SetValue(ImageUrlProperty, value);
+ NotifyPropertyChanged();
+ }
+ }
+
+ internal string InternalImageUrl
+ {
+ get
+ {
+ return Image.ResourceUrl;
+ }
+ set
+ {
+ Image.ResourceUrl = value;
+ }
+ }
+
/// <summary>
/// DefaultGridItem's text part.
return instance.InternalText;
});
+
+ /// <summary>
+ /// ImageUrlProperty
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ImageUrlProperty = BindableProperty.Create(nameof(ImageUrl), typeof(string), typeof(DefaultGridItem), default(string), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var instance = (DefaultGridItem)bindable;
+ if (newValue != null)
+ {
+ instance.InternalImageUrl = newValue as string;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var instance = (DefaultGridItem)bindable;
+ return instance.InternalImageUrl;
+ });
+
/// <summary>
/// LabelOrientationTypeProperty
/// </summary>