I have this code and working no issue :
<input:AdvancedEntry Margin="0,10,0,0"
BorderColor="#D9DCDB"
CornerRadius="10"
IconColor="LightGray"
IconImage="icon_lock.png"
IsPassword="True"
Placeholder="{x:Static local:Strings.Password}"
Text="{Binding User.Password}"
TextColor="Black"
TextFontSize="18" />
I need to replace IconImage to this line :
<ffimageloadingsvg:SvgCachedImage WidthRequest="30" HeightRequest="30" Source="resource://AppTest.Resources.ic_lock_24px.svg"/>
It say error and input:AdvancedEntry not supported ffimageloadingsvg I need a solution for that or any hint can help me to achieve this code as well .
Related
i'm triying to make a xaml that can be different in phone and tablet. I have something like this:
<OnIdiom x:TypeArguments="View">
<OnIdiom.Phone>
<ContentView VerticalOptions="CenterAndExpand">
...
<LineEntry x:Name="User" Style="{StaticResource Style1}"/>
...
</ContentView>
</OnIdiom.Phone>
<OnIdiom.Tablet>
<ContentView VerticalOptions="End">
...
<LineEntry x:Name="User" Style="{StaticResource Style2}"/>
...
</ContentView>
</OnIdiom.Tablet>
</OnIdiom>
But can't use the same id name in the codebehind. How can i do? i don't want to use 2 variables (for example userPhone and userTablet), for each platform. Is another way to accomplish that? thx!
Most properties on an object can be altered using OnIdiom or OnPlatform.
<Image Aspect="AspectFit" x:Name="logoImg">
<Image.HeightRequest>
<OnPlatform Default="400" Android="350" />
</Image.HeightRequest>
<Image.IsVisible>
<OnIdiom Default="True" Phone="False" />
</Image.IsVisible>
</Image>
So in your example (not tested)
<ContentView>
<ContentView.VerticalOptions>
<OnIdiom Default="End" Phone="CenterAndExpand" />
<ContentView.VerticalOptions>
</ContentView>
Hopefully this makes sense, as it's quite bizarre to me.
Essentially the problem I have is Font Awesome appears to override certain words with icons which I do not want happening - this is all done in XAML. I only want to use Font Awesome if I'm referencing the unicode directly otherwise I want to see the word I actually type.
I'm not entirely sure how to get around this right now, as any reference I find between Xamarin Forms and Font Awesome online it's generally people struggling to get FA working; which is not my current issue.
<Button Style="{StaticResource FontAwesome}" Text=" Sort By" />
Following the code above, I expect to ONLY see the SortBy icon at the start of my Text property - where I reference the code starting & and ending ;
This works fine - however I also get the same icon when I type "Sort", which I do not want.
EDIT
I've decided to use a Frame to get around this minor issue.
<Frame BackgroundColor="#f99000" HasShadow="False" Margin="5, 10" Padding="10">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="OnSortBy" />
</Frame.GestureRecognizers>
<StackLayout Orientation="Horizontal">
<Label Style="{StaticResource FALIExtendedWhite}" Text="" VerticalTextAlignment="Center" HorizontalOptions="End" />
<Label Text="Sort By" VerticalTextAlignment="Center" HorizontalOptions="CenterAndExpand" TextColor="White" />
</StackLayout>
</Frame>
Hi I am working in shoping app and design like, I have already used tint image:
How I can do that, I I can create a circel like this image
I am not sure why you are not using icons from the resources or get the images from rest api.
This is only needed if you want to create dynamic icons.
If that is the case, use a Frame and put the image on it.
<Frame CornerRadius="15" AbsoluteLayout.LayoutBounds="120, 10, 30, 30" Padding="5" VerticalOptions = "FillAndExpand" HasShadow= "false" BackgroundColor="red" >
<StackLayout Orientation="Vertical" Spacing="0" HorizontalOptions="Center" VerticalOptions="Center">
<Label Text="1" VerticalTextAlignment="Center" HorizontalOptions="Center" />
</StackLayout>
</Frame>
the important thing to note is that , "cornerRadius" should be help the size of "AbsoluteLayout.LayoutBounds" width and size.
to learn more about AbsoluteLayout go here
Use FFImageLoading NuGet Library in your Solution, you can download using link FFImageLoading
Paste Below Code
<ffimageloading:CachedImage HorizontalOptions="Center" VerticalOptions="Center"
WidthRequest="300" HeightRequest="300"
DownsampleToViewSize="true"
Source = "http://loremflickr.com/600/600/nature?filename=simple.jpg">
<ffimageloading:CachedImage.Transformations>
<fftransformations:RoundedTransformation Radius="50"/>
</ffimageloading:CachedImage.Transformations>
</ffimageloading:CachedImage>
I think my code is self explanatory:
<Label Style="{DynamicResource labelStyle}"
HorizontalTextAlignment="End" Text="{Binding message}">
<OnPlatform x:TypeArguments="Color">
<OnPlatform.iOS>
{DynamicResource rightBubbleFontColor}
</OnPlatform.iOS>
<OnPlatform.Android>
{DynamicResource rightBubbleFontColor}
</OnPlatform.Android>
<OnPlatform.Android>
{StaticResource rightBubbleFontColor}
</OnPlatform.Android>
</OnPlatform>
</Label>
I'm trying to dynamically bind a color to the label. Depending on the current platform, it has to be another type of resource (DynamicResource or StaticResource).
I get this exception when trying to build the solution:
System.ArgumentException: An item with the same key has already been added.
UPDATE
I now have this code:
<Label Style="{DynamicResource labelStyle}"
HorizontalTextAlignment="End" Text="{Binding message}">
<Label.TextColor>
<OnPlatform
x:Key="RightBubbleFontColor"
x:TypeArguments="Color"
iOS="{DynamicResource rightBubbleFontColor}"
Android="{DynamicResource rightBubbleFontColor}"
WinPhone="{StaticResource rightBubbleFontColor}">
</OnPlatform>
</Label.TextColor>
</Label>
And I get the following error message:
Object reference not set to an instance of an object.
When I replace the binding to a color it works.
Working example:
<Label Style="{DynamicResource labelStyle}"
HorizontalTextAlignment="End" Text="{Binding message}">
<Label.TextColor>
<OnPlatform
x:Key="RightBubbleFontColor"
x:TypeArguments="Color"
iOS="Red"
Android="Green"
WinPhone="Blue">
</OnPlatform>
</Label.TextColor>
</Label>
So it has to be an issue with the way I'm trying to bind this I guess.
EDIT
Asked a new question to describe the problem better: https://stackoverflow.com/questions/39852888/xamarin-forms-use-dynamicresource-or-staticresource-depending-on-os
You have two <OnPlatform.Android> elements. I'm assuming the last would be <OnPlatform.WinPhone>.
EDITED
Now that you have that fixed, maybe try this for it to actually work?
<OnPlatform
x:Key="BubbleTextColor"
x:TypedArguments="Color"
iOS="{DynamicResource rightBubbleFontColor}"
Android="{DynamicResource rightBubbleFontColor}"
WinPhone="{StaticResource rightBubbleFontColor}" />
Then bind it where necessary.
Not sure if it will work any differently than what you already have, but I guess it's worth a shot.
I'm currently trying to get flip to work with scatterview items, and I'm having some trouble conceptually with it, using a plugin called Thriple (http://thriple.codeplex.com/).
Essentially, a 2 sided thriple control looks like this:
<thriple:ContentControl3D
xmlns:thriple="http://thriple.codeplex.com/"
Background="LightBlue"
BorderBrush="Black"
BorderThickness="2"
MaxWidth="200" MaxHeight="200"
>
<thriple:ContentControl3D.Content>
<Button
Content="Front Side"
Command="thriple:ContentControl3D.RotateCommand"
Width="100" Height="100"
/>
</thriple:ContentControl3D.Content>
<thriple:ContentControl3D.BackContent>
<Button
Content="Back Side"
Command="thriple:ContentControl3D.RotateCommand"
Width="100" Height="100"
/>
</thriple:ContentControl3D.BackContent>
</thriple:ContentControl3D>
What I'm struggling to grasp is if I should be making 2 separate ScatterView templates to bind to the data I want, and then each one would be the "front" and "back" of a scatterview item OR should i make 2 separate ScatterView items which are bound to the data I want, which is then bound to the "back" and "front" of a main ScatterView item?
If there is a better way of using doing flip animations with ScatterViewItem's, that'd be cool too!
Thanks!
I would create two separate templates for the data. To the user, it is still the same scatterviewitem (with two sides) so having them as two separate items makes little sense. You can specify which templates to use for front vs back in the properties of the ContentControl3D class. (They are of type DataTemplate)
Code-wise, it'd look something like this:
<thriple:ContentControl3D
xmlns:thriple="http://thriple.codeplex.com/"
Background="LightBlue"
BorderBrush="Black"
BorderThickness="2"
MaxWidth="200" MaxHeight="200"
Content="{Binding MyData}"
BackContent="{Binding MyData}"
ContentTemplate="{StaticResource MyFrontTemplate}"
BackContentTemplate="{StaticResource MyBackTemplate}"
/>
You could also just specify the content directly in the declaration of the control (like you have your buttons above) if that makes more sense for you. That saves you from having to create data templates for the content:
<thriple:ContentControl3D
xmlns:thriple="http://thriple.codeplex.com/"
Background="LightBlue"
BorderBrush="Black"
BorderThickness="2"
MaxWidth="200" MaxHeight="200"
>
<thriple:ContentControl3D.Content>
<Grid>
<TextBlock Text="I'm the front" />
<TextBlock Text="{Binding SomeDataProperty}" />
<Button
Content="Flip"
Command="thriple:ContentControl3D.RotateCommand"
Width="100" Height="100"
/>
</Grid>
<thriple:ContentControl3D.BackContent>
<Grid>
<TextBlock Text="I'm the back" />
<TextBlock Text="{Binding SomeOtherDataProperty}" />
<Button
Content="Flip"
Command="thriple:ContentControl3D.RotateCommand"
Width="100" Height="100"
/>
</Grid>
</thriple:ContentControl3D.BackContent>
</thriple:ContentControl3D>