Xamarin.forms: Feature Request - Default Search Directory for UWP Icons (Platform Specific)

Created on 6 Jul 2018  Â·  4Comments  Â·  Source: xamarin/Xamarin.Forms

I would really like to put all of my icons/images inside of the Assets folder, however this creates some not so great looking code:

<Image>
                <Image.Source>
                    <OnPlatform x:TypeArguments="ImageSource">
                        <On Platform="iOS" Value="icon_twitter.png"/>
                        <On Platform="Android" Value="icon_twitter.png"/>
                        <On Platform="UWP" Value="Assets/icon_twitter.png"/>
                    </OnPlatform>
                </Image.Source>
            </Image>

Ideally I would like to do:

<Image Source="icon_twitter.png"/>

I could do this if I put it into the UWP root, but that clutters up the project if it is large.

I would like something like:

On<UWP>().SetImageSearchDirectory("Assets");

Then my nice pretty Image would work.

F100 help wanted in-progress inactive UWP enhancement âž• up-for-grabs

All 4 comments

related to #2235

I loved the idea. I have sent PR.
I have created Platform Specific at the Application level.

Example:
On<UWP>().SetImageSearchDirectory("Assets");

Guys, applying this I have a doubt, would a Platform Specific to avoid the extension of the image in UWP (as in Android, iOS) be interesting?

Sure, it would be also great to have it for wpf.

Was this page helpful?
0 / 5 - 0 ratings