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

How to change the android bottom tabbar height in Xamarin.Forms

$
0
0

I spent hours searching a way to increase the bottom tabbar height in android in my Xamarin.Forms project. I did not find any Custom Renderer for that instead I found this

<android.support.design.widget.TabLayout 
    ...
    android:minHeight="300dp"
    />

but it also didn't work for me. Can someone has a solution for this please.


Tabbed page is set to the rest of the pages

$
0
0

Hello everyone
I have taken one tabbed page in xamarin project and calling content page from the buttons from tabs but unfortunately
whichever content pages are calling from the button will show the bottom tabs constantly.
I have no clue why the xamarin bottom tabs are sticks to the entire project
Please help!!

How to use IndicatorView with a CollectionView

$
0
0

I need to create the above UI with Xamarin.Forms First I tried using the CarousalView with IndicatorView but the problem is CarousalView always centers the 1st item when I give it a PeekAreaInsert value. That's why i need to use CollectionView instead. But I'm not sure how I can achieve an IndicatorView like functionality with CollectionView. Any idea will be highly appreciated. Thanks

Binding: Mode Two way works well without Break Point, but works strange with it.

$
0
0

I have a an entry which is binded to a string in TwoWay mode.
When it runs without any breakpoints it works well.
When I put a break point in the set of the property and then erase some character in the entry,
it seems to erase all the characters one after an other, until ALL the characters are being erased (The break point is hit again and again and again
instead one time...)
Why is it?

This is the entry:
<Entry x:Name="myEntry" Text="{Binding TheFirstNameOfThePerson, Mode=TwoWay}" />

This is the C# code of the page that contains the entry:

    public partial class MainPage : ContentPage
        {
            public MainPageViewModel MainPageViewModel { get; set; }
            public MainPage()
            {
                InitializeComponent();
                MainPageViewModel = new MainPageViewModel();
                this.BindingContext = MainPageViewModel;
            }
        }

This is the viewModel:

public class MainPageViewModel:INotifyPropertyChanged
 {
    public Person Person { get; set; }
    public MainPageViewModel()
    {
        Person = new Person
       {
           Id = 100,
           FirstName = "Shabi"
       };
     }    

     public string TheFirstNameOfThePerson
     {
         get => Person.FirstName;
         set                   //Here I put the break point
         {
             Person.FirstName = value;
             OnPropertyChanged();
         }
     }

     public event PropertyChangedEventHandler PropertyChanged;
     protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
     {
         PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
     }
 }

This is the model:

    public class Person
    {
        public int Id { get; set; }
        public string FirstName { get; set; }
    }

UWP (Xamarin.Forms) - Failing to create msixupload/appxupload files with x64-x86-arm configurations

$
0
0

When enabling arm in the release architectures build is failing and msixupload/appxupload files are not generating where as selecting x86 & x64 are fine.

Getting following error when enabling ARM

Error ILT0005: '.nuget\packages\runtime.win10-arm.microsoft.net.native.compiler\2.2.3\tools\ARM\ilc\Tools\nutc_driver.exe @obj\ARM\Release\ilc\intermediate\MDIL\MyApp.UWP.rsp' returned exit code 1 MyApp.UWP .nuget\packages\microsoft.net.native.compiler\2.2.3\tools\Microsoft.NetNative.targets

Thanks.

Get record from Xamarin.iOS in Xamarin.Forms

$
0
0

Hello,

i need to get record from keychain via: SecureStorage.GetAsync("xxx");

In Xamarin.iOS app i have this:

 var s = new SecRecord(SecKind.GenericPassword)
                {
                    Label = "Item Label",
                    Description = "Item description",
                    Account = "Account",
                    Service = "Service",
                    Comment = "Your comment here",
                    ValueData = NSData.FromString("Something"),
                    Generic = NSData.FromString("foo")
                };

                var err = SecKeyChain.Add(s);

I tried make native iOS app and i can get from Keychain value of "Account", but no in Xamarin.Forms. Where Xamarin.forms store encrypted data please? Is possible to get(share) some values from iOS in Forms? For example FCM token from Firebase?

Iam new in Xamarin

Thank you for response

Timer Speed is increasing on picker selection change

$
0
0

I am creating a timer which is working on a picker selection changed.Timer is working good until the times end to the "00:00:00".If i change the selection changed in the mid of time then the speed of timer is increased and if i again change selected index than timer run much fast. My problem is that timer should run on 1 sec dealy every time.
I am sharing my code below. Thanks in advance for help.

           private async void GName_SelectedIndexChanged(object sender, EventArgs e)
            {

            lblEndTime.Text = "00:00:10";

            StartTimmer();

            }

         public void StartTimmer()
          {
        Device.StartTimer(TimeSpan.FromSeconds(1), () =>
            {

            Device.BeginInvokeOnMainThread(() =>
          {
              TimeSpan timeSpan = TimeSpan.Parse(lblEndTime.Text);

              timeSpan -= TimeSpan.FromSeconds(1);

              if (lblEndTime.Text == "00:00:00")
              {
                  returnValue = false;

              }
              else
              {
                  lblEndTime.Text = Convert.ToString(timeSpan);

              }

          });

            return returnValue;
        });
     }

Cannot seem to get Xamarin.Forms to work with WPF

$
0
0

I've followed the instructions here: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/platform/other/wpf

But, I'm stuff on probably a simple problem: In my MainWindow.xaml.cs file, on this line:
LoadApplication(new App4.App());
I get the error:
Argument 1: cannot convert from 'App4.App'

This is becaue the "App" from App.xaml.cs is derived from type System.Windows.Application

Should I be changing app.xaml / app.xaml.cs ?


It’s possible convert Xamarin Forms app to Nuget package?

$
0
0

I developed Xamarin Forms app with Android and iOS platforms. I would like to know if it’s possible convert this app in a nuget package and run my app in other app. Of course it would be a nuget package per platform. I know that importing one project into another can, but I want to protect code. I also don't know if nuget packages can have UI.

My application is created with MVVMCross, it has four subprojects: Android, ios, core and UI.
In the UI project has the XAML and CS of views and in the core the viewmodels. On iOS and Android it contains customrenders, interfaces and resources. In addition to the loading of certain plugins in the MainActivity and Appdelegate.
Would I have to rewrite my app to create this? I have tried to create a multi-platform library but I have lost ..... :(

Can you help me??

Thanks a lot

Issue with Android 10

$
0
0

I've been experiencing this issue with my current app after setting target framework to android:targetSdkVersion="29". I've double checked that this happens with a sample application for easier debugging. This is replicated with the WorkingWithNavigation sample app.

Anytime a page is pushed or popped off the navigation stack this error occurs. I'm assuming this has to do with the animation of the navigation.
Any ideas or thoughts on how to fix this issue?

11-09 11:57:51.138 W/avigation.Droi(18447): Accessing hidden field Landroid/view/animation/Animation;->mListener:Landroid/view/animation/Animation$AnimationListener; (greylist-max-p, reflection, denied)
11-09 11:57:51.139 E/FragmentManager(18447): No field with the name mListener is found in Animation class
11-09 11:57:51.139 E/FragmentManager(18447): java.lang.NoSuchFieldException: No field mListener in class Landroid/view/animation/Animation; (declaration of 'android.view.animation.Animation' appears in /system/framework/framework.jar!classes3.dex)
11-09 11:57:51.139 E/FragmentManager(18447): at java.lang.Class.getDeclaredField(Native Method)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.getAnimationListener(FragmentManager.java:1301)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.setHWLayerAnimListenerIfAlpha(FragmentManager.java:1283)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.completeShowHideFragment(FragmentManager.java:1746)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1822)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
11-09 11:57:51.139 E/FragmentManager(18447): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:733)
11-09 11:57:51.139 E/FragmentManager(18447): at android.os.Handler.handleCallback(Handler.java:883)
11-09 11:57:51.139 E/FragmentManager(18447): at android.os.Handler.dispatchMessage(Handler.java:100)
11-09 11:57:51.139 E/FragmentManager(18447): at android.os.Looper.loop(Looper.java:214)
11-09 11:57:51.139 E/FragmentManager(18447): at android.app.ActivityThread.main(ActivityThread.java:7356)
11-09 11:57:51.139 E/FragmentManager(18447): at java.lang.reflect.Method.invoke(Native Method)
11-09 11:57:51.139 E/FragmentManager(18447): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
11-09 11:57:51.139 E/FragmentManager(18447): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

How to design a custom Master Page

$
0
0

Hello Everyone,
I am trying to Design a custom master page. I have attached the image. In this image when user clicks arrow button that time master page should open. and after hiding master page also arrow strip should display as default in all page. But i am not able find any solution for that. Any suggestion please.

Can't select same item twice on CollectionView

$
0
0

I use a CollectionView control to display a list of files, if users click an item a popup appears displaying information about the file and a button to download it, the problem is that i use the SelectionChanged method of the CollectionView to run this action, but if users close the popup and click again on the same item nothing happens. Back when we use ListView control, the ItemTapped event runs every time the users click the same item, but i need to changed to CollectionView because later we'll change the file item from a single row to multiple columns (2 or 3).

It is possible to make the users click on the same item multiple times ?

P.D: also try to set the SelectedItem to null but the app crashes if the users select the same item.

//xamarin92.rssing.com/chan-50630526/article86073-live.html

$
0
0

Hello all,

I am not asking how to but rather why I am not getting the expected $###.## currency format I am supposed to get using either

That is the solution I know and the one every one is proposing. What am I missing?

Thank you!

ListView not updating when adding items to it from another page

$
0
0

I'm trying to fill up or populate a ListView that is instantiated in PageA when the user clicks a button in PageB. I'm doing it sending a message with the MessageCenter in PageB and calling the MessageCenter.Subscribe() method in PageA (the Page where I want to add the new ViewCell or row to the ListView)... but it's not working.

I don't think that the problem is coming from the send/subscribe usage because I have alredy debugged the application and the collection (ObservableCollection) that i'm passing to the ListView.ItemSource property is indeed growning in size. Here you can see the class definitions:

PageA class definition:

PageA .xaml file:

PageB class definition:

I will appreciate a lot the help that you could provide! :smile:

UWP ONLY: How Change Default Background Color On a ListView Item Click/Tap (Selection Animation)?

$
0
0

It's going to be a little tricky explaining this, but stick with me, folks! :) I have a ListView that I'm wanting to customize in a UWP version of a Xamarin Forms application (this is not a problem with my Android or iOS versions; neither of them displays the following behaviors). It seems that when an item in the ListView is clicked/tapped (and then held down momentarily), it reveals a default blue background that fills the view area. I want to change that background to Color.Gold but haven't been able to find any reliable way to make that happen.

My first thought was maybe a VisualStateManager could be used, but I didn't find anything to support my particular situation. I'm wanting to change the color on a click/tap animation for the "outer" view cell while the animation is happening and after it has ended. I am not concerned with any subview controls that are in that same view cell. (Right now such subview controls are inside a Frame and they're not giving me any problems.)

Here's an illustration of what I'm talking about:

The above happens pretty quickly, of course - I've attempted to slow it down here.

I don't think the solution requires a CustomRenderer; it seems that would be overkill for something so simple in theory. But I've searched my entire project for occurrences of the string "Blue" and I didn't see any that were associated with the ListView control.

Each of my view cells contains a styled Frame object (hence the gray rounded rectangles you see in the screen shots above). But I'm hoping there's a way to change those blue flashes to gold ones.

Does anyone at Xamarin have any suggestions for an approach to this? Thanks!!!


How to animate CollectionView items positions in Xamarin Forms

$
0
0

I'm using Xamarin Forms CollectionView in a vertical grid layout.

I have a dynamic grid where the number of columns changes dynamically and each item is sized according to subsequent available width.

I'm trying to animate the respositioning of items within the CollectionView after such column count changes.

Tried to tap into X/Y property changes on the root element of each DataTemplate but got nothing.
Any idea would help!

Here's a sample code of such grid:

<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             SizeChanged="CollectionSizeChanged"
             x:Name="CollectionRoot"
             x:Class="App.Views.DynamicGrid">
    <CollectionView VerticalOptions="FillAndExpand"
                    VerticalScrollBarVisibility="Never"
                    HorizontalScrollBarVisibility="Always"
                    ItemsSource="{Binding CollectionItems}">
        <CollectionView.ItemsLayout>
            <GridItemsLayout Orientation="Vertical" 
                             HorizontalItemSpacing="0"
                             VerticalItemSpacing="0"
                             Span="{Binding NumColumns, Source={x:Reference CollectionRoot}}"/>
        </CollectionView.ItemsLayout>
        <CollectionView.ItemTemplate>
            <DataTemplate>
                <ContentView Padding="0" Margin="0">
                    <Frame BackgroundColor="Green"
                           BorderColor="Red"
                           CornerRadius="0"
                           Margin="0"
                           Padding="0"
                           VerticalOptions="Center"
                           HorizontalOptions="Center"
                           HeightRequest="{Binding ItemHeight, Source={x:Reference CollectionRoot}}"
                           WidthRequest="{Binding ItemWidth, Source={x:Reference CollectionRoot}}"/>
                </ContentView>
            </DataTemplate>
        </CollectionView.ItemTemplate>
    </CollectionView>
</ContentView>

How do I 'move' the clipping rectangle on a SkiaSharp SKCanvas?

$
0
0

I think I am missing a trick with SkiaSharp. It's difficult to explain without diagrams but here goes...

Imagine I have a single canvas that I conceptually want to divide into three columns. Now imagine I want to draw different shapes into each of the three columns but I want the shapes to clip at the column boundaries. And finally I want to draw a shape that extends over the whole canvas.

I can change the clipping rectangle to draw in the first column. When it comes to drawing in the second, how do I do this? If I call ClipRect() again, the second rectangle is combined with the first (either subtracted or intersected). What I want to do is clear the first clip rectangle I set, or somehow reset the clipping rectangle to be the whole canvas.

And when it comes to drawing my final shapes that fill the whole canvas, I definitely need to put the clipping rectangle back to being the whole canvas.

How would I do this?

Kind wishes - Patrick

Build Options iOS

$
0
0

I am Curious what is the best build option .

x86_64 or i386 + x86_64

i386 is for older iphone like 4s or 5 i think , but what is most used ?

And what about LLVM optimizing compiler

How to give camera and microphone permission to WebView with Xamarin.Forms on Android?

PopToRootAsync with Modal

$
0
0

Navigation.PopToRootAsync() throws and exception when the page on top of the stack is a modal. Is there any work around for this?

Viewing all 89864 articles
Browse latest View live


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