File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
dev/DevWinUI.Controls/Controls/Composition Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -171,15 +171,15 @@ private void OnColorShadowPaddingChanged()
171171 /// ImageUri Dependency Property
172172 /// </summary>
173173 public static readonly DependencyProperty ImageUriProperty =
174- DependencyProperty . Register ( nameof ( ImageUri ) , typeof ( Uri ) , typeof ( ColorShadow ) ,
174+ DependencyProperty . Register ( nameof ( ImageUri ) , typeof ( object ) , typeof ( ColorShadow ) ,
175175 new PropertyMetadata ( null , OnImageUriChanged ) ) ;
176176
177177 /// <summary>
178178 /// Gets or sets the Uri of the image to be displayed with its ColorShadow.
179179 /// </summary>
180- public Uri ImageUri
180+ public object ImageUri
181181 {
182- get => ( Uri ) GetValue ( ImageUriProperty ) ;
182+ get => ( object ) GetValue ( ImageUriProperty ) ;
183183 set => SetValue ( ImageUriProperty , value ) ;
184184 }
185185
@@ -191,7 +191,19 @@ public Uri ImageUri
191191 private static async void OnImageUriChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
192192 {
193193 var target = ( ColorShadow ) d ;
194- await target . OnImageUriChangedAsync ( e . NewValue as Uri ) ;
194+ Uri uri = null ;
195+
196+ switch ( e . NewValue )
197+ {
198+ case Uri u :
199+ uri = u ;
200+ break ;
201+
202+ case string s when Uri . TryCreate ( s , UriKind . RelativeOrAbsolute , out var uriFromString ) :
203+ uri = uriFromString ;
204+ break ;
205+ }
206+ await target . OnImageUriChangedAsync ( uri ) ;
195207 }
196208
197209 /// <summary>
You can’t perform that action at this time.
0 commit comments