Hi,
Why my ZXing camera is just showing a gray box with horizontal line on my Simulator on Visual Studio for Mac?
Is there any permission issue?
How to troubleshoot?
Thanks,
Jassim
Hi,
Why my ZXing camera is just showing a gray box with horizontal line on my Simulator on Visual Studio for Mac?
Is there any permission issue?
How to troubleshoot?
Thanks,
Jassim
I have created popup in xamarin forms but I want to show overlay popup in the area behind the popup and disable events for any control in that area. So need help in this regards
When app is in background and tried to open the app, then it is showing white background. We don't have any logic or any operations in launch. Its just loading splash activity and navigating to Main Activity.
Can anyone please suggest.
As a POC we are trying to transmit a plain text file. from a WebAPI server to the phone. The server puts the text file into a byte array and I pick it up using client.GetAsync(uri); I then call
byte[] content = await response.Content.ReadAsByteArrayAsync();
What I get is garbage characters.
I've used Postman to go to the URL with the same headers and I see the same garbage characters.
I've tried using
var str = System.Text.Encoding.UTF8.GetString(content,0, content.Length);
But I get the exact same garbage characters.
What am I missing?
Hi all,
Does anyone know what to do? This error only occur in the IOS version of my xamarin.forms project.
Everything was running fine until I installed nuget package for WindowsAzure.MobileServices (Microsoft.Bcl,Microsoft.Bcl.Build,Microsoft.Net.Http)
Even If I remove those packages, I've got this error...
In my ViewModel I have a property called 'Objects' which is an ObservableCollection.
When I setup the ListView it is as such:
ObjectList = new ListView()
{
IsPullToRefreshEnabled = true,
HasUnevenRows = ViewModel.HasUnevenRows,
RefreshCommand = ViewModel.LoadObjects,
ItemsSource = ViewModel.Objects,
ItemTemplate = new DataTemplate(ViewModel.ListViewItem),
BindingContext = ViewModel
};
ObjectList.SetBinding(ListView.IsRefreshingProperty, new Binding("IsLoading"));
My ViewModel has an IsLoading property and I am making sure I'm not reloading the list while it is already being loaded via the command CanExecute:
LoadObjects = new Command(() => { ListObjects(); },() => { return !IsLoading; });
When I pull to refresh it executes the LoadObjects command.
The issue I am encountering is when I pull to refresh the list, after the 3rd or 4th time it will crash with this:
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.iOS.LabelRenderer.UpdateText () [0x00070] in <8f7e3b9d1483403590c8ab3d78cce1ac>:0
at Xamarin.Forms.Platform.iOS.LabelRenderer.OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00097] in <8f7e3b9d1483403590c8ab3d78cce1ac>:0
at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x0000a] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:137
at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in C:\agent\_work\3\s\Xamarin.Forms.Core\Element.cs:388
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x000f4] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:593
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:390
at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x001f9] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindingExpression.cs:174
at Xamarin.Forms.BindingExpression.Apply (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property) [0x0006b] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindingExpression.cs:77
at Xamarin.Forms.Binding.Apply (System.Object newContext, Xamarin.Forms.BindableObject bindObj, Xamarin.Forms.BindableProperty targetProperty) [0x00042] in C:\agent\_work\3\s\Xamarin.Forms.Core\Binding.cs:126
at Xamarin.Forms.BindableObject.ApplyBindings (System.Boolean skipBindingContext) [0x0003b] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:421
at Xamarin.Forms.BindableObject.ApplyBindings () [0x00000] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:125
at Xamarin.Forms.BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject bindable, System.Object value) [0x0005a] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:119
at Xamarin.Forms.Element.SetChildInheritedBindingContext (Xamarin.Forms.Element child, System.Object context) [0x00000] in C:\agent\_work\3\s\Xamarin.Forms.Core\Element.cs:498
at Xamarin.Forms.Element.OnBindingContextChanged () [0x00021] in C:\agent\_work\3\s\Xamarin.Forms.Core\Element.cs:341
at Xamarin.Forms.View.OnBindingContextChanged () [0x00042] in C:\agent\_work\3\s\Xamarin.Forms.Core\View.cs:99
at Xamarin.Forms.BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject bindable, System.Object value) [0x00060] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:120
at Xamarin.Forms.Element.SetChildInheritedBindingContext (Xamarin.Forms.Element child, System.Object context) [0x00000] in C:\agent\_work\3\s\Xamarin.Forms.Core\Element.cs:498
at Xamarin.Forms.Element.OnBindingContextChanged () [0x00021] in C:\agent\_work\3\s\Xamarin.Forms.Core\Element.cs:341
at Xamarin.Forms.View.OnBindingContextChanged () [0x00042] in C:\agent\_work\3\s\Xamarin.Forms.Core\View.cs:99
at Xamarin.Forms.BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject bindable, System.Object value) [0x00060] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:120
at Xamarin.Forms.Element.SetChildInheritedBindingContext (Xamarin.Forms.Element child, System.Object context) [0x00000] in C:\agent\_work\3\s\Xamarin.Forms.Core\Element.cs:498
at Xamarin.Forms.Element.OnBindingContextChanged () [0x00021] in C:\agent\_work\3\s\Xamarin.Forms.Core\Element.cs:341
at Xamarin.Forms.Cell.OnBindingContextChanged () [0x00000] in C:\agent\_work\3\s\Xamarin.Forms.Core\Cells\Cell.cs:114
at Xamarin.Forms.BindableObject.BindingContextPropertyChanged (Xamarin.Forms.BindableObject bindable, System.Object oldvalue, System.Object newvalue) [0x0000e] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:441
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00108] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:596
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:390
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0005f] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:543
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:83
at Xamarin.Forms.BindableObject.set_BindingContext (System.Object value) [0x00000] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:24
at Xamarin.Forms.Internals.TemplatedItemsList`2+<UnhookItem>d__154[TView,TItem].MoveNext () [0x000b0] in C:\agent\_work\3\s\Xamarin.Forms.Core\TemplatedItemsList.cs:1217
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.2.0.11/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.2.0.11/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018
at UIKit.UIKitSynchronizationContext+<Post>c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/5481/2f8bbec0/source/xamarin-macios/src/UIKit/UIKitSynchronizationContext.cs:24
at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Users/builder/data/lanes/5481/2f8bbec0/source/xamarin-macios/src/Foundation/NSAction.cs:163
--- End of stack trace from previous location where exception was thrown ---
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/5481/2f8bbec0/source/xamarin-macios/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/5481/2f8bbec0/source/xamarin-macios/src/UIKit/UIApplication.cs:63
at HydrusCRM.iOS.Application.Main (System.String[] args) [0x00001] in /Volumes/Data/Apps/HydrusCRM/iOS/Main.cs:17
Here is the code that updates the objects collection:
var result = (IList)JsonConvert.DeserializeObject(results, listType);
if (result.Count > 0)
{
Device.BeginInvokeOnMainThread(() =>
{
foreach (Models.Objects.Model @object in result)
{
objects.Add(@object);
}
});
}
I am not sure where the issue is coming from as none of my apps code is in the exception stack.
Hi,
I am trying a basic ZXing barcode scanner code but getting below error when trying:
void HandleResult(ZXing.Result result)
{
var msg = "NO BARDCODE";
if (result != null)
msg = "Barrdcode: " + result.Text + " (" + result.BarcodeFormat + ")";
DisplayAlert("bardcode", msg, "Cancel");
}
ERROR:
**/Users/jassim/Projects/Zeera/Zeera/ZeeraScan.xaml.cs(33,33): Error CS0433: The type 'Result' exists in both 'zxing, Version=0.16.2.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60' and 'zxing.portable, Version=2.2.9.0, Culture=neutral, PublicKeyToken=830ae994e36ac27d' (CS0433) (Zeera.iOS)
**
Thanks,
Jassim
Hello everyone!
I'm trying to consume a REST API and update the Text property of some Entry views. But as soon as I get a JSON response and set some properties of my POCO class the view it's not updating.
Take a look in my code:
ViewModel:
namespace MyApp.ViewModels
{
public class CompanyInfoPageViewModel : ViewModelBase //which inherits BindableBase
{
private APIClient _apiClient;
public CompanyInfoPageViewModel(
INavigationService navigationService,
IPageDialogService pageDialogService,
APIClient apiClient) : base(navigationService, pageDialogService)
{
_apiClient = apiClient;
Company = new Company();
}
private Company company;
public Company Company
{
get { return company; }
set { SetProperty(ref company, value); }
}
//Fired on TextChanged of txtCEP Entry
public async void FindCEP(string text)
{
var response = await _apiClient.GetAsync("cep/" + text);
if (response.IsSuccessStatusCode)
{
var json = await response.ToJObjectAsync();
var error = json.Value<string>("errors");
if (error == null)
{
var data = json["data"];
Company.Endereco = json["data"]["log_no_abrev"].ToString();
Company.Bairro = json["data"]["bairro"].ToString();
Company.Cidade = json["data"]["cidade"].ToString();
//And the view it's not updated ;(
}
else
{
await PageDialogService.DisplayAlertAsync("Ops", error, "OK");
}
}
else
{
//displays another message
}
}
}
public class Company
{
public string Endereco { get; set; }
public string Bairro { get; set; }
public string Cidade { get; set; }
public string CEP { get; set; }
}
}
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:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
prism:ViewModelLocator.AutowireViewModel="True"
x:Class="MyApp.Views.CompanyInfo"
Title="Dados da empresa">
<StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="Center">
<StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="Center" Padding="0,20,0,0">
<Label Text="Endereço" FontSize="Large"/>
<Entry Text="{Binding Company.CEP}" Placeholder="CEP" x:Name="txtCEP" />
<Entry Text="{Binding Company.Endereco, Mode=TwoWay }" Placeholder="Rua, Av..." HorizontalOptions="FillAndExpand"/>
<Entry Text="{Binding Company.Bairro}" Placeholder="Bairro" />
<Entry Text="{Binding Company.Cidade}" Placeholder="Cidade" HorizontalOptions="FillAndExpand"/>
</StackLayout>
<Button Command="{Binding SalvarCommand}" Text="Salvar" Style="{StaticResource buttonPrimary}"/>
</StackLayout>
</ContentPage>
Am I doing something wrong?
I used use applinks without firebase. Code below was working in earlier versions but after upgrading 2.5.0.1927 version of xamarin applinks, I get firebase error. It is already reported as a bug https://stackoverflow.com/questions/44162084/xamarin-android-default-firebaseapp-is-not-initialized-in-this-process
But I wonder that if it is a must to use firebase for applinks in the newest version?
Application.Current.AppLinks.RegisterLink(_applink);
Hello, I have an ASMX Web Service and an Xamarin Forms Cross Platform application, in the web service i have this:
[WebMethod]
string GetMessage()
{
return "Working perfectly!";
}
and in the MainPage.xml i have a label named lbl1 and in the MainPage.xml.cs i have this code:
WebService.WebService1SoapClient client = new WebService.WebService1SoapClient();
client.GetMessageAsync();
client.GetMessageCompleted += Client_GetMessageCompleted;
}
private void Client_GetMessageCompleted(object sender, WebService.GetMessageCompletedEventArgs e)
{
Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
{
lbl1.Text = e.Result.ToString();
});
}
By doing this i get the following exception:
Unhandled Exception:
System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid. Check InnerException for exception details. occurred
I need to apply some animation in Item Appearing on the ListView.
I need sample code.
Good day for all!
WSorry for my bad english, but I hope you anderstand me...
I`m new for Xamarin developer... and I try call web service for login... but have a error - System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid. Check InnerException for exc…
I try do all as (video in spoiler)
https / www. youtube. com / watch ?v= vSxkOuBb8YY
but have a error when press login button ...
my web service - deployed on server on my work example: http / servername. company. local/ MobileService/ WebService.asmx?wsdl - it`s OK and if test it - all work, but not in android emulator (I use VS2017 Community with Xamarin 4.7.10.22 - all default)...
One what I do - change CSPROJ TargetFrameworkProfile to Profile78 (for adding Web references)
And that is all... got Error...
BUT! If I call http / www. webservicex. net/ country. asmx?wsdl - THIS WORK!!!
Comment - my service (not work)
` public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
btnLogin.Clicked += BtnLogin_Clicked;
}
private void BtnLogin_Clicked(object sender, EventArgs e)
{
MobileService.WebServiceSoapClient service = new MobileService.WebServiceSoapClient();
service.LoginCompleted += Service_LoginCompleted;
service.LoginAsync(usernameEntry.Text, passwordEntry.Text);
//CountryXService.countrySoapClient client = new CountryXService.countrySoapClient();
//client.GetCountriesCompleted += Client_GetCountriesCompleted;
//client.GetCountriesAsync();
}
private void Client_GetCountriesCompleted(object sender, CountryXService.GetCountriesCompletedEventArgs e)
{
Device.BeginInvokeOnMainThread(() =>
{
try
{
DisplayAlert("Mess", e.Result, "Ok"); // IT IS WORK!!!!
}
catch (Exception ex)
{
DisplayAlert(ex.Message, ex.InnerException.Message, "Ok");
}
});
}
private void Service_LoginCompleted(object sender, MobileService.LoginCompletedEventArgs e)
{
Device.BeginInvokeOnMainThread(() =>
{
try
{
if (e.Result.ValidUser) // <----- e.Rusult is Error!!!
{
Navigation.PushModalAsync(new Page2());
}
else
{
DisplayAlert("Error", "user name or pass is not valid", "Ok");
}
}
catch (Exception ex)
{
DisplayAlert(ex.Message, ex.InnerException.Message, "Ok");
}
});
}
}
`
Why it is?
I have a Xamarin Forms app which starts up fine on both UWP and Android but on iOS throws a NullReferenceException. Oddly though, it continues to run if I just resume execution, but i'd still like to fix it. Im struggling to pin down exactly where the problem is though due to a lack of details.
And if I hit F5 to continue execution, all I get in the debug window is:
Obviously this isn't much help.
I've stepped through the app startup and into the page that is on-screen when this happens, and both the constructor and onAppearing methods step through fine.
Has anyone got any tips on pinning down exactly what the cause is here?
Thanks
Hi Everyone,
I know this is wrong way, I should use Web Service. But I need learn quickly this way. I research before write here I try but can't.
I want to SQL Query (like Select C.Name From Customer C) on list view. Can you help me? This is so important for me.
Hi,
We use Xamarin to target IOS, Android and Windows 8.1 devices. We have recently had the need to allow the use of TLS 1.2 for all 3 of these platforms. IOS does this out of the box. For Android we are using ModernHTTPClient to achieve this. But for Windows 8.1 there doesn't currently seem to be any way of supporting TLS 1.2.
We have tried the following approaches without success:
- Making use of the ServicePointManager to define the TLS versions available - SPM is not supported in PCL or Windows target projects
- Upgrade to .NET 4.6 - Xamarin does not allow this and reverts the version back to 4.5 each time
- Upgrade to Visual Studio 2017 with .NET Core 2.0 - VS2017 does not support Windows 8.1 App/Phone projects.
Does anyone know if there is any way of achieving this within 8.1 as there currently doesn't seem to be any way of doing it?
Thanks in advance
Regards
Scott
Hi,
I am trying to run my app on iPad Simulator but cannot find it in the list..
The only available on Visual Stuio for Mac are iPhone and Android Phone
How to add the tablets for iOS and Androids?
Thanks,
Jassim
Hi, i've set up identityserver4 project, web api project using that and now i want to use xamarin forms to connect to my api.
Is there any good and fresh and short and simple code snippet how to use that including all that token refreshes etc.?
Yes, i read plenty of articles and topics here but I think I cannot see the wood for the trees so i need some very very clear and straightforward and complete code snippet
Thanks!
Hi all,
Struggling to set the HeightRequest of an image via binding using C#. I thought it would be as simple as this:
var image = new Image { };
image.SetBinding(HeightRequest, "ImageHeight");
However, that results in
Cannot convert from double to Xamarin.Forms.BindingBase
If I was using XAML, it looks to be pretty much however XAML isn't an option as the elements are built dynamically from a DB.
For reference, my ViewModel is:
public partial class QuestionsViewModel : INotifyPropertyChanged
{
private int inputHeight = 50;
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged([CallerMemberName] string name = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
public QuestionsViewModel(bool populateList = true)
{
}
public int InputHeight
{
get { return inputHeight; }
set { inputHeight = value; }
}
}
Binding is working elsewhere via the SetBinding() function - this is the first time I have tried to set a HeightRequest via binding.
Thanks!
Hello,
I'm currently developing an Xamarin Forms app that needs to authenticate users, using Facebook.
However, I'm having a hard time figuring out the steps to import and use the Facebook-SDK in my project.
My question is: How do I import the following code in point 6 to my Xamarin forms project?
I've already added the Facebook SDK using Gradle extention for Visual Studio 2017.
Nonetheless, I cant figure out point 6
Import the Facebook SDK
To use the Facebook SDK in a project, add it as a build dependency and import the Facebook SDK packages.
Important: If you're adding the SDK to an existing project, start at step 3.
- Go to Android Studio | New Project | Minimum SDK.
- Select API 15: Android 4.0.3 (IceCreamSandwich) or higher and create your new project.
- In your project, open your_app | Gradle Scripts | build.gradle (Project) and add the following repository to the buildscript
{ repositories {}}
section to >download the SDK from the Maven Central Repository:
mavenCentral()
- In your project, open your_app | Gradle Scripts | build.gradle (Module: app) and add the following compile statement to the
dependencies{}
section to >compile the latest version of the SDK:
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
- Build your project.
- Add the following statements to import the Facebook SDK packages:
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEventsLogger;
Thanks
Hi, I am Xamarin Developer. I want to create chat application for Xamarin Forms. Is there any link ? Which sdk support to Xamarin forms ? Thank you