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

Download new Xamarin CSS at runtime

$
0
0

I see that Xamarin using CSS to style the pages uses an EmbeddedResource.

I want a default CSS file and then download a file at Load time to style the app based on Client CSS. Is it possible either to extend or override the Embedded CSS file or can I do something crazy to embed another resource at runtime?


Not found type gridview

$
0
0

I try add gridview like in example on docs.microsoft, but VS says: this type not found.
What i doing wrong?
I jast need Grid with ItemsSource.

All of my data in my Observable collection is the same, how do I fix this?

$
0
0

Hey,

I have a binding to an ObservableCollection that keeps overwriting all the data in the collection with whatever is current when I attempt to add to the collection or whenever the current data itself is changed. I know there is a simple fix for this but I'm not sure what I am missing.

Localized App Name for Xamarin.iOS

Passing values between 2 opened pages

$
0
0

Hey, so in my application I am using Master and Detail page. When Detail page opens I will go to the Master (slides from the left side) and I check checkbox. I want that value pass to my Detail page. In debug mode I can see method clearly called and good value is there, but when it ends, nothing happens, can you help me?

private void Button_CheckedChanged(object sender, CheckedChangedEventArgs e)
{
if (ckeck.IsChecked == true)
{
Page2 p2= new Page2 ();
p2.dajCheck("value", true);
}
else
{
Page2 p2= new Page2 ();
p2.dajCheck("spomenici", false);
}
}

This is send value from Master to Detail, is it a good way?
I can't find anything else...

THX! :-)

Linking not working

$
0
0

hey guys i am getting this error
I have a xamarin forms project with .netstandrad library version 2.0.
One api project with ef6 and that dll is included in xamarin forms project . When i am trying to make android build with linker enable.SDK only iam getting this error

System.InvalidCastException: Unable to cast object of type 'System.Byte' to type 'System.String'.

at Mono.Cecil.MetadataBuilder.GetConstantSignature(ElementType type, Object value)
at Mono.Cecil.MetadataBuilder.AddConstant(IConstantProvider owner, TypeReference type)
at Mono.Cecil.MetadataBuilder.AddField(FieldDefinition field)
at Mono.Cecil.MetadataBuilder.AddFields(TypeDefinition type)
at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
at Mono.Cecil.MetadataBuilder.AddTypeDefs()
at Mono.Cecil.MetadataBuilder.BuildTypes()
at Mono.Cecil.MetadataBuilder.BuildModule()
at Mono.Cecil.ModuleWriter.b__0(MetadataBuilder builder, MetadataReader _)
at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)
at Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Stream stream, WriterParameters parameters)
at Mono.Cecil.ModuleDefinition.Write(Stream stream, WriterParameters parameters)
at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
at Mono.Cecil.AssemblyDefinition.Write(String fileName)

Its happening on Oracle.ManagedDataAccess.dll
I tried with skipping this assembly.Tried with enabling proguard.

How can I setup icons in my menu?

$
0
0

Hello, I am working on a project that I would like to eventually try to release as an IOS app as well as android. I'm using the PCL code to build the bulk of my code, which is leading me to several issues.
One of which is simply this, the bulk if not all of my forms code is in the PCL project, which limits my form controls (annoying), but also means I cannot figure out how to add icons to my menu options for my master detail view.
I understand they have to be added in my platform specific code, but does this mean that I need to define and build all of my menus and forms in the platform specific area? I suppose this wouldn't be all that bad since it would also allow me to use the controls I want (editable spinner, autocomplete textbox, etc).
Am I just making this harder than it needs to be, by trying to build my forms in the PCL?

Thanks!

Where did Android SDK go?

$
0
0

I updated Visual Studio 2017 on Windows today, from v15.9.13 to v15.9.14 and now the Android tools are gone:

How can i get them back? Without those tools I can't archive my Android app.
Thanks!


I cant seem to deploy a local build on my iPhone with VS 2019

$
0
0

I recently downloaded and installed Visual Studio 2019 to run my Xamarin Forms project. I added my apple user to the Visual Studio options and downloaded all the provision profiles. I also right clicked properties on the iOS project and verified that my apple cert and profile show. Then I connect to my mac host and attempt to deploy to my iPhone (which worked before)...and the error I get is "Could not find any available provisioning profiles for iOS". I triple checked and made sure my device, cert and provision are all connected and are all good and they are. Is anyone else having issues with this on Visual Studio 2019?

Video shows white screen in android while working fine in iOS

$
0
0

Hi everyone just stuck in a issue where videoview is not showing the video but audio is coming and in ios its working fine and if i change the droid VideoRenderer (videovie.SetZOrderOnTop(true)) than video come above all the views and i am not than able to use even play/pause button

Hot reload coming to Xamarin Forms

How to load image with imgcrop:ImageCropView?

$
0
0

I am trying to upload image using the DLToolkit.Forms.Controls.ImageCropView , but it is not load nothing

Code:

   <imgcrop:ImageCropView
                       WidthRequest="100" HeightRequest="100"  x:Name="cropView" Source="http://photos2.insidercdn.com/iphone4scamera-111004-full.JPG">
     </imgcrop:ImageCropView>

Problems to build: error with Microsoft.Build.Framework.ITaskItem ?

$
0
0

Hi all

I work with a project based on “Blank app Xamarin.Forms (Shared)” and am on the way to try ship my app to the shops (what is a pain b.t.w. :smirk:).

By my tries, I abruptly had a new (never seen before) error-message to my iOS-project, was not able to build anymore and have lost almost a day now to fix the problem…
I then have searched the internet for every peace (word) of the error-message and found a Stackoverflow message to Visual Studio (without Xamarin-Tag)

The solution was, to uncheck the checkbox “Activate ClickOnce security settings” on the security-tab to my iOS-project.

I never have changed anything on the security tab explicitly and also don’t see the hang-together with the error-message

Therefore I post the error-messages here, hope this message is found and help someone… :sunglasses:

Example error-message in German:
"app.config;obj\iPhone\Debug\MatrixGuide.iOS.csproj.MatrixGuideiOSapp.exe.config" ist ein ungültiger Wert für den ConfigFile-Parameter der GenerateApplicationManifest-Aufgabe. Es können nicht mehrere Elemente an einen Parameter vom Typ "Microsoft.Build.Framework.ITaskItem" übergeben werden. C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets

Example error-message in English:

C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(3243,9): error MSB4094: "app.config;obj\x86\Debug\EnergyMS.csproj.EnergyMS.exe.config" is an invalid value for the "ConfigFile" parameter of the "GenerateApplicationManifest" task. Multiple items cannot be passed into a parameter of type "Microsoft.Build.Framework.ITaskItem".

" Language Localization " using xamarin native for Android

$
0
0

My issue was If I select Language other than English the text was not changing to that particular language.Below is my code
_title.Text = Resources.GetText(Resource.String.Personalize_Countries);
_browseCountries.Text = Resources.GetText(Resource.String.GroupSubSelectionScreen_BrowseCountries);

How can I resolve this issue please help me on this

horizontal listview cant get full width it shrink, any solution?

$
0
0
               <Grid HeightRequest="50" HorizontalOptions="FillAndExpand" BackgroundColor="Pink">
                    <ListView x:Name="HorizontalBallList" BackgroundColor="LightBlue" Rotation="90" HeightRequest="50" HorizontalOptions="Start" 
                           WidthRequest="30" SelectionMode="None" SeparatorVisibility="None"  ItemsSource="{Binding Balls}">
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <ViewCell>
                                    <Frame Padding="0" Rotation="-90" HeightRequest="240" CornerRadius="50" IsClippedToBounds="true">
                                        <Label TextColor="Yellow" VerticalOptions="Center"  HorizontalOptions="Center"> </Label>

                                    </Frame>
                                </ViewCell>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                </Grid>

this is a list view inside a grid, there in the viewcell will show a label which is in the frame because i want a round shape label.
this listview should give full width on the phone but just showing very small on the left corner. please help


How to properly authenticate user with Linkedin for both IOS and Android platforms

$
0
0

Hello. I have been looking around to implement login with Linkedin. I have become confused since I have found out that many people use OAuth to authenticate (such as https://forums.xamarin.com/discussion/14883/login-with-linkedin) but the GetUI function of the OAuth only works in Android and not Xamarin forms:

    var intent = auth.GetUI(ctx);
            StartActivity(intent);

Also the StartActivity is Android specific. How can I authenticate in PCL solution or replace the code above to fit for IOS as well?

How the flex layout auto fit to controls height?

$
0
0

When working in a Xamarin Phone app have 10 buttons whose visibility will be set on conditions, 3 buttons, some times 5 buttons. So I places this buttons in a flex layout. but the flex layout occupies more space, which is extra space in the layout

[iOS] System.ArgumentOutOfRangeException when i launch the app

$
0
0

I am not sure if this is because i updated Xamarin Forms or VS for Mac or what. But it looks like a Xamarin Forms issue.
But now in iOS when i launch my app on a simulator I get this weird exception that I've never seen before.
It happens during the splash screen:

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.10.0.157/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs:161
at Foundation.NSNotificationCenter.RemoveObserversFromList (Foundation.NSObject observer, System.String aName, Foundation.NSObject anObject) [0x00010] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.10.0.157/src/Xamarin.iOS/Foundation/NSNotificationCenter.cs:131
at Foundation.NSNotificationCenter.RemoveObserver (Foundation.NSObject observer) [0x0004e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.10.0.157/src/Xamarin.iOS/Foundation/NSNotificationCenter.g.cs:177
at System.Net.Http.NSUrlSessionHandler.RemoveNotification () [0x00008] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/src/Foundation/NSUrlSessionHandler.cs:187
at System.Net.Http.NSUrlSessionHandler.RemoveInflightData (Foundation.NSUrlSessionTask task, System.Boolean cancel) [0x0004f] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/src/Foundation/NSUrlSessionHandler.cs:216
at System.Net.Http.NSUrlSessionHandler+NSUrlSessionHandlerDelegate.DidCompleteWithError (Foundation.NSUrlSession session, Foundation.NSUrlSessionTask task, Foundation.NSError error) [0x0005b] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/src/Foundation/NSUrlSessionHandler.cs:471

Anybody else? Any idea how to get it to work again?
Thanks!

SwipeGestureRecognizer in a ListView

$
0
0

Hi,
I'm trying to use a SwipeGestureRecognizer in a ListView so that I can swipe a row, and execute an action on that row. Unfortunately I can't get it to work as I would like. I have the following ListView definition.

            <ListView x:Name="todoList"
                      IsPullToRefreshEnabled="true" 
                      Refreshing="OnRefresh" 
                      SeparatorVisibility="Default"
                      Grid.Row="1">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <ViewCell.ContextActions>
                                <MenuItem Clicked="OnComplete" Text="Complete" CommandParameter="{Binding .}"/>
                                <MenuItem Clicked="OnDelete" Text="Delete" IsDestructive="True" CommandParameter="{Binding .}" />
                            </ViewCell.ContextActions>
                            <StackLayout HorizontalOptions="StartAndExpand" Orientation="Horizontal" Padding="15,5,10,10">
                                    <Label Text="{Binding Name}">
                                        <Label.GestureRecognizers>
                                            <SwipeGestureRecognizer Direction="Left" Swiped="OnSwiped" CommandParameter="{Binding .}"/>
                                            <SwipeGestureRecognizer Direction="Right" Swiped="OnSwiped" CommandParameter="{Binding .}"/>
                                        </Label.GestureRecognizers>
                                    </Label>
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

If I put the SwipeGestureRecognizer in the ListView i.e. just above ListView.ItemTemplate, it calls the OnSwipe method, but the SwipedEventArgs.Parameter is always null, so I can't determine which row was swiped. If I put the SwipeGestureRecognizer in the Label (as displayed) it calls OnSwipe, and the Parameter has the correct value, however, it only works if the actual label is swiped; if I swipe anywhere else in the row, OnSwipe doesn't get called. I've also tried putting it inside the StackLayout, but then OnSwipe isn't called at all. I would have thought it should go in the ViewCell, but that doesn't compile.

There is a (very old) Forum question about this, but it recommends using ContextActions, but they just seem to use MenuItems, not swipe gestures. Is there a way to swipe anywhere on a ListView row, and get it to call OnSwipe with the required values in SwipedEventArgs.Parameter (or is there an alternative to this).

MVVM ListView MenuItem ObservableCollection Delete Item

$
0
0

Hi, I need to delete an item in my listview but it doesn't work
Here, xaml :

<ListView Grid.Row="4" Grid.ColumnSpan="3"
                ItemsSource="{Binding PaymentLines}"                               
                RowHeight="70" x:Name="items">
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <ViewCell>
                                    <ViewCell.ContextActions>
                                        <MenuItem  BindingContext="{Binding Source={x:Reference TicketRecapView}, Path=BindingContext}" Command="{Binding  DeleteCommand}" Text="Supprimer" IsDestructive="True" />
                                    </ViewCell.ContextActions>
                                    <Grid VerticalOptions="Center">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>                                       

                                        <Label Grid.Column="0"
                                       HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"
                                       FontSize="13"
                                       Text="{Binding Name}" />
                                        <Label Grid.Column="2"
                                       HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"
                                       FontSize="13"
                                       Text="{Binding Price}"  />
                                    </Grid>
                                </ViewCell>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>

Here my VM :
public PaymentConfirmationVM() {

    PaymentLines = new ObservableCollection<PaymentLigne>();

}

#region PaymentLines property
        ObservableCollection<PaymentLigne> _PaymentLines;

        public ObservableCollection<PaymentLigne> PaymentLines
        {
            get { return _PaymentLines; }
            set { SetProperty(ref _PaymentLines, value); }
        }
        #endregion

        #region Delete Command

        Command<PaymentLigne> _DeleteCommand;

        public Command<PaymentLigne> DeleteCommand
        {
            get { return GetProperty(ref _DeleteCommand, () => new Command<PaymentLigne>(Ligne => Delete(Ligne))); }
        }
        void Delete(PaymentLigne Ligne)
        {
            PaymentLines.Remove(Ligne);
        }

And here, my object observable :

public class PaymentLigne
    {
        public string Name { get; set; }
        public decimal Price { get; set; }

    }

I have an error when i put just a Command="{Binding DeleteCommand}" cause my object doesn't have the function DeleteCommand.
So i tried to put a reference for using the DeleteCommand in my VM. I don't know how to link, I think the problem is easy but I don't found a topic with MVVM.

Thx

Viewing all 91519 articles
Browse latest View live


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