PremKumar Shanmugam
PremKumar Shanmugam

Reputation: 441

Image was not loaded sometimes properly from Assets folder in UWP?

I have my OwnControl(userControl).In that control,I have an Image element(RangeSelectionIcon). I had created 3 new object for this UserControl and added this control to my StackPanel in my Page.The image won't be loaded properly to all 3 userControls.Most of the times,the image loaded for only one control and the other two was not loaded.The image path was also given correctly. I don't know what the issue was ? My complete project link(Source Code)

enter image description here

Upvotes: 0

Views: 188

Answers (1)

Nico Zhu
Nico Zhu

Reputation: 32775

Image was not loaded sometimes properly from Assets folder in UWP?

We can reproduce your problem, it looks SvgImageSource was not rendered correctly. for this scenario, we have a workaround that RasterizePixel and re-rendered svg. during the testing, it could work well, please refer the following code.

<Style x:Key="RangeSelectionIconStyle" TargetType="Image">
    <Setter Property="Width" Value="20" />
    <Setter Property="Height" Value="20" />
    <Setter Property="Margin" Value="6,5,6,0" />
    <Setter Property="Source">
        <Setter.Value>
            <SvgImageSource
                RasterizePixelHeight="20"
                RasterizePixelWidth="20"
                UriSource="ms-appx:///Assets/SelectRange.svg" />
        </Setter.Value>
    </Setter>
</Style>

Upvotes: 1

Related Questions