how to check display is in portrait or landscape mode in xamarin forms?
how to get current Orientation in xamarin forms
Invalid cast exception in main activity.cs
Unable to convert instance of type 'Android.Support.V7.Widget.AppCompatTextView' to type 'Android.Support.V7.Widget.Toolbar' getting exception after installing BottomNavigationBar plugin for android to implement bottom tabs in xamarin forms
UIBarButtonItem in Tabbed Page Custom Renderer Losing Title Text Attributes
When my view loads I can see that my CustomRenderer is working, my navbar's background is changed, the left and right button's tintcolors are changed and the right button has its font updated to use FontAwesome. However when I select another tab the right button loses all of the text attributes I've set and reverts back to its default values. Is there a way to make those changes persist across tab selections?
Xamarin Forms iphone simulator filenotfoundexception resources.dll
Hi, since a month when I start debugging my app in iphone simulator and access to a specific Page the debugger detects a System.IO.FileNotFoundException related to this path:
/Users/xxx/Library/Developer/CoreSimulator/Devices/CF741BB8-6814-4895-9BEE-76E8E82C9F11/data/Containers/Bundle/Application/685D5325-455C-405C-A600-D49E4A12EC78/xxx.iOS.app/en-US/Xamarin.Forms.Platform.iOS.resources.dll
I look inside the path and i don't found a folder named /en-US/
After that I change localization to Italian and a similar FileNotFoundException raised related to path:
/Users/xxx/Library/Developer/CoreSimulator/Devices/CF741BB8-6814-4895-9BEE-76E8E82C9F11/data/Containers/Bundle/Application/685D5325-455C-405C-A600-D49E4A12EC78/xxx.iOS.app/it-IT/Xamarin.Forms.Platform.iOS.resources.dll
Inside the app bundle there is the folder /it/ not the folder /it-IT/.
I tried to check XAML and sources for wrong references, paths and names without success.
I also checked and upgraded anything.
Can someone help me on this problem?
Problem with connectivity
Hi all,
This one is very strange problem indeed. We have xamarin forms app, which worked perfectly about 2 years. Our database is on server (godaddy.com) and app connects it trough php scripts. Everything worked fine as I said until couple weeks ago - suddenly Android apps stopped working. I mean all instances: from google play, already installed ones, even one I have on developer phone. I found out it happens when app tries to connect our site... it simply enters into some endless loop. It seems app is not able to receive any information from godaddy server anymore. What is strange iOS version still works fine. I've checked everything and it is not database, nor scripts on site - everything is ok (as I mentioned iOS version still works). Codewise, I use rather simple approach. For example to check username\password I use function:
async Task DBSignIn(string email, string password)
{
string uri = urilogin + "?email=" + email + "&password=" + password;
HttpClient client = new HttpClient();
Task str = client.GetStringAsync(uri);
return str.Result;
}
Then I call above function this way:
Task dbstr = DBSignIn(email, password);
string str = dbstr.Result;
When I launch debugger at this point program simply steps into infinite loop as it seems unable to connect site. What is interesting, when I use any other address, such as goocle.com, yahoo etc. app works fine - I mean, It reads webpage content without any problem.
Anybody have similar problem?
GTK# support on Linux
Hi,
first of all, great to see GTK# support (preview) for Xamarin Forms.
I followed the docs: "GTK# Platform Setup" on https://docs.microsoft.com/en-us/xamarin/xamarin-forms/platform/gtk?tabs=vswin
using the GameOfLife example (as suggested).
It works as expected on Windows.
Now I just copied the source to my Linux machine and was expecting that it also compiles and runs on that machine.
I opened the solution in MonoDevelop. It compiled and started but crashes with the exception:
System.DllNotFoundException: libglib-2.0-0.dll
at at (wrapper managed-to-native) GLib.Marshaller.g_utf16_to_utf8(char*,intptr,intptr,intptr,intptr&)
at GLib.Marshaller.StringToPtrGStrdup (System.String str) [0x00034] in :0
at GLib.Global.set_ProgramName (System.String value) [0x00001] in :0
at Gtk.Application.SetPrgname () [0x0000d] in <35293b6aa2744433b0e2f41f34e699d5>:0
at Gtk.Application.Init () [0x00001] in <35293b6aa2744433b0e2f41f34e699d5>:0
at GameOfLife.Gtk.Program.Main (System.String[] args) [0x00001] in :0
What am I missing? Or is this just not supported yet?
Thanks
Best regards
Alex
How to get the id of the toggled switch item in the listview?
I have a listview and all the listview item contain a switch at the right end like below picture.
When I select an item the switch fires the Toggled event. My codes are adding below:
Xaml:
<Switch
Toggled="OnToggledEvent"
HorizontalOptions="EndAndExpand"
VerticalOptions="CenterAndExpand"/>
Xaml.cs:
void OnToggledEvent(object sender, ToggledEventArgs args)
{
//How I can access the userId of the selected item
}
Model class:
public class DirectoryResponse
{
public List<UserProfileHBList> userProfileHBList { get; set; }
}
public class UserProfileHBList
{
public UserProfileTO userProfileTO { get; set; }
}
public class UserProfileTO
{
public string userId { get; set; }
public string firstName { get; set; }
public string email { get; set; }
public string lastName { get; set; }
}
I need the userId of the selected item, how I can access that.
Thanks in advance
MR.gesture call event twice in IOS but behaving correctly in Android.
I am using MR. Gestures plugin to handle single tap and long pressed event. I have the listview and inside the listview, there is a grid which divided into two column. Each separate column having longpress event and single tap event.
on a Longpressed event, items are select/deselect. That item may be left item or right item from the single row of the listview.
When I long press one item it is selected then after when I press some other item from different row, "Longpressed" event call twice and the previous item is deselected automatically.
the whole scenario is as follows
There are three row (index - 0,1,2)
Left item from index-2 is selected
Now I long press on left item of index-1.
Long press event call twice.
First time for index-2 and unchecked the selected item.
second time for index-1 and checked.
private void grd_left_product_LongPressed(object sender, MR.Gestures.LongPressEventArgs e)
{
try
{
var productId = sender as Grid;
if (!string.IsNullOrEmpty(productId.ClassId) && lstcollectionproductDatas != null && lstcollectionproductDatas.Count > 0)
{
var selectedObject = lstcollectionproductDatas.Where(d => d.Left_attachedFilePath == productId.ClassId).FirstOrDefault();
if (selectedObject != null)
{
int index = lstcollectionproductDatas.IndexOf(selectedObject);
if (!selectedObject.Left_IsChecked)
lstcollectionproductDatas[index].Left_IsChecked = true;
else
lstcollectionproductDatas[index].Left_IsChecked = false;
}
lstProducts.ItemsSource = null;
lstProducts.ItemsSource = lstcollectionproductDatas;
}
else
new ShowSnackbar(AppResources.Validation_FileNotFound_Message);
}
catch (Exception)
{
new ShowSnackbar(AppResources.Validation_Exception);
}
}
This same behaviour working correctly in android but not working in IOS.
Is this plugin issue? Please suggest me some other plugin.
My Content page is call inside tabbed page. Every content page is having the same kind of listview. I can not figure out the actual issue.
Sideloaded UWP app crashing
Hi,
I have developed a cross-platform app using Xamarin.Forms.
The UWP app is installed by sideloading (NOT downloaded from the Store) and it crashes sometimes.
Is there somewhere on Windows where can I check the crash logs and see why it crashed?
Dependency Injection Errors in Xaml Previewer
Hi All,
I'm getting exceptions when tying to preview my xaml in the designer preview (I'm using VS for Mac, and have the same issue with Windows).
I know the Cause, but not sure how to resolve it.
In my code behind file for each page, I have a BindingContext = IoC.Resolve(); line of code, which resolves the view model.
Now when I try to view this file in the designer preview, I get the exception breaking at the IoC.Resolve line.
Is there anywhere I can register my types as a sort of pre-run stage in the previewer or is this simply not possible with my setup?
Thanks,
Nick
ListView Pullup to refresh
hi
I want append items to list when user scroll up through the listview. PullToRefresh works when user scrolling the list upwards only.
Can this be achieved and if so how? In xamarin listview i can only see IsPullToRefreshEnabled property only.
Segmented control inside an entry
Hi All,
I am trying to insert a segmented button inside an entry,
In the login form, the gender entry has male and female option which 1 option will be selected ,
Please help me
Connect to sql Server
I need connect to sql server resident on local server
Can anyone help me?
Thanks
i use:
string connectionString = @Server=192.168.1.22;Database=DB_DATI_UBIK_STORE_PRO;User Id=sa;Password=bladerunner;Trusted_Connection=true;
but i recive this error:
exception = {System.Data.SqlClient.SqlException (0x80131904): Specified method is not supported.
at Interop+NetSecurityNative.ImportPrincipalName (Interop+NetSecurityNative+Status& minorStatus, System.String inputName, System.Int32 inputNameByteCount, Microsoft.Win32...
THANKS
What is the feasibility for integrating Google Heatmap API using Xamarin.Forms for iOS App?
Hi,
Can someone share the feasibility for integrating Google Heatmap API using Xamarin.Forms for iOS App? Also can the map be loaded in offline mode if the internet connectivity is not available.
If there is feasibility, please provide relevant reference to links or code on how to achieve it.
Regards,
Harish
How to select multiple images from gallery from both android and iOS device?
Hello,
I am working on xamarin.forms app. I am creating the app for android and iOS. I need to open the gallery and select multiple images from gallery of devices. How I can do this in xamarin.forms that can work for both android and iOS?
Regards,
Anand Dubey
MR.Gestures handles ALL touch gestures
With MR.Gestures you can handle the Tapping, Tapped, DoupleTapped, LongPressing, LongPressed, Panning, Panned, Swiped, Pinching, Pinched, Rotating and Rotated gestures on all layouts, cells, views and on the ContentPage.
The code can be as easy as
var box1 = new MR.Gestures.BoxView { Color = Color.Red };
box1.LongPressed += (s, e) => { Console.WriteLine("Code: Red LongPressed"); };
Or in XAML
<br /><mr:ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mr="clr-namespace:MR.Gestures;assembly=MR.Gestures"
x:Class="GestureSample.Views.ContentViewXaml"
Padding="50"
TappingCommand="{Binding TappingCommand}"
TappedCommand="{Binding TappedCommand}"
DoubleTappedCommand="{Binding DoubleTappedCommand}"
LongPressingCommand="{Binding LongPressingCommand}"
LongPressedCommand="{Binding LongPressedCommand}"
PanningCommand="{Binding PanningCommand}"
PannedCommand="{Binding PannedCommand}"
SwipedCommand="{Binding SwipedCommand}"
PinchingCommand="{Binding PinchingCommand}"
PinchedCommand="{Binding PinchedCommand}"
RotatingCommand="{Binding RotatingCommand}"
RotatedCommand="{Binding RotatedCommand}"
>
MR.Gestures is available via NuGet. More info on http://www.mrgestures.com/.
There is also a sample app available to download from https://github.com/MichaelRumpler/GestureSample. The GestureSample demonstrates how to use all the gestures with all Xamarin.Forms elements.
Seperator lines in TableView
How do I remove the separator lines between each ViewCell in a TableView
I've created this little demo page illustrating the problem:
<br />
<?xml version="1.0" encoding="utf-8" ?><br />
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App29.MainPage"></p>
<pre><code><ContentPage.Content>
<StackLayout Padding="30" VerticalOptions="Start">
<TableView Intent="Form">
<TableRoot >
<TableSection Title="TITLE">
<ViewCell>
<Label Text="TEST 1" IsVisible="False"/>
</ViewCell>
<ViewCell>
<Label Text="TEST 2" IsVisible="False"/>
</ViewCell>
</TableSection>
</TableRoot>
</TableView>
</StackLayout>
</ContentPage.Content>
MR.Gestures handles ALL touch gestures
With MR.Gestures you can handle the Tapping, Tapped, DoupleTapped, LongPressing, LongPressed, Panning, Panned, Swiped, Pinching, Pinched, Rotating and Rotated gestures on all layouts, cells, views and on the ContentPage.
The code can be as easy as
var box1 = new MR.Gestures.BoxView { Color = Color.Red };
box1.LongPressed += (s, e) => { Console.WriteLine("Code: Red LongPressed"); };
Or in XAML
<br /><mr:ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mr="clr-namespace:MR.Gestures;assembly=MR.Gestures"
x:Class="GestureSample.Views.ContentViewXaml"
Padding="50"
TappingCommand="{Binding TappingCommand}"
TappedCommand="{Binding TappedCommand}"
DoubleTappedCommand="{Binding DoubleTappedCommand}"
LongPressingCommand="{Binding LongPressingCommand}"
LongPressedCommand="{Binding LongPressedCommand}"
PanningCommand="{Binding PanningCommand}"
PannedCommand="{Binding PannedCommand}"
SwipedCommand="{Binding SwipedCommand}"
PinchingCommand="{Binding PinchingCommand}"
PinchedCommand="{Binding PinchedCommand}"
RotatingCommand="{Binding RotatingCommand}"
RotatedCommand="{Binding RotatedCommand}"
>
MR.Gestures is available via NuGet. More info on http://www.mrgestures.com/.
There is also a sample app available to download from https://github.com/MichaelRumpler/GestureSample. The GestureSample demonstrates how to use all the gestures with all Xamarin.Forms elements.
hide or show the switch
I want to hide or show the switch(inside the listview) on button click which is outside from the listview.
how to do that?
help
Thanks in advance.
How to use 'speechrecognition' plugin?
Hi
I'm want to use 'speechrecognition" (https://github.com/aritchie/speechrecognition)
I know how to install it by asking the developer directly, but I can not use it.
How do I use 'Continuous Dictation'?
I just want to put the speech into the editor by just pressing the button.