Xamarin.Forms Pattern image repeat to fill the background - xamarin

I have a simple question: in Xamarin Forms is possible to set a image to fill the background of the page?
This is my ContentPage:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Facedoor"
x:Class="Facedoor.LoginPage"
BackgroundImage="pattern-background.png">
The image is a small texture, and I would like to fill the background to repeat it. Is possible?

Related

Is it the good way to use Margin/Padding in Xamarin Forms XAML? Or increase the transparent surface of image not using margin and padding?

Is it good to use margin/padding to align the position of CachedImage in XAML Xamarin Forms? Or any other preferable/good way to align it so that it can stay consistant to all devices screens?
Like for example:
There are plenty of options, which to use will depend on the rest of your layout. Anyway, increasing the transparent area of the image will not port very well, because of different screen-sizes and -ratios.
Learn about layouts in Xamarin.Forms, it will help you much. On way to center (or otherways align) an image would be to use an AbsoluteLayout (see here)
<AbsoluteLayout HorizontalOptions="Fill" VerticalOptions="Fill">
<Image Source="whatever.png"
AbsoluteLayout.LayoutFlags="PositionProportional"
AbsoluteLayout.LayoutBounds=".5,.5,-1,-1" />
</AbsoluteLayout>
AbsoluteLayout.LayoutBounds=".5,.5,-1,-1" sets the position of the Image to centered, while the size is retained.

UWP - Zoom Image and scrollbar

I have write a simple code in XAML for zoom an Image
<Grid Grid.Row="1" Background="AliceBlue" Margin="10,10,10,10" Name="Griglia_Immagine">
<ScrollViewer Name="MyScrollViewer" MinZoomFactor="1" ZoomMode="Enabled">
<Image Name="Imm_Visualizzata" Source="Assets/Test.jpg" >
</ScrollViewer>
</Grid>
When i zoom the image it became more big.
On my right i can see the vertical scrool bar but i don't see the Horizontal one.
So... where the image is big i can move Up-Down ...but if i move left-right the image where i leave my finger the image return on left border.
I'had tried to set HorizontalScrollBarVisibility and VerticalScrollBarVisibility ...
If i set both to Hidden the start image is very big (original format) If i set both to Disabled the zoom not work.
If i set One on Hidden and one on Disabled the zomm work but i can move the image only vertival or horizontal... where i had set the Hidden value..
Anyone had solved it ?
Thanks

Add overlay color to an image using Xamarin.Forms

I'd like to add some icons in my app especially in listviews using custom cell and specify the color to be rendered.
I don't want to edit each image in Photoshop; I want to apply an overlay color at runtime.
Is that possible with a custom renderer?
No it is not possible through standard Image class provided in Xamarin.Forms.
But you can use this amazing IconView custom renderer created by this guy. I use it all the time it is amazing.
IconView for Xamarin Forms
Usage
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IconApp.MyPage"
xmlns:controls="clr-namespace:IconApp;assembly=IconApp">
<controls:IconView Source="monkey"
Foreground="Red"
WidthRequest="100"
HeightRequest="100"
HorizontalOptions="Center"
VerticalOptions="Center" />
</ContentPage>
Just specify the Foreground="Red" property color
Now We got another way with Xamarin.CommunityToolkit. We can use its IconTintColorEffect.TintColor for changing Tint Color or Overlay of an Image.
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
x:Class="MyLittleApp.MainPage">
<StackLayout>
<Image Source="monkey" xct:IconTintColorEffect.TintColor="Red" />
</StackLayout>
</ContentPage>
Xamarin.CommunityToolkit is handy and provides lot of features such as Shadows on any View, EventToCommandBehavior for MVVMifying lot of Events and Controls, it also has additional Converters, Extensions, Helpers, and Views that are not available in builtin Xamarin Forms yet.
Refer for more Documentation

WP7 LongListSelector : Color of the semi-transparent background

There is any way to change the background color of the mask semi-transparent shown when you tap on header made by a LongListSelector?
You can add a custom GropItemsPanel Template. It covers the screen.
<toolkit:LongListSelector ItemsSource="{Binding Shows}" GroupItemsPanel="{StaticResource LongListItemsPanelTemplateCustom}" ></toolkit:LongListSelector>
<ItemsPanelTemplate x:Key="LongListItemsPanelTemplateCustom"><StackPanel Background="Red"/></ItemsPanelTemplate>

XAML Usercontrol Image stretch to available size

I have an image as a drawing brush in xaml. The only property set is Stretch, which is set to Uniform.
The image is then set to the background of a usercontrol which has no properties set with regards to size.
The usercontrol is then used within a a grid, and set to span 2 rows like so:
<common:Logo
Height="130"
Width="500"
Grid.Column="0"
Grid.Row="0"
Grid.RowSpan="2"
HorizontalAlignment="Left"
/>
The problem is that there is loads of white space on top and below the image, which is also quite small.
The image started as a vector graphic and has no space above or below.
When I view the usercontrol with sizes set, it fits perfectly with no white space.
I am hoping this is not a problem with the grid reporting an incorrect size.
Any ideas would be appreciated!
Visual Studio was not refreshing any of the changes, running the code and reviewing what was produced fixed the whole problem!

Resources