ToolbarItem is showing a spot instead of image? - xamarin.forms

I'm creating an app using Xamarin and I am trying to add a ToolbarItem with icon, on Android it works fine but on iOS it just show a white spot as can see in the image below and I don't know why it is happening.
How could I fix this ?
ToolbarItem
<ContentPage.ToolbarItems>
<ToolbarItem Icon="icon.png" />
</ContentPage.ToolbarItems>

Toolbar on iOS by default is showing only the colored alpha of the image. If you want to use the colored image you need to specify that the rendering mode of your asset is not default, but rather original.

Related

Why is the Xamarin linear progress bar cut in half when I set a corner radius on Android?

I am using the Syncfusion Xamarin ProgressBar with a corner radius (version 17.4.0.55):
<progressBar:SfLinearProgressBar
HeightRequest="16"
CornerRadius="16"
Progress="75"
ProgressColor="#FFffbe06"
TrackColor="#33ffbe06"
TrackHeight="16" />
On Android the corner radius applies to the middle of the bar in addition to the sides. It appears to cut the progress bar in two.
This problem does not exist on iOS.
I attempted to solve the issue by setting the SegmentCount to "1". But that did not solve the issue.
<progressBar:SfLinearProgressBar
...
SegmentCount="1" />
What do I need to update in my XAML to avoid the middle corner radius?
After review this using Syncfusion's example app, I discovered that there is a difference between running the app in Debug mode and Run mode. Here is an example of both modes:
The top image is in debug mode and you can see the little gap on it. The bottom one is in Run mode and it is a perfect progress bar.
Definitely is something that needs to be reported to Syncfusion as a bug.

Xamarin.Forms: Android picture renderer is basically useless

So, I am trying to achieve the effect as shown in this picture (regarding the party picture)
This is a snap shot from the iOS version of the app simply following this code:
<Image Source="{Binding picture}"/>
So, as you see, all thats needed to show this picture like this is one line of code (on iOS at least).
Cause this is what that will look like on Android:
So, youll see, it renderes it way too tiny, just inside a corner.
To get to (almost) the same results as on the iOS version, I have to alter the code like this:
<Image Source="{Binding picture}"
VerticalOptions="Start"
HorizontalOptions="StartAndExpand"
HeightRequest="171"/>
Giving it height values and so much more stuff, and in the end it still shows slight borders (about a pixel wide) and this is just a terrible solution.
What is the best way of showing the party image just the same as it is on the iOS version just on Android?
Why is Droid rendering the image tiner, not taking up all the space as iOS does?
There is an Aspect attribute inside Image. According to the official document, the default value of the Aspect attribute is AspectFit. You can auto-fill by setting the Aspect property to AspectFill. Here is the official document(https://learn.microsoft.com/en-us/dotnet/api/xamarin.forms.aspect?view=xamarin-forms)

Xamarins Forms UWP App Images on scaled display

I have a laptop with a 4k display. The display properties are set to 3840 X 2160 (Recommended) for the resolution and the scale factor is set to 250% again, the recommended value. I have images in my project scaled with the following suffixes:
.scale-100.png
.scale-150.png
.scale-200.png
.scale-250.png
.scale-300.png
.scale-350.png
.scale-400.png
based on the documentation I found.
When I run the app, the images show up huge and throw the rest of the display off. Below is a screen shot:
if I set the scale to 100% - everything is tiny, but the images are correct. Here is a screen shot.
any idea how to fix this?
Derive from official document.
UWP image file names can be suffixed with .scale-xxx before the file extension, where xxx is the percentage of scaling applied to the asset, e.g. myimage.scale-200.png. Images can then be referred to in code or XAML without the scale modifier, e.g. just myimage.png. The platform will select the nearest appropriate asset scale based on the display's current DPI.
From your screen, it looks get the correct scale image, but your image control has been scale, Please try to set Aspect property as Fill for image control.
set the size on platform specific
OnPlatform is used to set specific value for each platform. For example
<StackLayout>
<StackLayout.Margin>
<OnPlatform x:TypeArguments="Thickness">
<On Platform="iOS" Value="0,20,0,0" />
<On Platform="Android, UWP" Value="0,0,0,0" />
</OnPlatform>
</StackLayout.Margin>
...
</StackLayout>
You could specific StackLayout margin for each platform like code above.

How to remove blue from xamarin applications?

I'm practicing developing xamarin mobile app and when testo on my mobile phone gets a blue color on the top bar of the mobile and also as the app's default color. How to remove and change this color that is pre-defined when we create the project?
![image 1]https://scontent.fcpq5-1.fna.fbcdn.net/v/t1.0-9/50785265_174384576870086_2929460891814461440_n.jpg?_nc_cat=104&_nc_oc=AQkMQTbG9_i30yPV9T1SPPzac_jrsSUfExG5oKNNzD9OhmtoInI_IuNuVm55h4SE2XE&_nc_ht=scontent.fcpq5-1.fna&oh=dd90bb45569614f610755c7c4016be59&oe=5CBEE11D
![image 2]https://scontent.fcpq5-1.fna.fbcdn.net/v/t1.0-9/50692571_174384606870083_9113792680806055936_n.jpg?_nc_cat=106&_nc_oc=AQlqiLqP4cCcflQuo7Rpn_1gU7BWCiP0BQFqIRJeWjGc_1P1T8z53Y2z2mzleLuKM4E&_nc_ht=scontent.fcpq5-1.fna&oh=027ff4784a251c018cc475d9d1808159&oe=5CFCECE8
I tried changing the BarBackGroundColor property of my TabbedPage and it did not work. The bar has gone black but the blue color remains.
In Android: change the color in the file located in \Resources\values\styles.xml and edit:
<item name="colorPrimaryDark">#00FF00</item>
To the color you desire.

How to disable resize(maximize/minimize) button on Xamarin Forms (UWP)?

Is there any way to disable the resize button on Xamarin Forms (UWP) ? Like the image with red square highlighted in the image above.
Titlebar buttons are something that is controlled by the Windows itself, so you cannot remove it but you have limited control on it, like changing the background color. Further you can make your app to go fullscreen which will make the title bar disappear or you can extend your App in the title bar itself as mentioned in this blog post.

Resources