Bug 41012 - I cann't find Xamarin.Color.ToWindowsColor extension function
Summary: I cann't find Xamarin.Color.ToWindowsColor extension function
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.2.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-05-11 07:09 UTC by Jesse Jiang
Modified: 2017-06-12 14:05 UTC (History)
5 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

The classes in Xamarin.Forms.UWP (154.36 KB, image/png)
2016-05-13 00:12 UTC, Jesse Jiang

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Jesse Jiang 2016-05-11 07:09:41 UTC
In UWP I want to covert Color in Xamarin to Windows.UI.Color, but I didn't find out a extension function.

I searched the source code and found that the function was in WinRT, but not UWP

Can you add them to UWP, or you forget to link the WinRT library into UWP?
Comment 1 Paul DiPietro [MSFT] 2016-05-12 16:37:24 UTC
The source file you linked displays an #if directive that will return the UWP namespace if it is the current platform.
Comment 2 Jesse Jiang 2016-05-13 00:12:26 UTC
Created attachment 15992 [details]
The classes in Xamarin.Forms.UWP
Comment 3 Jesse Jiang 2016-05-13 00:15:30 UTC
I didn't find the class in Xamarin.Forms.UWP 2.2
Comment 4 Paul DiPietro [MSFT] 2016-05-13 00:21:57 UTC
That's because the WinRT project also contains functionality in places which cover both UWP and Windows 8.1/WP8.1. That is the UWP version; when the project is compiled using conditional compilation and the #if WINDOWS_UWP line in the code you linked represents that. You can see the method used inside of our own code here: https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.UAP/SearchBarRenderer.cs#L111

You can see similar usage of this this conditional compilation in our own guides (https://developer.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/part_4_-_platform_divergence_abstraction_divergent_implementation/).
Comment 5 Jesse Jiang 2016-05-13 03:31:37 UTC
OK, I found the reason. That is the internal class. 
internal static class ConvertExtensions

Can you do it as public?
Comment 6 georg.haberl 2016-12-13 13:12:19 UTC
second that --> for now i copy pasted the code into my solution, would be nice to not having to use duplicate code because somethings marked as internal.
Comment 7 Stephane Delcroix 2017-06-12 14:05:37 UTC
> Can you do it as public?

no, or at least not now. we might consider opening this in the future though.

this definitely doesn't qualify a s a bug, I'm hence reclining this issue