Can I use standard icons from Windows Phone in a ToolbarItem? - xamarin

I have a Xamarin Forms page with a toolbar item like this:
<ToolbarItem Name="Cancel">
<ToolbarItem.Icon>
<OnPlatform x:TypeArguments="FileImageSource" WinPhone="button_cancel.png" />
</ToolbarItem.Icon>
</ToolbarItem>
This is using a bitmap for showing a cancel icon in Windows Phone. But in Windows Phone there is already predefined icons like this (in the Segoe UI Symbol font). Can I use them instead of bitmaps?

You can make a custom renderer for a NavigationPage which then replaces normal images sources to the native one while using custom fonts. More here (examples are for Android and iOS but should be easily adopted to Windows too: https://forums.xamarin.com/discussion/17278/custom-font-in-xamarin-forms-font-awesome/p1

Related

Is it possible to view content of page renderer within xaml viewer

I am using Xamarin Forms as a primary framework, and I rely heavily on visual studio Xaml viewer. It came that I must use Page Renderers to get some native controls from Xamarin.iOS.
Is there anyway to display the native controls in Xaml viewer? What is the best way to design the native UI components within Xamarin?
Is there anyway to display the native controls in Xaml viewer?
Unfortunately , native controls can not display in Xaml Viewer.
What is the best way to design the native UI components within Xamarin?
If want to show native control in Viewer in IOS, just using IOS designer may be the best way to see native viewer, however this is not total viewer in Xaml Viewer.You also can just see part view in Xaml,so this also has a little regret.

Xamarin Forms - Status bar overlaps the content in IOS (safeareainsets issue)

In Xamarin Forms, I am using
<ContentPage
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
ios:Page.UseSafeArea="true" >
to make the Application UI compatible with iPhone X, but its working only in iOS 11. Anyone have a suggestion on how to make this work on all iOS devices?
The concept of the safe area is exclusive to iPhone X, hence to iOS 11+. Anyway, per default an app uses the whole phones screen (as opposed to Android), hence, if the status bar is shown (you can hide it if you need, but that's another story), your app will overlap it.
Xamarin.Forms NavigationPage will automatically adapt to the available area (others maybe too), but if you are using a bare ContentPage for example, you'll have to take care of by yourself.
To handle things differently on different platforms, there is the OnPlatform tag in XAML (see here). With that you can add a platform-dependent padding to your ContentPage
<ContentPage.Padding>
<OnPlatform x:TypeArguments="Thickness">
<On Platform="iOS" Value="0,20,0,0" />
</OnPlatform>
</ContentPage.Padding>
which will prevent your page overlapping the status bar.

Xamarin Forms NavigationPage Icon Sizes

I'm trying to create a navigation bar for my Xamarin Forms app. I'm adding some primary ToolbarItems which will have an icon associated with them using the following syntax:
ToolbarItems.Add(new ToolbarItem("Search", "ic_action_search.png", ActionSearch, ToolbarItemOrder.Primary));
I've searched everywhere but I cannot find the recommended images sizes for each platform (Android, iOS, UWP, Windows, and WinPhone).
Does anyone know what they should be?
A google search for "recommended tool bar icon sizes [Android|iOS|UWP] was very useful here.
iOS:
https://developer.apple.com/ios/human-interface-guidelines/graphics/custom-icons/
Android:
https://developer.android.com/guide/practices/ui_guidelines/icon_design_action_bar.html
UWP:
https://msdn.microsoft.com/en-us/windows/uwp/controls-and-patterns/tiles-and-notifications-app-assets
No good chart that I found for UWP as it is quite a bit more complex due to support of Tablets, Phones, and Desktop, but the needed info is in the guide above.

Include font icons in Application Bar of Windows Phone 8 Silverlight App

Is there any way to include font icons instead of in the Application bar of windows phone 8 silverlight app. This is to reduce the space to store images required for ApplicationBar.
Nope, sorry. You can use icon fonts for the AppBar in WP 8.1 XAML apps, but not 8.x SL apps.
Having said that, images are not going to affect the space all that much, esp if you use the icons from modernuiicons.com.
HTH
You can't use fonts directly, but Syncfusion have a free tool called Metro Studio that will allow you to easily generate AppBar icons from fonts.

Is it possible use camera inside from a xaml page?

I was wondering if it's possible open camera inside a small piece of screen from a custom xaml page. I'm not sure if WP7 API support stuff like that.
Version: Windows Phone 7.5 Mango
You can use the camera as a live source of image data in your application. This is well documented in the Code Samples for Windows Phone MSDN page. The demo code produces a simple application as follows:
You simply create a brush in XAML:
<VideoBrush x:Name="viewfinderBrush" />
And wire it up to your camera in code-behind:
viewfinderBrush.SetSource(cam);

Resources