I am developing custom renderer for android and using LayerDrawable.SetLayerInsetRight
method and works fine but that method is added in API level 23 and I am wondering what is equivalent to it in versions before 23?
What is equivalent to LayerDrawable.SetLayerInsetRight in versions before 23?
Cache used by FFImageLoading and Xamarin.Forms.Image/UriImageSource?
In my project I need to use both FFImageLoading and Xamarin.froms.Image since I am using Mr.Gestures (And that is available only for Xamarin.forms as far as I know). On the start of the app I would like to store all images that will be used in cache.
Will I have to instantiate both a CachedImage and a Xamarin.Froms.Image like this:
uriImageSource.Uri = new Uri(imageUrl); Xamarin.Forms.Image image.Source = uriImageSource; // ensuring image is truly downloaded. FFImageLoading.Forms.CachedImage cachedImage = new FFImageLoading.Forms.CachedImage() { Source = imageUrl};
...To download the images to respective cache. Or would it be enough to download it once - with a Xamarin.Forms.Image, or cacheImage. Can FFImageLoading cachedImage load an image that was downloaded to cache by UriImageSource (and vice versa). The images are needed to be displayed anywhere both with CachedImage and Xamarin.Forms.Image.
On a side not I also wonder about the first line - setting a UriImageSource object to url - if is enough to download the image? Or if it also has to be set to an image object (second line) as well to be downloaded.
why should we use OpenJdk? Slow?
I recently changed from java jdk to open jdk. I dont know even the reason why should i do it but just wanted to try. debugging became very slow for me. Is there any good reason why we should use open jdk instead java jdk? Does anyone else experience slow debugging?
Lorem Ipsum when a new archive is made
Whenever i create a new archive my app i get lorem ipsum text in comment section. when i close visual studio for mac ,then it is gone.
- Why i am getting lorum ipsum text on first time?
- Is there a place to provide something meaningful for each build in this comment section?
- is it a bug in vs that on first time i am getting some random text while after restart it is gone?
How to resolve Localisation Exception Sequence contains no matching element
Hi,
I wanted do localisation for 3 language i.e English (UK), Chineese, Portuguese .Its working for chineese and Portuguese ,when i click on English (UK) it shows Exception like "Sequence contains no matching element" Please help.What can be done
Setting culture in app causing serialization error at API level
My mobile language(culture) is set to NL in which decimal values are represented with "," rather than " ."
Am sending some decimal values to API which are calculated in backend and on confirming are set to usual decima values i.e 0.434 etc .
However the APi returns me the response
{"ResponseStatus":{"ErrorCode":"SerializationException","Message":"Unable to bind to request 'Report'","Errors":[{"ErrorCode":"SerializationException","FieldName":"AverageAccelerationUp","Message":"'0,000' is an Invalid value for 'AverageAccelerationUp'"},{"ErrorCode":"SerializationException","FieldName":"ObservedNominalSpeedUp","Message":"'0,000' is an Invalid value for 'ObservedNominalSpeedUp'"},{"ErrorCode":"SerializationException","FieldName":"DoorOpeningTime","Message":"'0,8' is an Invalid value for 'DoorOpeningTime'"}]}}
Works fine whien the culture is set to en
UWP ToolbarItem TextColor
Hi
I have a Xamarin.Forms app targeting iOS, Android and UWP. When I add some toolbaritems (secondary) and start the UWP on my Windows10 machine. The menu appears (when I cklick on the 3-dots-button), but the text is in white color.
This is because my ApplicationBar (with the title) has a blue background color and a white text.
I know, I can't change the color directly on the toolbaritem. But I thought about a renderer...
But how? Can anybody help me out?
My Renderer:
public class UwpBasePageRenderer : PageRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
{
base.OnElementChanged(e);
if (e.OldElement != null || Element == null) return;
Loaded += OnLoaded;
}
private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
{
var mypanel = ContainerElement as Panel;
// Something like this...
// mypanel.ApplicationBar.TextColor = Black;
}
}
How to create shared frame layout to reuse it in other xaml pages!
I want to create a shared control to use this structure of frame inside my other xaml files:
<Frame
Padding="1"
BackgroundColor="Black
CornerRadius="7"
HasShadow="False">
<Frame
Margin="2"
Padding="5"
BackgroundColor="White"
CornerRadius="5"
HasShadow="False">
</Frame>
//My Other xaml control goes here.
</Frame
My doubt is how i can create this structure of frames in seperate xaml file to reuse it other xaml files!!
Xamarin Forms Listview Example
I am fairly new to xamarin and I am trying to create a list view, using xamarin forms and mvvmcross.
I am trying to follow a tutorial I found online, I can't give the link yet.
This gave an error because he, set the binding context to his viewmodel.
But my viewmodel has parameters, I used a prebuilt template, and I can't pass them from the page code.
His code:
public partial class CarsPage : ContentPage {
public CarsPage() {
InitializeComponent();
// Connecting context of this page to the our View Model class
BindingContext = new CarsViewModel(); // it crashes on this line in my code.
}
}
My viewmodel code:
private MvxObservableCollection<VoorwerpItem> voorwerpen;
public MvxObservableCollection<VoorwerpItem> Voorwerpen
{
get { return Voorwerpen; }
set
{
Voorwerpen = value;
}
}
public MainViewModel(IMvxNavigationService navigationService, IMvxLogProvider mvxLogProvider, Services.IAppSettings settings, IUserDialogs userDialogs)
{
this.navigationService = navigationService;
this.mvxLogProvider = mvxLogProvider;
this.settings = settings;
this.userDialogs = userDialogs;
this.log = mvxLogProvider.GetLogFor(GetType());
Voorwerpen = new MvxObservableCollection<VoorwerpItem>()
{
new VoorwerpItem() { Name = "Fiets E", Type = "fiets" }
};
}
I have search a lot online trying to find a example of a listview with forms and mvvmcross that works.
However I have been unsuccesfull so far.
How can I have a listview with mvvmcross?
Any example or derication is much appreciated.
I am sorry for not being able to give an better question.
Persisting data locally (Device cache)
Hi,
Is there a way how you can persist some trivial data locally, such as personId or cartvalue so that when the app is switched off, the value can be retrieved again?
I have been playing around with Application.Current.Properties ["ProfileId"] but the value is lost once the application is closed.
Thanks
Shaun
How to make a multi-steps registration page with multi ContentView?
In the app I'm working on, there's a multi-steps registration, 4 steps:
to accomplish it, I'm thinking to have a single page to host a content view of the registration step, when it passes the validation requirements I remove it and inject the next content view.
This is an example to simplify my need:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:XamApp"
x:Class="XamApp.MainPage">
<StackLayout>
<local:Register1/>
</StackLayout>
</ContentPage>
and the Register1 looks like this:
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:XamApp"
x:Class="XamApp.Register1">
<ContentView.Resources>
<ResourceDictionary>
<local:IntToBoolConverter x:Key="intToBool"/>
</ResourceDictionary>
</ContentView.Resources>
<ContentView.Content>
<StackLayout>
<Label Text="Page 1" FontSize="Large"/>
<Entry x:Name="txtName" Placeholder="Name"/>
<Button Text="Next" IsEnabled="{Binding Source={x:Reference txtName},
Path=Text.Length,
Converter={StaticResource intToBool}}"
Clicked="Button_Clicked"/>
</StackLayout>
</ContentView.Content>
</ContentView>
There are two problems:
1- I don't know how to handle the data (view model) between steps, to have only one object through all steps (Shall I use DI? if yes , then how in MVVMLight?)
2- How to to inject the content view into the main registration page dynamically in an MVVM fashion ?
Generate token from credit card Stripe.Net
Since Stripe.Net
doesn't work anymore in the PCL side, we need to use DependencyServices<>
. However, when I'm trying to generate a token from credit card information, it seems like... It's missing in the doc, I just can't find anything on the web or in the doc, is that normal?
I would like to achieve something like that :
public string CardToToken()
{
var card = new Card()
{
Number = "4242424242424242",
ExpiryMonth = 12,
ExpiryYear = 16,
CVC = 123
};
try
{
token = await Stripe.CreateToken(card);
}
catch (Exception ex)
{
return null;
}
return token;
}
So then I can just simply send it to my server. Any idea to achieve something that easy? That's the last point I need to finish for my project...
This example is in my Android side.
Thank for any help...
Learning Resources for MVVMLight with Xamarin.Forms?
I'm looking for good resources and documentation for using MVVMLight with Xamaring.Forms, but I'm struggling, there're few of them and they don't fill the gab and the official web site seems outdated. We are already using it in our projects, but there's a mess in the code due to the lack of knowledge of how to use MVVMLight and its locator and IoC container. I'm thinking to migrate to MVVM Cross because it has a very nice documentation. but I don't want to take this step before knowing more about the library we already using and I think it's powerful and suit our needs.
any help?
Unable to build any Xamarin.Forms app
For a few days I cannot build anymore. Even a new empty Forms project (the one that displays « Welcome to Xamarin.Forms! ») displays the LaunchScreen.storyboard tab and 3 error messages:
ibtoold[8369:648873] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[SimServiceContext serviceContextForDeveloperDir]: unrecognized selector sent to class 0x11396dc00'
It looks like this has begun after Xcode 10.0 was installed on my Mac (High Sierra 10.13.6, no pending update in the AppStore). I use Visual Studio Community 7.6.6 (build 17), no pending update in the stable channel. I cannot work anymore.
Any idea how to progress?
Button text inside a Grouped Listview header is not binding to group property.
Hi I am trying to dynamically changed the button text inside Groupheader in GroupListview but its always empty. Below is the code snippet.
<Button Grid.Row="0" Grid.Column="3" Text="{Binding **ButonText**}" WidthRequest="175"
BackgroundColor="White"
Command="{Binding AddImages}"
CommandParameter="{Binding Source={x:Reference Item}, Path=BindingContext}"
BindingContext="{Binding Source={x:Reference GroupedView},Path=BindingContext}" />
But when i remove the binding Context from Button than Text is displayed properly but than Command does not work.
Thanks in Advance.
Is there any nuget for Rounded Entry Borders in Xamarin Forms ?
I tried all the tutorials with custom renderer and I always have errors like constructor is version 2.5 etc ... Is there any other way to do rounded entry borders ?
How to get rid of Hamburger icon
I have been revisiting one of my old Xamarin apps and I noticed the hamburger icon appear on the bottom navigation bar.
Does anyone know how to get rid of this?
Xamarin.Forms iOS Build Failure
Have a Xamarin.Forms project with net standard 2 XF assembly driving UWP and iOS apps. Running XF v3.4.0.1008975 on Visual Studio Community 2017 15.9.4 on the latest Windows 10. Mac that is performing the build is running Mojave 10.14.1 and Visual Studio Mac 7.7.2 (Build 21).
UWP application builds and runs with no problems. iOS build was running without any problems up to about two weeks ago.
Now the iOS build throws out several MT0136 warnings for assemblies that are referenced by the net standard assembly and then crashes out with MT2001 that tells me that encountered an error while processing references of the net standard 2 assembly. This is after the detection of the signing identity output and the linker setting is do not link (debug mode).
Any guidance is greatly appreciated. Note that I already tried common approaches involving deleting bin/obj directories and mac build cache cleanup.
Which version of NDK should we use? not latest?
I was told that we should always use the version NDK according to below
https://github.com/xamarin/xamarin-android/blob/master/build-tools/android-toolchain/android-toolchain.projitems
as it seems 14b version is used, we can use highest 14b? which is from march 2017, pretty old. why is it? I tried used 18b today latest version and my project works fine in debug mode and compiles also fine in release mode. Problem occurs when i want to install the app in release more or try to create a package. I get this exception
Error XA5101: C compiler for target Arm was not found. Tried paths:
"C:\Android\android-ndk-r18b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-gcc.exe;
C:\Android\android-ndk-r18b\prebuilt\windows-x86_64\bin\gcc"
So, can someone confirm from xamarin team if we can rely on android-toolchain.projitems file or we can simply use latest NDK, maybe my exception is something else?
What is equivalent to Android.Widget.ListView.NestedScrollingEnabled in versions before 21?
I am developing custom renderer for android to enable the nested scrolling for a ListView
and I'm using Android.Widget.ListView.NestedScrollingEnabled
attribute and it works fine but that attribute is added in API level 21 and I am wondering what is equivalent to it in versions before 21?