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

What does this mean?? I get this each time I build after coming back to the project!

$
0
0

This makes no sense to me... I get this error each time I come back to this bloody project... it tell me when I go build the android project in xamarin forms...
Af first it seem like the solution was to switch the selectors at the top of visual studio debug to x86 my android project and click the green error and the android project would in the android emulator...

Now it will not do that and I don't know why... can any one lend any insight on this...
Thanks!

Error ADB0020: The package does not support the CPU architecture of this device.
at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) in E:\A_work\21\s\External\androidtools\Mono.AndroidTools\Internal\AdbOutputParsing.cs:

line 337 at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass95_0.b__0(Task`1 t) in E:\A_work\21\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:

line 753 at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke() at System.Threading.Tasks.Task.Execute()0 Build

This is the warning which may be more helpful

Warning There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "My App Location", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. MyApp.Android


how to display .gif image as launch screen(splash screen) in xamarin forms ios

$
0
0

how to display .gif image as launch screen(splash screen) in xamarin forms ios.i have idea in xamarin forms android but i don't have idea in ios.please share with me if any one have idea

Showing Navigation Bar instead of Back Button within a detail page

$
0
0

I chose a Master Detail Page as main page. My detail pages are content pages.
If the user is on the first/start page and clicks a button, another page will be pushed via Navigation.PushAsync(). On this page, normally the back button will be shown. But I don't need the back button there. I need the navigation icon to open the menu.
How can I do this? I just know that I can dispose th back button..
Setting NavigationPage.HasNavigationBar to true doesn't change anything..

And how can I prevent the users from clicking the back button from their smartphone?

How take a SkiaSharp SKData and write out a pdf?

$
0
0

Our app uses SkiaSharp and Xamarin Forms to create sketches. We can take a completed sketch and write it out as a jpg.
SKData skData = surface.Snapshot().Encode(); using (Stream stream = File.Open(fileout, FileMode.OpenOrCreate, System.IO.FileAccess.Write, FileShare.ReadWrite)) { skData.SaveTo(stream); }

How do I write it out as a pdf?

One step is to create an SKDocument like this:
SKDocument skDocument = SKDocument.CreatePdf(SKWStream, dpi);
How do I turn the SKData into an SKWStream?

Thanks for having a look at this.

Searchbar in TitleView does not fit

$
0
0

Hello,

I have been struggling with NavigationPage.TitleView new feature (XF >3.2) and what seems to be a bug or a lack of development from the xamarin team's part.
I am trying to integrate a searchbar in the navigation bar. As you can see on the following picture I can't get rid of useless gaps nearby the back button Moreover the right of the searchbar finishes outside of the screen when I use FillAndExpand. I think that both of these problems are related.

My code :
<NavigationPage.TitleView> <StackLayout Orientation="Horizontal" Margin="0" Padding="0" HorizontalOptions="FillAndExpand" BackgroundColor="Red" Spacing="0"> <SearchBar Margin="0" HorizontalOptions="StartAndExpand" Placeholder="{Binding SearchPlaceHolder}" TextColor="{StaticResource OddColor}" PlaceholderColor="{StaticResource SecondIconColor}" BackgroundColor="Transparent" Text="{Binding Keyword}" FontSize="16" CancelButtonColor="{StaticResource OddColor}" SearchCommand="{Binding SearchCommand}"> </SearchBar> </StackLayout> </NavigationPage.TitleView>

Is there any workaround for this? It seems to me that XF calculates the width of the screen to adjust the searchbar width but does not take into account the backbutton's width. I would prefer not to set the width of the searchbar by myself.
Regards,

[Xamarin forms picker] is it possible to define a color on a picker item ?

$
0
0

Good morning, everyone,

I would like to know if it is possible to assign a color to an element of a picker in relation to the id of the element.

I tried and searched on the web, but I couldn't color the text that is in the picker selection. I only managed to color the picker text with the property [TextColor = "myColor"].

for information know that I program on visualstudio 2017 business with xamarin.Forms with as operating system android.

is that possible?
thank you in advance for your answers

cordially Camille

Newbe question (Linking to a Visual Basic class library)

$
0
0

I want to develope a mobile application for my company using Xamarin.

I have got to grips with basics of Xamarin to the point at which and want to start using my companies standard routines for inter process communications (TCP/IP messages).

All of these standard routines are part of a visual basic class library. I have added a reference to the class library under "project" and I can access the routines in C++ code (e.g. "Produce.Send_message (type, Message);"

When I went to test to see is a message was sent, it initally said it could reference the visual basic runtime, add a NuGet package.

So I did, I found the Microsoft.VisualBasic NuGet runtime and installed that.

Now when I go to test the code, it just hangs and does nothing.

And now I'm stuck.

Before someone says just rewrite into C++ I should say there are a lot of routines coded in the class library that I will want to use (they are all tested and working exteremly well) so I really want to avoid rewriting it all into c++.

Can any one help me?

File not found: Assets.xcassets/AppIcon.appiconset/Contents.json

$
0
0

Hi,

I'm trying to build my Xamarin Forms app for iOS from VS2017 running on my Windows machine and I get the error below. Any idea why the Assets.xcassets folder is not created on the mac build?

1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(1216,3): error : File not found: /Users/cornellupu/Library/Caches/Xamarin/mtbs/builds/ChessNutCP.iOS/3422374c274ef8287bab589e9911d096/Assets.xcassets/AppIcon.appiconset/Contents.json

Thank you!


Can not find Android App template after I re-installed VS2017

$
0
0

Before I Re-Installed VS2017 When I followed the instructions Click > New > Project to create a new project. In New Project dialog, click the Android App template I found Android. But since I re-installed VS2017 I do not have a Android App template. What must I do?

Error CS0656 Missing compiler required member "microsoft.csharp.runtimerbinder.binder.convert"

$
0
0

Error CS0656 Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.Binder.Convert' App1 C:\Users\user\OneDrive\desktop\folder\App1\App1\App1\Services\ApiServices.cs line 66 Active

The error is apparently due to this line of code -->JObject jwtDynamic = JsonConvert.DeserializeObject(content);
I have tried adding a refrence to Microsoft.CSharp in the android project (which is the project i use on my emulator). And I have tried to install the Microsoft.CSharp nuget package. Nothing seems to work, so any tips are appreciated.

Release Version works but gives many warnings: but no debug symbols file was found.

$
0
0

Using latest release, I am getting the following only on a Release build even though the app works fine:

Severity Code Description Project File Line Suppression State
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.GooglePlayServices.Tasks.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.v7.MediaRouter.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.GooglePlayServices.Base.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Arch.Core.Common.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Arch.Lifecycle.Common.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Forms.Maps.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.v7.CardView.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.Annotations.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.Vector.Drawable.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.Transition.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Forms.Platform.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.Media.Compat.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.Fragment.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.GooglePlayServices.Basement.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains MyToolkit.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.v4.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.Design.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.Core.Utils.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Forms.Maps.Android.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.Core.UI.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.v7.Palette.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.GooglePlayServices.Maps.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Java.Interop.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Plugin.CurrentActivity.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.v7.RecyclerView.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.Animated.Vector.Drawable.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.Compat.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Support.v7.AppCompat.dll but no debug symbols file was found. 0
Warning Directory obj\Release\MonoAndroid90\android/assets contains Xamarin.Android.Arch.Lifecycle.Runtime.dll but no debug symbols file was found. 0

I have tries all advice from other similar threads but non solve this issue.

Anyone able to solve this?

Nathan

How to add buttons into the renderer map pin?

$
0
0

Is it possible to add some buttons into the rendered map pin and every button can trigger its associated event? If so, how to do it?

Is it ok/ good practice to use preferences in xamarin as switches?

$
0
0

Is it a bad practice to use a preference like this:

Preferences.Set ("USE_CUSTOM_SOUND_KEY", true);

and then somewhere in the app:

var useCustomSound = Preferences.Get("USE_CUSTOM_SOUND_KEY", false);

if (useCustomSound)
{
     // use custom sound for action
}

And if its ok, is there a limit to how many of these preferences can be set and used as global app switches within the app?
Any downsides?

Segmented Circle View, Radial percentage control

Prevent webview from loosing focus on iOS

$
0
0

I'm trying to create an editor using Xamarin Forms.
The editor is a webview with content editable and a toolbar below.

The way i'm doing it with the following structure:

Grid with two rows
-->WebView [Row 1]
-->ScrollView with horizontal Scroll [Row 2]
---->Stacklayout (with editor actions)
---------> Pick Photo
---------> Bold
---------> Underline
---------> ...

It works well on Android, when i tap on the buttons, it executes the javascript on the webview,the keyboard remains open and the webview doesn't loose focus.

On iOS the webview looses focus and the keyboard closes.
Like this:

https://drive.google.com/file/d/1gO2AdLUy2VYTVNyhAaypaGGQ2mT6RcJ5/view?usp=sharing

Any idea on how can i solve this ?


UIScrollCustomRenderer with Transparent Navigation Page Bug

$
0
0

Hey,

At the moment I have the problem that the UIRefreshControl of a Transparent Nav Bar is hidden behind the Notch.

With the ScrollView I set the property "ContentInsetAdjustmentBehavior" to Never, so that content appears behind the Nav Bar.

If I now want to reload the list and I pull down the ScrollView, the UIRefreshControl is not displayed correctly.

Can I give the UIRefreshControl a margin so that the indicator becomes visible?

Screenshot: "us.v-cdn.net/5019960/uploads/editor/1z/exi5kq6lphow.png"

Edit: XAML Code: Just for testing

Pull to Refresh is from here: "github.com/jamesmontemagno/Xamarin.Forms-PullToRefreshLayout"

"pulltorefresh:PullToRefreshLayout >

        <customcomponent:TransparentNavigationScroller >

            <Grid BackgroundColor="Yellow">
                <Grid.RowDefinitions>
                    <RowDefinition Height="200" />
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <ContentView>
                    <Image BackgroundColor="Blue"/>
                </ContentView>


                <controls:StackedList Grid.Row="1"  ItemsSource="{Binding BlogEntries}"  BackgroundColor="Pink">
                    <controls:StackedList.ItemTemplate>
                        <DataTemplate>
                            <Grid BackgroundColor="Gray">
                                <Label Text="{Binding ., FallbackValue='No value'}"/>
                            </Grid>
                        </DataTemplate>
                    </controls:StackedList.ItemTemplate>
                </controls:StackedList>


            </Grid>
        </customcomponent:TransparentNavigationScroller>
    </pulltorefresh:PullToRefreshLayout>"

New Simple WebView plugin for Forms

$
0
0

Hey guys,
Time and time again I seem to be repeating myself in generating custom renderers for customers who wish to have a "Hybrid" applications built on the Forms framework.

Many of you will already use HybridWebView as included in the XLabs framework and that is fine, this is not a replacement!.
However I have had customers before question the additional bloat this brings as well as the nightmare of setting it up every time which was a blocker when I was first learning the framework.

It is because of this I created a simple plugin design to give quick and easy access to a lot of shared WebView API's and felt like I may as well share it with everyone else, as I know a lot of people just starting to learn this platform have ran into this blocker as me in the past.

You can access the Nuget and GitHub using the following links:
https://nuget.org/packages/Xam.Plugin.WebView/1.0.0
https://github.com/SKLn-Rad/Xam.Plugin.Webview

It would be great to get your feedback as well as the benefit of free testing! ;)
So feel free to throw any questions my way if so desired. I am a Java developer originally so my C# could always be improved!

P.S: I really think this forum needs a subsection for community projects to encourage and better index stuff like this... don't you think? :smile:

~ Ryan

Xamarin Forms MasterDetail Navigation Page Customizable

$
0
0

I have Created MasterDetail Navigation with Name and icon, I want that when click in icon so open AddDetail Page and when click in Name So open list page.

Xamarin Forms MessagingCenter Subscribe called two times

$
0
0

I'm clicking on a product item in listview in product page viewmodel to show a popup(using rg.plugin popup) for selecting one of the product variants.After selecting variant,i am sending the selected variant to product page using messagingcenter from variant popup page viewmodel. subscribed in product page viewmodel constructor. working fine there.after that when i navigate to the next page and then came back to the product page for adding one or more variant to the same previously selected product,Messagingcenter subscribe called twice and product value increased twice.Tried to subscribe in the product page onappearing and unsubscribe in disappearing method.still calling two times? How to solve this issue?

calling popup:

var result = await dataService.Get_product_variant(store_id, product_id);
                if (result.status == "success")
                {
                    ind_vis = false;
                    OnPropertyChanged("ind_vis");

                    App.Current.Properties["product_variant_result"] = result;
                    App.Current.Properties["cartitems"] = purchaselist;
                    App.Current.Properties["selected_product"] = product_List2 ;
                    await PopupNavigation.Instance.PushAsync(new Popup_variant());                   
                }

popup viewmodel: sending message

public Popup_variant_vm()
        {
            Radio_btn = new Command<Product_variant_list2>(Radio_stk_tapped);
            product_variant_list = new List<Product_variant_list2>();
            purchaselist = new ObservableCollection<Product_list2>();            

            show_variants();            
        }

        internal void Confirm_variant()
        {
            if(App.Current.Properties.ContainsKey("selected_variant"))
            {
                 MessagingCenter.Send<Popup_variant_vm, object>(this, "selected_variant", App.Current.Properties["selected_variant"]);
             //    MessagingCenter.Unsubscribe<Popup_variant_vm>(this, "selected_variant");

            }
            else
            {
                DependencyService.Get<IToast>().LongAlert("Please select any size");
            }
        }

product page viewmodel: subscribed here..called twice when navigating from next page to this

public store_page_vm()
        {
            ind_vis = false;
            show_pdt = new Command<Category_data>(Show_product);
            Addtocart = new Command<Product_list2>(Addcart);
            purchaselist = new ObservableCollection<Product_list2>();
            Device.BeginInvokeOnMainThread(Refresh);
            //MessagingCenter.Subscribe<Cart_page>(this, "cart_page_disappear", (sender) =>
            //{
            //    Device.BeginInvokeOnMainThread(Refresh);
            //});
            MessagingCenter.Subscribe<Popup_variant_vm, object>(this, "selected_variant", async (sender, selected_variant) =>
            {
                 var selected_product = (Product_list2)App.Current.Properties["selected_product"];
                selected_product.min_plus_visible = true;
                selected_product.grid_visible = false;
                var selected_variant_size = (Product_variant_list2)selected_variant;
                Product_list2 product_List2 = new Product_list2();
                product_List2.product_id = selected_product.product_id;
                product_List2.id = selected_product.id;
                product_List2.product_name = selected_product.product_name;
                product_List2.no_of_variant = selected_product.no_of_variant;
                product_List2.variant_id = selected_variant_size.id;
                product_List2.variant_name = selected_variant_size.value;
                product_List2.variant_price = selected_variant_size.selling_price; 
                add_to_cart(product_List2);
            });

        }

Tried to subscribe in product cs page onappearing:

public Store_page()
        {
            InitializeComponent();

        }

        protected override void OnAppearing()
        {
            base.OnAppearing();

            var vm = new store_page_vm();
            vm.Navigation = Navigation;
            BindingContext = vm;

            MessagingCenter.Subscribe<Popup_variant_vm, object>(this, "selected_variant", async (sender, selected_variant) =>
            {
                var vm1 = BindingContext as store_page_vm;
                vm1?.Addcart2(selected_variant);
            });
        } 

unsubscribed in product cs page

protected override void OnDisappearing()
        {
            var vm = BindingContext as store_page_vm;
            vm?.Save_cart();

            MessagingCenter.Unsubscribe<Popup_variant_vm>(this, "selected_variant");

        }

Backup a SQLite dabase to access throug telefon downloadfolder.

$
0
0

Hi I have search and search on how get access to files so you can download it through usb cable. (in the end)

This is a .Net Standard 2.0 projekt and All that is left on the app (before I want to use it my self) is a backup thing of the database.

I have found a lot of things pre .Net Standard 2.0. Not that much after..

this is what I have now. In my Android code.

        public string GetExternalFilePath(string filename)
        {
            string path = Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads).AbsolutePath;
            return Path.Combine(path, filename);
        }

        public void SaveFile(byte[] filedata, string fileName)
        {
            string path = GetExternalFilePath(fileName);
            FileStream fs = new FileStream(path, FileMode.Create);
            fs.Write(filedata, 0, filedata.Length);
        }

I have added Write_External_Storage / Read_External_Storage + Write_User_Directory / Read_User_Directory also . I also found a some one deleting the app from the phone and re add it + set the Read/Write external on the app it self.

None of it worked.

Should this work or is the code / settings wrong? I'm going mad... lol..

//Fredrik

Viewing all 89864 articles
Browse latest View live


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