Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 91519 articles
Browse latest View live

Navigation bar color is not set 'Transparent' in Xamarin Forms iOS.

$
0
0

I have set Background image for whole application, and set navigation bar background color transparent. In android it's working proper. But in iOS Navigation Bar displays in white color.


x:Name can't be recognized in Form's C#

$
0
0

<StackLayout Spacing="7" HorizontalOptions="Start" Grid.ColumnSpan="2" Grid.Row="1" Grid.Column="0" Margin="30,5,0,0"> <Label TextColor="White" FontAttributes="Bold" FontSize="12" x:Name="VrstaLabel"></Label> <Label TextColor="White" FontAttributes="Bold" FontSize="12" x:Name="nazivLabel"></Label> <Label TextColor="White" FontAttributes="Bold" FontSize="12" x:Name="gradLabel"></Label> <Label TextColor="White" FontAttributes="Bold" FontSize="12" x:Name="adresaLabel"></Label> <Label TextColor="White" FontAttributes="Bold" FontSize="12" x:Name="objekatLabel"></Label> <Label TextColor="White" FontAttributes="Bold" FontSize="12" x:Name="DatumOdrzavanjaLabel"></Label> <Label TextColor="White" FontAttributes="Bold" FontSize="12" x:Name="MinimumGodineLabel"></Label> <StackLayout Margin="0,10,0,0" VerticalOptions="FillAndExpand" Grid.Row="2" Grid.Column="0"> <ListView VerticalOptions="FillAndExpand" RowHeight="100" x:Name="CijeneDetailsList" ItemTapped="CijeneDetailsList_ItemTapped" > <ListView.ItemTemplate> <DataTemplate> <ViewCell> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="180"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto"></RowDefinition> </Grid.RowDefinitions> <StackLayout Spacing="7" Padding="2" VerticalOptions="FillAndExpand"> <Label TextColor="White" FontSize="12" Text="{Binding Klasa, StringFormat='Klasa: {0}'}" FontAttributes="Bold"></Label> <Label TextColor="White" FontSize="12" Text="{Binding Cijena, StringFormat='Cijena: {0} KM'}" FontAttributes="Bold"></Label> <Label TextColor="White" FontSize="12" Text="{Binding BrojKarata, StringFormat='Karata preostalo: {0} kom.'}" FontAttributes="Bold"></Label> </StackLayout> **<StackLayout Grid.Column="1" **x:Name="LayNameLast"** Orientation="Horizontal" HorizontalOptions="End" VerticalOptions="CenterAndExpand" IsVisible="True" > <Entry TextColor="White" x:Name="kolicinaIn" Text="1" IsVisible="True"/> <Image IsEnabled="True" WidthRequest="23" HeightRequest="23" **x:Name="naruciImg"** Source="cart.png" VerticalOptions="Center" IsVisible="True">** <!--<Image.GestureRecognizers> <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"></TapGestureRecognizer> </Image.GestureRecognizers>--> </Image> </StackLayout> </Grid> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> </StackLayout> </StackLayout>out>

I am having issues with using the bolded items in my C# code, I have tried cleaning, rebuilding, restarting the PC, reinstalling packages, changing forms Build Action, even using C# methods for finding the named layout and/or entry, but no luck. I always get **The name kolicinaIn or layNameLast does not exist in the current context error. **

So neither the layout LayNameLast can be accessed, or any of it's members, but I strictly have to have it in this order and I must be able to access it.

Sample ToDo - Downloaded - How do I execute

$
0
0

I have downloaded the sample ToDo List. There are many members in the folder. What member do I click to execute the sample?

Property Setter set multiple times - as many times as a bound subview mentioning it is opened.

$
0
0

Hi guys, I have found an issue....

I have a viewmodel with a ToSection property on it. Both Getter and setter etc. the Viewmodel is bound to my Main View. In my main view I have the command bound that opens a new subview that has the ToSection property mentioned in the xaml - this property is not used by anything else. I set the subview bindingcontext to 'this' - being the viewmodel and I'm pusing it onto the nav stack as follows:

                ToSection = null; // Reset To Section Picker.
                await parent.Navigator.PushAsync(
                    new WmsJobItemsToView
                    {
                        BindingContext = this,
                        Title = string.Format("{0} ({1})", e as string, Items.Where(o => o.Pending > 0).Sum(o => o.Pending))
                    });

However, everytime I press the button to open the subview and then set the ToSection property its setter is being called as many times as I've opened the subview - like it isn't releasing the first one when it is popped off the stack? What am I missing?

Android Vision Sample Code

How can I read data from WiFi in Xamarin.Forms? (Android)

$
0
0

The router will send a package of data in CSV and I have to read it in my Android.

Each app release the SQLite db is overriding and data is getting lost

$
0
0

Using below code for Android..

[assembly: Dependency(typeof(SQLiteService))]
namespace JMMApp.Droid.Services
{
public class SQLiteService : ISQLite
{
public SQLiteService()
{ }

    public string GetFileLocation()
    {
        var documentspath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
        var path = Path.Combine(documentspath, Constant.sqliteDBName);
        return path;
    }
    public SQLiteConnection GetConnection(string path)
    {
       return new SQLiteConnection(path);           
    }
}

Please help me to resolve SQLite overriding issue in IOS and android.

Change background color of ToolbarItems

$
0
0

How do I change the background color and text of ToolbarItems? The default color is black and I would like to change how to do it?

<ContentPage.ToolbarItems>
    <ToolbarItem Order="Secondary" Icon="morevert.png" Text="Atualizar" Command="{Binding Atualizar}"/>
    <ToolbarItem Order="Secondary" Text="Ajuda" Command="{Binding Ajuda}"/>
    <ToolbarItem Order="Secondary" Text="Sair" Command="{Binding Sair}"/>
</ContentPage.ToolbarItems>

Why the Android Emulator don't work all the time in Xamarin?

$
0
0

Every time I should make a setup for new Device in the Emulator, and the application work but after that, the Emulator stop to work and show me this problem message:

> Severity  Code    Description Project File    Line    Suppression State
> Error     The "ResolveLibraryProjectImports" task failed unexpectedly.
> System.IO.FileNotFoundException: Could not load assembly 'devliveryapp, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
> File name: 'devliveryapp.dll'
>    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
>    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
>    at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
>    at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
>    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
>    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()   devliveryapp.Android    

Do you know why?

UI tests with camera

$
0
0

Hello.
I started to write UI tests for my app, for almost all tests I need to scan QRCode to configure my app, have somethink I can do to configure camera In emulator to open a image with QR Code or some way to pass informations in my QRCode?
Thank you.

PopModal immediately followed by PushAsync from modal

$
0
0

I currently have a modal page that now I need to push a new page on to the navigation stack from. I was hoping of a quick solution as opposed to unpicking navigation to the modal that I find myself on. I tried the following

So I want to PushModal -> perform action on page and press save -> Clear Modal -> Add page to navigation stack

I tried the following

    Device.BeginInvokeOnMainThread(async () =>
    {
        await Navigation.PopModalAsync();
        await Navigation.PushAsync(new DetailsPage(vm));
    });

But that just puts me on the page that initially pushed the modal to the screen so its ignoring the subsequent PushAsync. Is there a way of clearing the modal that I am on followed by a navigation all called in one place?

Thanks

Access to the path "/Users/RobWarthen/.config/.isolated-storage" is denied

$
0
0

I'm starting to see a large number of these error messages after upgrading to Xamarin.Forms 2.5. The line in question is checking if the Application.Current.Property for a particular value exists which has always worked before.

/Users/RobWarthen/.config/.isolated-storage" is denied.
at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x0004c] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/mcs/class/corlib/System.IO/Directory.cs:121
at System.IO.Directory.CreateDirectory (System.String path) [0x00075] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/mcs/class/corlib/System.IO/Directory.cs:85
at System.IO.DirectoryInfo.Create () [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/mcs/class/corlib/System.IO/DirectoryInfo.cs:146
at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.Create()
at System.IO.IsolatedStorage.IsolatedStorageFile.PostInit () [0x00035] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs:429
at (wrapper remoting-invoke-with-check) System.IO.IsolatedStorage.IsolatedStorageFile.PostInit()
at System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication () [0x00011] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs:247
at Xamarin.Forms.Platform.MacOS.Deserializer+<>c.b__1_0 () [0x00000] in <1d80e21b8be74ba38bdf2bd5d3e4d5a0>:0
at System.Threading.Tasks.Task1[TResult].InnerInvoke () [0x0000f] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:680 at System.Threading.Tasks.Task.Execute () [0x00010] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2509 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535
at Xamarin.Forms.Application+d__85.MoveNext () [0x0008d] in <81ae0eb290e24f558e192928e3e37a57>:0
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00013] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2166
at System.Threading.Tasks.Task1[TResult].GetResultCore (System.Boolean waitCompletionNotification) [0x0002b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:562 at System.Threading.Tasks.Task1[TResult].get_Result () [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:532
at Xamarin.Forms.Application.get_Properties () [0x00014] in <81ae0eb290e24f558e192928e3e37a57>:0
at DNAGedcomMac.MainPage..ctor () [0x00021] in /Users/robwarthen/dnamac/Views/MainPage.cs:20

Is anyone able to get Firebase Cloud Messaging to work in Xamarin Forms?

Xamarin.Forms.Maps Pin.Clicked Event and Default Pin Image Problems on UWP

$
0
0

I have an Xamarin.Forms application that shows some users on a map with Pin's that have labels and their Clicked event is wired to an event handler. It works without any problems on iOS displaying a nice map, a set of pins which display the associated label on the first tap and the tap of the label allows me to navigate to a detail screen. However, on UWP I get the map with the Pins but:

  1. The Pin.Clicked event only fires on the first time that I tap a pin and does not fire on any tries after that. Additionally the label is now shown. Is this a bug ? Or should I do something specific for UWP ?
  2. Is there are simple way to change the Pin image on the map for UWP - the default black one is too large and ugly.

Any guidance is greatly appreciated.

Error when assigning something to a variable or when assigning it to something (SQLite)

$
0
0

Hello. I am a new Xamarin Forms programmer, and in fact a new-ish programmer. I am trying to save some preferences in an app using a local database with SQLite. I did it with the profile details and everything worked fine. I am trying this with the some preferences and when I try to get a preference in an "if" statement or assign something to it or assign it to something else it is throwing the System.NullReferenceException: Object reference not set to an instance of an object exception. I started with bools and then changed to ints and still nothing works. Any ideas?


Xamarin.Forms Capture Window Close

$
0
0

How do I capture when the user attempts to close the window using the X in the top right? I need to prompt the user to be sure they want to close the window. This is a Xamarin.Forms app using Xamarin.WPF packaged as UWP using a Windows Application Packaging project (WAP).

My problem is that there is no WPF window to capture the close method in. It is a Xamarin Application with a Navigation Pane that hosts a WPF ContentPane using a Renderer. So I think I have to somehow catch this X button click somewhere in the Xamarin side in order to stop it. Since the close is happening in the Xamarin Application not in the WPF Content Page.

It really has nothing to do with WPF I do not think bc they may not even be in the WPF content page yet. The majority of the app is Xamarin.WPF but when they are logging in it is purely a Xamarin.Forms page, they have not even been sent to the WPF portion yet but even then I need to be able to capture them clicking the X button. So I think the question is how to capture the closing of the Xamarin.Forms application and cancel it.

Xamarin.Forms iOS Build Failure

$
0
0

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.

Master detail page: PopModalAsync from detail brings back to root

$
0
0

Hello everyone,

I've been struggling with this super-strange issue.
Here is the flow : from a master-detail page "Catalog" I PushAsync to a page "BookViewPage". Then that "BookViewPage" PushModalAsync an Ad.
The ad close with PopModalAsync, but that brings back the navigation to the Catalog page, not ProductDetails.

Code:
CatalogViewPage.cs

private async void OnItemTapped(Object sender, EventArgs e) 
{
    var selectedItem = ((ListView)sender).SelectedItem;
    var book = (Book)selectedItem;
    var articleView = new BookViewPage(new BookViewModel(book));

    await Navigation.PushAsync(articleView);
}

BookViewPage.cs

    public async void Buy(object sender, EventArgs e)
{
        if (User.CurrentUser == null)
        {
            await Navigation.PushModalAsync(NavigationPageHelper.Create(new SignUpPage(false)));
            return;
        }
    ....
}

SignUpPage.cs

    async void OnCloseButtonClicked(object sender, EventArgs args)
    {
        await Navigation.PopModalAsync();
    }

On close : the navigation goes back to CatalogViewPage.cs

Any help would be greatly appreciated :blush:

How to get the length in seconds of a WAV file?

$
0
0

Hi guys, I have been trying to find out how to get the length of a wave file recording for both Android and iOS.
Can it be done in the PCL, or there are specific platform methods to get this length?

Push Notification(App Center) with SQLITE didn't work with app Closed

$
0
0

Sorry I speak Portuguese, my English is bad
Push Notification(App Center) with SQLITE does not work with the closed app
What can I do to fix it

Viewing all 91519 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>