I'm trying to figure out how close we can get to to this list view as far as interactivity (nested grouped list views)
Would this list view be possible with out of the box Xamarin Forms?
Tap on a item in a listview and open new page
So i have a list view like so:
<ListView x:Name="curso" ItemSelected="CursoView_ItemSelected" SelectedItem="{Binding SelectedItem}" HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout Orientation="Horizontal">
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
<Label StyleClass="Header" Text="{Binding name}" />
</StackLayout>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
This list view is populated by a info from a webserver. For now it was 3 itens and i want to when a user taps on one item it opens a page related to that item. How can i do that in the codebehind?
XF native embedding - What is the syntax to tell an Android Fragment to MATCH_PARENT?
Xamarin.Forms PCL project.
ContentPage
has an Android Fragment
on it using Native Embedding.
I think the fragment is technically working, in that the native engine initialization callback responds with ERROR.NONE, and I can use the API calls that get initialized when the fragment initializes.
The problem is that the fragment has a size of 0,0.
I can set the container size. I cannot for the life of me find any documentation in any of the Xamarin write-ups on how to set the LayoutParameters
of the fragment
to MATCH_PARENT
so it will expand to fit its container.
There's some limited examples of sending x:Arguments
, but I'm just guessing in the dark about DataType and parameter casing. The permutations are almost endless.
Per examples: The native MapFragment
has been subclassed to "NokiaMapView in order to call
Initialize(), create Android
Listeners, subscribe to callbacks etc. So
NokiaMapView` in the example below is a fragment derived from the native fragment; as shown then the available tutorials.
This is just a small sampling of my attempts. I have a huge amount of commented markup with various combinations and permutations of attempts that all fail at runtime with errors same or similar to the commented error here.
<views:View x:Name="mapWrap" x:Arguments="{x:Static androidForms:Forms.Context}">
<androidLocal:NokiaMapView x:Arguments="{x:Static androidForms:Forms.Context}">
<!--<androidLocal:NokiaMapView.Layoutparameters>
<x:Arguments>
<androidForms:Layoutparameters>MATCH_PARENT</androidForms:Layoutparameters>
</x:Arguments>
</androidLocal:NokiaMapView.Layoutparameters>-->
</androidLocal:NokiaMapView>
</views:View>
<!-- 06-23 15:04:21.095 I/MonoDroid(23792): Xamarin.Forms.Xaml.XamlParseException: Position 273:25.
Cannot assign property "LayoutParameters": Property does not exists, or is not assignable, or mismatching type between value and property -->
@DavidOrtinau @JamesMontemagno @PierceBoggan
You've each written a tutorial or article on behalf of Xamarin for this new ability of embedding native elements in a PCL ContentPage
- Do any of you have a technique, example or input on how to set this vital arguement?
~~~~
*Native Embedding references:
https://developer.xamarin.com/guides/xamarin-forms/user-interface/native-views/
https://blog.xamarin.com/adding-bindable-native-views-directly-to-xaml/
https://developer.xamarin.com/guides/xamarin-forms/user-interface/layouts/add-platform-controls/
https://blog.xamarin.com/unleashed-embedding-xamarin-forms-in-xamarin-native/
Navigation fails after ADAL authentication in xamarin forms in IOS
Hi,
I have implemented ADAL authentication in Xamarin forms and is working fine in android but in IOS the authentication works fine but after authentication there is a line of code to navigate to a new page and this navigation does not work and the app shows the ADAL sign in page again. PFB the code snippet.
In Android the navigation works fine. Any thoughts on what the issue is?
protected override void OnAppearing()
{
base.OnAppearing();
this.Authenticate();
}
private async void Authenticate()
{
try
{
var data = await DependencyService.Get<IAuthenticator>().Authenticate(App.tenanturl, App.ResourceUri, App.ApplicationID, App.ReturnUri);
App.AuthenticationResult = data;
NavigateTopage(data);
}
catch (Exception) { }
}
public async void NavigateTopage(AuthenticationResult data)
{
await Navigation.PushModalAsync(new HomePage());
}
C# equivalent of XAML X:Name
I have been using x:Name to create ui elements with unique identifiers for me to be able to easily locate then in c# in a 'code behind' manner. So far this has server all purposes I could ever need, Until I had to create ui elements dynamically which will be created in c#.
The only problem is I do not have a way or know how to give ui elements created using C# a unique name which can be used the Content.FindByName<>() method.
The closest thing I've seen is the ui.Id but thats a Guid Readonly, ClassId and StyleId which I have no idea what they are used for.
Two UI questions (Tab labels and Tableview section styling)
Dear all,
See attached screenshot. I created this app in Xamarin.Forms and i'm now finetuning the UI. I got stuck on two issues.
- How can i remove the labels under the icons?
- How can modify the color of tableview section headers (label and line) (i want them to change from pink into dark grey).
Thanks,
Ben
How to resolve 'could not initialize an instance of the type uikit.uiimage error in tabbed page.
Hi every one, I am very struggle to fix this strange issue. In my application using tabbed page with icons but when try to build getting "could not initialize an instance of the type uikit.uiimage : The native initwith contentsofFile' exception. From last three months it's working fine. last day on wards it's getting build issue. please suggest any idea to fix this. Thanks in advance.
OnApearing not getting called when iOS app returns from background.
Hi,
I have implemented push notification in my xamarin ios project using firebase, i am able to receive notification in the app but when app is is background and notification is tapped it opens the app but doesnt refresh the listview (i have code for refreshing the listview in onApearing method of the page in my plc).
everything works perfectly fine when app is not running in the background, when tapped on the notification it app opens and calls onApearing hence refreshing the listview.
Please help to resolve this issue.
Thanks in advance,
Amey Sawant
Master Detail Page
Hello,
Well I am a beginner on Xamarin platform. I created a demo app with just a label which worked fine and executed successfully on UWP.
After adding a Master Details page I am getting few exceptions, one of the critical being is below:
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.ni.dll
Any ideas what I am doing wrong. Further details of the development environment:
Windows 10
Microsoft Visual Studio Enterprise 2015
Version 14.0.24720.00 Update 1
Microsoft .NET Framework
Version 4.6.01586
Xamarin 4.5.0.486 (fec6f88)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Any help in this regard will be appreciated.
Binding a DataTable to a ListView
I am experimenting with binding a collection of objects with an indexer to a ListView. It works well if I use a BindingContext with a “Data” property that is a List or Collection where T is Dictionary<string, object> or a class that I defined with a string indexer (public object this[string i]) and the ListView is defined in XAML as follows:
<ListView x:Name="lstView" ItemsSource="{Binding Data}"><!-- property “Data” of the BindingContext -->
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Label Text="{Binding [Name]}" /><!-- brackets needed when accessing an indexer rather than a property -->
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
On the other hand, if the element of the collection is a row from a DataTable, the application crashes on the binding. With a DataTable instance named “table” with columns named “Id” and “Name”, I tried table.DefaultView (contains instances of the “DataRowView” class), table.Rows (contains instances of the “DataRow” class) as well as collections like List or Collection in the role of the property “Data” of the BindingContext, but the application always crashed, although the classes “DataRowView” and “DataRow” also support the use of a string indexer.
How can this be explained? How can I bind a DataTable to a ListView?
When the application crashes, the Debug Output contains something like this:
05-28 09:29:35.580 I/MonoDroid(16267): UNHANDLED EXCEPTION:
05-28 09:29:35.580 I/MonoDroid(16267): System.Reflection.AmbiguousMatchException: Ambiguous matching in method resolution
05-28 09:29:35.580 I/MonoDroid(16267): at System.Reflection.Binder/Default.SelectProperty (System.Reflection.BindingFlags,System.Reflection.PropertyInfo[],System.Type,System.Type[],System.Reflection.ParameterModifier[])
05-28 09:29:35.580 I/MonoDroid(16267): at System.MonoType.GetPropertyImpl (string,System.Reflection.BindingFlags,System.Reflection.Binder,System.Type,System.Type[],System.Reflection.ParameterModifier[])
05-28 09:29:35.580 I/MonoDroid(16267): at System.Type.GetProperty (string,System.Reflection.BindingFlags)
05-28 09:29:35.580 I/MonoDroid(16267): at System.Reflection.TypeInfo.GetDeclaredProperty (string)
05-28 09:29:35.600 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.VisualElementRenderer1<Xamarin.Forms.ListView>.UpdateLayo05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.ReflectionExtensions.GetProperty (System.Type,string) <IL 0x0000d, 0x0006f> 05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.BindingExpression.SetupPart (System.Type,Xamarin.Forms.BindingExpression/BindingExpressionPart) <IL 0x000f3, 0x0049b> 05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.BindingExpression.Apply (object,Xamarin.Forms.BindableObject,Xamarin.Forms.BindableProperty) <IL 0x0007e, 0x002c7> 05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.Binding.Apply (object,Xamarin.Forms.BindableObject,Xamarin.Forms.BindableProperty) <IL 0x0005e, 0x001ef> 05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.BindableObject.ApplyBindings (object) <IL 0x00035, 0x000ff> 05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject,object) <IL 0x00061, 0x001a3> 05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.Element.OnBindingContextChanged () <IL 0x00018, 0x00097> 05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.Cell.OnBindingContextChanged () <IL 0x00001, 0x0002b> 05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty,Xamarin.Forms.BindableObject/BindablePropertyContext,object,bool,Xamarin.Forms.BindableObject/SetValueFlags,bool) <IL 0x000fa, 0x00455> 05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty,object,Xamarin.Forms.BindableObject/SetValueFlags,Xamarin.Forms.BindableObject/SetValuePrivateFlags) <IL 0x001fc, 0x00897> 05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty,object,bool,bool) <IL 0x00075, 0x0035b> 05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty,object) <IL 0x00005, 0x0004f> 05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.BindableObject.set_BindingContext (object) <IL 0x00007, 0x00037> 05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.TemplatedItemsList
2<Xamarin.Forms.ItemsView1<Xamarin.Forms.Cell>, Xamarin.Forms.Cell>.CreateContent (int,object,bool) <0x00123> 05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.TemplatedItemsList
2<Xamarin.Forms.ItemsView1<Xamarin.Forms.Cell>, Xamarin.Forms.Cell>.GetOrCreateContent (int,object) <0x000eb> 05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.TemplatedItemsList
2<Xamarin.Forms.ItemsView`1<Xamarin.Forms.Cell>, Xamarin.Forms.Cell>.get_Item (int) <0x0006b>
An unhandled exception occured.
05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.ListViewAdapter.GetCellsFromPosition (int,int)
05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.ListViewAdapter.GetCellForPosition (int)
05-28 09:29:35.580 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.ListViewAdapter.GetView (int,Android.Views.View,Android.Views.ViewGroup)
05-28 09:29:35.580 I/MonoDroid(16267): at Android.Widget.BaseAdapter.n_GetView_ILandroid_view_View_Landroid_view_ViewGroup_ (intptr,intptr,int,intptr,intptr) [0x0001a] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Widget.BaseAdapter.cs:509
05-28 09:29:35.580 I/MonoDroid(16267): at (wrapper dynamic-method) object.a71fc324-6f3b-4f36-a613-0f9ca22cdd8f (intptr,intptr,int,intptr,intptr)
05-28 09:29:35.600 I/MonoDroid(16267): UNHANDLED EXCEPTION:
05-28 09:29:35.600 I/MonoDroid(16267): System.Reflection.AmbiguousMatchException: Ambiguous matching in method resolution
05-28 09:29:35.600 I/MonoDroid(16267): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
05-28 09:29:35.600 I/MonoDroid(16267): at Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr,Android.Runtime.JValue) [0x00063] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:571
05-28 09:29:35.600 I/MonoDroid(16267): at Android.Views.ViewGroup.Layout (int,int,int,int) [0x00082] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Views.ViewGroup.cs:3760
05-28 09:29:35.600 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.ViewRenderer2<Xamarin.Forms.ListView, Android.Widget.ListView>.OnLayout (bool,int,int,int,int) <0x0019d> 05-28 09:29:35.600 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.ListViewRenderer.OnLayout (bool,int,int,int,int) <IL 0x00032, 0x000eb> 05-28 09:29:35.600 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) <IL 0x00012, 0x00092> 05-28 09:29:35.600 I/MonoDroid(16267): at (wrapper dynamic-method) object.1cf310b7-c365-4b36-815b-6b108b0346a0 (intptr,intptr,bool,int,int,int,int) <IL 0x0002f, 0x00063> 05-28 09:29:35.600 I/MonoDroid(16267): UNHANDLED EXCEPTION: 05-28 09:29:35.600 I/MonoDroid(16267): System.Reflection.AmbiguousMatchException: Ambiguous matching in method resolution 05-28 09:29:35.600 I/MonoDroid(16267): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x0004b> 05-28 09:29:35.600 I/MonoDroid(16267): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue*) [0x00084] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029 05-28 09:29:35.600 I/MonoDroid(16267): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x0001d] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1036 05-28 09:29:35.600 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.FormsViewGroup.MeasureAndLayout (int,int,int,int,int,int) <IL 0x00160, 0x007f7> 05-28 09:29:35.600 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.VisualElementTracker.UpdateLayout () <IL 0x000c6, 0x0034d> 05-28 09:29:35.600 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.VisualElementRenderer
1<Xamarin.Forms.ListView>.UpdateLayout () <0x0003b>
05-28 09:29:35.600 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.ScrollViewContainer.OnLayout (bool,int,int,int,int)
05-28 09:29:35.600 I/MonoDroid(16267): at Android.Views.ViewGroup.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) [0x00009] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Views.ViewGroup.cs:4041
05-28 09:29:35.600 I/MonoDroid(16267): at (wrapper dynamic-method) object.8464caa9-fe67-42bb-87c7-a9b7d63405ee (intptr,intptr,bool,int,int,int,int)
05-28 09:29:35.600 I/MonoDroid(16267): UNHANDLED EXCEPTION:
05-28 09:29:35.600 I/MonoDroid(16267): System.Reflection.AmbiguousMatchException: Ambiguous matching in method resolution
05-28 09:29:35.600 I/MonoDroid(16267): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
05-28 09:29:35.600 I/MonoDroid(16267): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue) [0x00084] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029
05-28 09:29:35.600 I/MonoDroid(16267): at Android.Widget.FrameLayout.OnLayout (bool,int,int,int,int) [0x000c4] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Widget.FrameLayout.cs:725
05-28 09:29:35.600 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.ScrollViewRenderer.OnLayout (bool,int,int,int,int)
05-28 09:29:35.600 I/MonoDroid(16267): at Android.Widget.FrameLayout.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) [0x00009] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Widget.FrameLayout.cs:703
05-28 09:29:35.600 I/MonoDroid(16267): at (wrapper dynamic-method) object.10339e64-6abf-400d-8cde-f719aa55baf1 (intptr,intptr,bool,int,int,int,int)
05-28 09:29:35.600 I/MonoDroid(16267): UNHANDLED EXCEPTION:
05-28 09:29:35.600 I/MonoDroid(16267): System.Reflection.AmbiguousMatchException: Ambiguous matching in method resolution
05-28 09:29:35.600 I/MonoDroid(16267): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
05-28 09:29:35.600 I/MonoDroid(16267): at Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr,Android.Runtime.JValue*) [0x00063] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:571
05-28 09:29:35.600 I/MonoDroid(16267): at Android.Views.ViewGroup.Layout (int,int,int,int) [0x00082] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Views.ViewGroup.cs:3760
05-28 09:29:35.600 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.VisualElementTracker.UpdateLayout ()
05-28 09:29:35.600 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.ScrollViewRenderer.UpdateLayout ()
05-28 09:29:35.600 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.VisualElementRenderer1<Xamarin.Forms.View>.OnLayout (bool,int,int,int,int) <0x000f7> 05-28 09:29:35.600 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) <IL 0x00012, 0x00092> 05-28 09:29:35.600 I/MonoDroid(16267): at (wrapper dynamic-method) object.1cf310b7-c365-4b36-815b-6b108b0346a0 (intptr,intptr,bool,int,int,int,int) <IL 0x0002f, 0x00063> 05-28 09:29:35.610 I/MonoDroid(16267): UNHANDLED EXCEPTION: 05-28 09:29:35.610 I/MonoDroid(16267): System.Reflection.AmbiguousMatchException: Ambiguous matching in method resolution 05-28 09:29:35.610 I/MonoDroid(16267): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x0004b> 05-28 09:29:35.610 I/MonoDroid(16267): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue*) [0x00084] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029 05-28 09:29:35.610 I/MonoDroid(16267): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x0001d] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1036 05-28 09:29:35.610 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.FormsViewGroup.MeasureAndLayout (int,int,int,int,int,int) <IL 0x00160, 0x007f7> 05-28 09:29:35.610 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.VisualElementTracker.UpdateLayout () <IL 0x000c6, 0x0034d> 05-28 09:29:35.610 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.VisualElementRenderer
1<Xamarin.Forms.View>.UpdateLayout () <0x0003b>
05-28 09:29:35.610 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.VisualElementRenderer1<Xamarin.Forms.Page>.OnLayout (bool,int,int,int,int) <0x000f7> 05-28 09:29:35.610 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) <IL 0x00012, 0x00092> 05-28 09:29:35.610 I/MonoDroid(16267): at (wrapper dynamic-method) object.1cf310b7-c365-4b36-815b-6b108b0346a0 (intptr,intptr,bool,int,int,int,int) <IL 0x0002f, 0x00063> 05-28 09:29:35.610 I/MonoDroid(16267): UNHANDLED EXCEPTION: 05-28 09:29:35.610 I/MonoDroid(16267): System.Reflection.AmbiguousMatchException: Ambiguous matching in method resolution 05-28 09:29:35.610 I/MonoDroid(16267): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x0004b> 05-28 09:29:35.610 I/MonoDroid(16267): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue*) [0x00084] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029 05-28 09:29:35.610 I/MonoDroid(16267): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x0001d] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1036 05-28 09:29:35.610 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.FormsViewGroup.MeasureAndLayout (int,int,int,int,int,int) <IL 0x00160, 0x007f7> 05-28 09:29:35.610 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.VisualElementTracker.UpdateLayout () <IL 0x000c6, 0x0034d> 05-28 09:29:35.610 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.VisualElementRenderer
1<Xamarin.Forms.Page>.UpdateLayout () <0x0003b>
05-28 09:29:35.610 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.Platform.OnLayout (bool,int,int,int,int)
05-28 09:29:35.610 I/MonoDroid(16267): at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (bool,int,int,int,int)
05-28 09:29:35.610 I/MonoDroid(16267): at Android.Views.ViewGroup.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) [0x00009] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Views.ViewGroup.cs:4041
05-28 09:29:35.610 I/MonoDroid(16267): at (wrapper dynamic-method) object.8464caa9-fe67-42bb-87c7-a9b7d63405ee (intptr,intptr,bool,int,int,int,int)
Horizontal ListView with images from ObservableCollection
Hi!
I want to display Images/Thumbnails of photos that I've been taking in a horizontal view as a part of my content page.
I've stored the images paths as strings in a ObservableCollection. What's the best approach to do this in XAML and PCL.
Would be great if 3 or something images are shown on the screen, and standard image if no images have been added or if string is null, and to have these in a scrollview or listview so that all of the images in the ObservableCollection could be displayed.
Maybe something like this
/Oliver
Xamarin.Forms & MVVM In C#: PropertyChanged Event Handler Is Always Null When OnPropertyChanged Call
I've written a simple application using Xamarin.Forms in C# with Visual Studio 2017, and have a problem with data binding working to update the contents of a Label child control to display the selected date value from a DatePicker child control in the same ContentPage. Although all of the project elements compile, build and deploy without any errors, and the OnPropertyChanged method in the ViewModel is called each and every time when I change the date selected in the DatePicker, the PropertyChanged event handler is always a null object reference when the OnPropertyChanged method is called, and in turn, does not update the contents of the Label's Text property as expected with the new selected date value.
The following are my MainPage implementation in addition to the backing ViewModel class, SelectedDateViewModel.cs.
C# [MainPage.xaml.cs]
using System;
using Xamarin.Forms;
namespace DataBoundDatePicker
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
BindingContext = new SelectedDateViewModel();
}
}
}
XAML [MainPage.xaml]
<?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:DataBoundDatePicker"
x:Class="DataBoundDatePicker.MainPage">
<StackLayout Padding="20" VerticalOptions="Center" HorizontalOptions="Center">
<Label Text="Data Bound DatePicker" FontAttributes="Bold" HorizontalOptions="Center" />
<Label Text="Select a Date:" />
<DatePicker x:Name="SelectedDatePicker" Date="{Binding SelectedDate}"/>
<StackLayout Orientation="Horizontal">
<Label Text="Formatted Date:" />
<Label x:Name="FormattedDateLabel" Text="{Binding SelectedDate, StringFormat='{0:dddd, MMMM d, yyyy}'}" />
</StackLayout>
</StackLayout>
</ContentPage>
C# [SelectedDateViewModel.cs]
using System;
using System.ComponentModel;
using System.Diagnostics;
namespace DataBoundDatePicker
{
public class SelectedDateViewModel
{
private readonly string FullDateFormat = "dddd, MMMM d, yyyy";
private DateTime selectedDate;
public event PropertyChangedEventHandler PropertyChanged;
public SelectedDateViewModel()
{
Debug.WriteLine("Entering SelectedDateViewModel.SelectedDateViewModel() - Constructor");
SelectedDate = DateTime.Now;
Debug.WriteLine("Leaving SelectedDateViewModel.SelectedDateViewModel() - Constructor");
}
public DateTime SelectedDate
{
get
{
return selectedDate;
}
set
{
if (selectedDate != value)
{
selectedDate = value;
OnPropertyChanged("SelectedDate");
}
}
}
protected virtual void OnPropertyChanged(string propertyName)
{
Debug.WriteLine("Inside SelectedDateViewModel.OnPropertyChanged()");
Debug.WriteLine($"SelectedDate = {selectedDate.ToString(FullDateFormat)}");
var trace =
$"PropertyChanged Is Null: {(PropertyChanged == null ? "Yes" : "No")}";
Debug.WriteLine(trace);
var propertyChangedCallback = PropertyChanged;
propertyChangedCallback?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
The current implementation does the following:
On startup, the FormattedDateLabel displays the correct formatted date string based on the SelectedDate DateTime property in the SelectedDateViewModel. However, any subsequent changes to the Date property in the SelectedDatePicker control.
Without fail, each and every time the Date value is changed in the SelectedDatePicker control, the SelectedDateViewModel.OnPropertyChanged() method is always called, even on startup through the instantiation of MainPage and SelectedDateViewModel object instances (e.g., constructor calls).
Although the SelectedDateViewModel.OnPropertyChanged() is called any time when the Date value is changed in the DatePicker,
SelectedDateViewModel's PropertyChanged event reference is always null, even on startup (again, when instantiated through constructor calls). This is shown with the following Debug trace statements emitted as the program is running in Debug mode through Visual Studio:'DataBoundDatePicker.UWP.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'c:\work\Xamarin\DataBoundDatePicker\DataBoundDatePicker\DataBoundDatePicker.UWP\bin\x86\Debug\AppX\Xamarin.Forms.Xaml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Entering MainPage.MainPage() - Constructor
Entering SelectedDateViewModel.SelectedDateViewModel() - Constructor
Inside SelectedDateViewModel.OnPropertyChanged()
SelectedDate = Tuesday, July 4, 2017
PropertyChanged Is Null: Yes
Leaving SelectedDateViewModel.SelectedDateViewModel() - Constructor
Leaving MainPage.MainPage() - Constructor
The thread 0x1630 has exited with code 0 (0x0).
Inside SelectedDateViewModel.OnPropertyChanged()
SelectedDate = Sunday, March 4, 2012
PropertyChanged Is Null: YesThe code exhibits the same behavior, regardless of deploying and debugging the UWP or Android version of the application.
Any help or insights and explanations you can share on how I can get the Label Text property to have its Text property bound to the
DatePicker Date property using the ViewModel where the PropertyChanged event is not a null reference would be greatly appreciated.
Thank you in advance for your time and help.
Common PCL for Windows and Mac?
I'm starting a Xamarin Forms Portable Class Library project aimed at all 4 platforms (Windows, Mac, iOS and Android). I'm developing the Windows, iOS and Android versions using Visual Studio 2017 Professional on my Windows machine (for iOS I connect to my Mac of course) and the Mac version using Visual Studio for Mac on my Mac.
Is there a way to reference the same physical PCL project in both environments, so that I won't have to copy files around?
Thanks
dp and pixels. image does not fill the whole screen.
Hi everyone. I'm working in a cocossharp project and i'm having some sort of problem.
I downloaded Fruity falls project and the project has a 384x512 image and it fills the whole screen because
the GameView.DesignResolution is set to this dimension.
However when I try to do the same with my project, I have a 1920x1080 image and i set GameView.DesignResolution(1920x1080)
the image appears much smaller like 1/4 of the screen.
// Set world dimensions
gameView.DesignResolution = new CCSizeI(1920, 1080);
I try to fetch the resolution from MainActivity on android and it returns 797x411 even though my screen has a resolution
much higher. I do a convertion from pixels to dp with the following function
private float ConvertPixelsToDp(float pixelValue)
{
return (pixelValue) / Resources.DisplayMetrics.Density;
}
i made sure i was using Scale = 1.0f so the dimension of the image isnt screwed
I also not sure what this variable is supose to do but it has some effects on the sizes
CCSprite.DefaultTexelToContentSizeRatio = 2.0f; // for HD images according to the predefinition
Can someone explain me why this is happening? i need to work the images sizes with scales, and this is really troublesome cause i cant
figure out what scale to use to fill the screen.
Sorry i had to post this thread in this forum but cocossharp forum is a dead end.
Empty Notifications after reboot
I am sending parameters from PCL to Android Broadcast receiver. I have declared BOOT Completed Broadcast receiver. The parameters are displayed as notification when the phone is not rebooted.
but it sends empty notification when the phone is rebooted. How to handle this scenario. When the phone gets rebooted, the parameters from PCL is not displayed in the notification. Below is my Broadcast receiver.
From PCL,, I am calling the below method and sending parameter .
public void One(string title, string message)
{
Intent alarmIntent = new Intent(Forms.Context, typeof(NotificationDroid));
alarmIntent.PutExtra("message", message);
alarmIntent.PutExtra("title", title);
PendingIntent pendingIntent = PendingIntent.GetBroadcast(Forms.Context, 0, alarmIntent, PendingIntentFlags.UpdateCurrent);
AlarmManager alarmManager = (AlarmManager)Forms.Context.GetSystemService(Context.AlarmService);
alarmManager.Set(AlarmType.RtcWakeup, calender.TimeInMillis, pendingIntent);
}
public override void OnReceive(Context context, Intent intent)
{
var message = intent.GetStringExtra("message");
var title = intent.GetStringExtra("title");
var notIntent = new Intent(context, typeof(MainActivity));
var contentIntent = PendingIntent.GetActivity(context, 0, notIntent, PendingIntentFlags.CancelCurrent);
var manager = NotificationManagerCompat.From(context);
var style = new NotificationCompat.BigTextStyle();
style.BigText(message);
var builder = new NotificationCompat.Builder(context)
.SetContentIntent(contentIntent)
.SetSmallIcon(Resource.Drawable.icon)
.SetContentTitle(title)
.SetContentText(message)
.SetStyle(style)
.SetWhen(Java.Lang.JavaSystem.CurrentTimeMillis())
.SetAutoCancel(true);
var notification = builder.Build();
manager.Notify(0, notification);
}
Xamarin app is deployed but does not work on the device
Greetings!
I'm in the process of developing a xamarin forms application and am trying to do tests on my device but the app is deployed but does not run.
Here is the message in visual studio output.
InspectorDebugSession(2): StateChange: Start -> EntryPointBreakpointRegistered
InspectorDebugSession(2): Constructed
O aplicativo Android está sendo depurado.
InspectorDebugSession(2): HandleTargetEvent: TargetExited
InspectorDebugSession(2): Disposed
07-08 19:47:15.559 D/dalvikvm(20104): Late-enabling CheckJNI
07-08 19:47:15.909 E/dalvikvm(20104): Dex cache directory isn't writable: /data/dalvik-cache
07-08 19:47:15.909 I/dalvikvm(20104): Unable to open or create cache for /data/app/FlipDigital.Android-2.apk (/data/dalvik-cache/data@app@FlipDigital.Android-2.apk@classes.dex)
07-08 19:47:15.989 E/GyroEmu (20104): Exception in SystemSensorEvent hook: java.lang.ClassNotFoundException: android.hardware.SystemSensorManager$SensorEventQueue
07-08 19:47:15.989 D/ActivityThread(20104): setTargetHeapUtilization:0.25
07-08 19:47:15.989 D/ActivityThread(20104): setTargetHeapIdealFree:8388608
07-08 19:47:15.989 D/ActivityThread(20104): setTargetHeapConcurrentStart:2097152
07-08 19:47:15.999 W/ApplicationContext(20104): Unable to create cache directory
07-08 19:47:15.999 D/AndroidRuntime(20104): Shutting down VM
07-08 19:47:15.999 W/dalvikvm(20104): threadid=1: thread exiting with uncaught exception (group=0x41104438)
07-08 19:47:15.999 E/AndroidRuntime(20104): FATAL EXCEPTION: main
07-08 19:47:15.999 E/AndroidRuntime(20104): java.lang.NullPointerException
07-08 19:47:15.999 E/AndroidRuntime(20104): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4118)
07-08 19:47:15.999 E/AndroidRuntime(20104): at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
07-08 19:47:15.999 E/AndroidRuntime(20104): at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:631)
07-08 19:47:15.999 E/AndroidRuntime(20104): at android.app.ActivityThread.handleBindApplication(Native Method)
07-08 19:47:15.999 E/AndroidRuntime(20104): at android.app.ActivityThread.access$1400(ActivityThread.java:143)
07-08 19:47:15.999 E/AndroidRuntime(20104): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1301)
07-08 19:47:15.999 E/AndroidRuntime(20104): at android.os.Handler.dispatchMessage(Handler.java:99)
07-08 19:47:15.999 E/AndroidRuntime(20104): at android.os.Looper.loop(Looper.java:137)
07-08 19:47:15.999 E/AndroidRuntime(20104): at android.app.ActivityThread.main(ActivityThread.java:4960)
07-08 19:47:15.999 E/AndroidRuntime(20104): at java.lang.reflect.Method.invokeNative(Native Method)
07-08 19:47:15.999 E/AndroidRuntime(20104): at java.lang.reflect.Method.invoke(Method.java:511)
07-08 19:47:15.999 E/AndroidRuntime(20104): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
07-08 19:47:15.999 E/AndroidRuntime(20104): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
07-08 19:47:15.999 E/AndroidRuntime(20104): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
07-08 19:47:15.999 E/AndroidRuntime(20104): at dalvik.system.NativeStart.main(Native Method)
Help to solve a LinkAssemblies failure with TK.CustomMap using skip linking assemblies.
Hi everyone,
I have encountered the error below while trying to build a release configuration of my project. Since I didn't think I could fix the issue I decided I would just try and skip linking the relevant assemblies. Unfortunately that didn't seem to work. Now I'm wondering if I've written the skip assemblies code wrong or if there is anything.
This is what I have in the 'Skip Linking Assemblies' box on the Android options page under droid properties:
TK.CustomMap.Android;TK.CustomMap;Xamarin.Forms.Maps.Android;Xamarin.Forms.Maps;Xamarin.Forms.Platform.Android
This is the error upon build:
Error The "LinkAssemblies" task failed unexpectedly. Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Reference to metadata item 'System.Void Xamarin.Forms.Maps.Android.MapRenderer::OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs1<Xamarin.Forms.View>)' (defined in 'TK.CustomMap.Android, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null') from 'TK.CustomMap.Android, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void Xamarin.Forms.Maps.Android.MapRenderer::OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs1<Xamarin.Forms.View>) at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference) at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction) at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method) at Mono.Linker.Steps.MarkStep.ProcessQueue() at Mono.Linker.Steps.MarkStep.Process() at Mono.Linker.Steps.MarkStep.Process(LinkContext context) at Mono.Linker.Pipeline.Process(LinkContext context) at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context) at Xamarin.Android.Tasks.LinkAssemblies.Execute() --- End of inner exception stack trace --- at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args) at Xamarin.Android.Tasks.LinkAssemblies.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() EVBapp.Droid
Should I be skipping linking anything else?
Can anyone offer any advice?
Navigation issue using FreshMVVM
Hello all,
i'm currently facing a problem implementing a certain navigation stack in a correct way using FreshMvvm:
I have setup a tabbed navigation container containing some pages.
One of the page shows a list of subpages to navigate to. These subpages themselves should be defined in simple navigation way as they contain hierarchical subpages to dive in an pop back. So far i tried to implement this scenario in two ways:
- When i simply do a CoreMethods.PushPageModel from the itemlist, i could switch to the selected subpage, but, of course, the tab registers are still present as i'm still in the same navigation stack.
- I could switch to the new navigation stack by CoreMethods.PushPageModelWithNewNavigation(). This works, i'm landing on the desired page BUT, as it is a new navigation stack, i don't have a "Back" Arrow in toolbar to go back to the tabregister page - Which is a deadlock on iOS as there's also no hardware "Back" button.
So is there a possibility in FreshMvvm to directly push to a simple navigation container out of a tabbed navigation page WITH having a possibility to pop back by using "Back" Arrow from Toolbar?
Good data base for user login and registration
Hello,
I was wondering what data base is good for storing users account information when they register through my app I created using Xamarin Forms.
I know Azure is very compatible but I was told it is expensive for start up apps, what are some good other options?
Thanks!
Accessibility - TalkBack/VoiceOver - while app is loading
Once the user starts the app, but before it's loaded, I'd like to have it say, "Loading".
Anyone know how this can be done?
I tried putting it in the main form in the xamarin forms module, but couldn't figure it out. I also did a lot of searching for examples or docs that would explain how to do it in the separate iOS and android modules, but found nothing there either.
Thanks for any help in advance.