Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

Showing scrollbar in elements at page load

$
0
0

Hello. I am using an ScrollView for the whole page but it seems like every element shows a scrollbar too i don't know why.
https://i.gyazo.com/0f5a3f3bfeb166d38396e95dd3b7b4e4.mp4
The scrollbar doesn't work obviously becouse there's only 1 in the whole page.
How can I make it not show an scrollbar when page loads?

Thank You


Upgraded VS (Windows), Mac OS, Xcode and nothing is working!

$
0
0

All was well before the upgrade. Upgraded to support required iOS 13 SDK.

I updated VS 2017 Pro: VS 2017 Pro (15.9.21)
I had to update the Mac OS : Mac macOS Catalina
I updated Xcode: Xcode 11.4 (11E146)

I can connect fine to the Mac build host
The app compiles
The Remote Simulator to Windows just showed a blank screen
At some point, I did see the app running on the simulator on the Mac, but that does not seem to work anymore.
I tried a brand new project
I uninstalled and reinstalled XCode

I am not getting consistent errors.

Story Board editor will not load.
Will not run on device
When I try to run on the simulator, it just get the MT1008 error (see below). Fix for that did not work.
I cannot compile my original project.

The app has been terminated.
Launch failed. The app 'App1' could not be launched on 'iPhone 11 Pro iOS 13.4'. Error: error MT1008: Failed to launch the simulator: NSInvalidArgumentException: -[SimDevice registerNotificationHandler:]: unrecognized selector sent to instance 0x7fafa6dde890. Please check the logs for more details.
The app has been terminated.

I have tried several things in posts on that I have found. Noting seem to work.
As noted, I can connect to the Mac build host fine.

Been working on this for about 8 hours. Any suggestions would be greatly appreciated.

Assign ListView to Slide Out Menu

$
0
0

I am writing to ask about assigning a ListView to an existing Content Page - as a Slide Out menu (from right side) in Xamarin Forms for IOS;

Working with a MasterDetailPage, and setting FlowDirection to "RightToLeft" works well in a prototype application; however, not sure if a MasterDetailPage can be embedded into an existing ContentPage; the ideal solution does not use Custom Renderers in iOS project;

Is it possible to assign a ListView to a right-to-left slide out menu in an existing Content Page - with a "roll your own" process, using C# code-behind?

Thanks in advance for insight, guidance;

Problem with android.permission.FOREGROUND_SERVICE on API 29

$
0
0

Hi,

I am using a service in the same manner/setup as this example: https://github.com/xamarin/mobile-samples/tree/master/BackgroundLocationDemo

It works great on API 28 and below. However, when I run it on API 29 it crashes and says it needs permission for android.permission.FOREGROUND_SERVICE.

I have now added the line:

in my AndroidManifest.xml (just above initial tag) but it still crashes, do I need to request/do something more to make it work for API 29 and above?

Thanks!

Xamarin.UITest project targeting .NET Framework vs .NET Core (& .NET Standard implentation support)

$
0
0

Hi All,

Quick question to do with target frameworks for Xamarin.UITest and other business logic unit testing projects.

I had previously created a (.NET Framework) unit testing project for my business logic for an app and the unit testing project which was fine at the time and it wasnt until this week that I did some package updates and one of my packages being updated was using latest .NET Standard 2.1 which forced me to update my Xamarin.Forms shared project to also target 2.1 and I then I discovered that there is no implementation support with any .NET Framework with .net standard 2.1 which caused issues between both project Unit Testing project and my Forms project (below and here: https://docs.microsoft.com/en-us/dotnet/standard/net-standard)

In any event I migrated unit testing project for my business logic from .NET Framework to .NetCore and that resolved my issues and all worked fine again for both projects but when I went to create a new Xamarin.UITest project for another app i.e. "Xamarin.UITest Cross-Platform test project" it also targeted .NET Framework... am I wrong to begin migrating this to .NET Core as well?

Why for example does Xamarin.UITest target .NET Framework that when according to a quick google search on .NET Framework vs NET Core:

Is .NET core replacing .NET framework?
net core will replace . net framework. For a longer answer, Microsoft is adding new features to the upcoming . net core 3 to include WinForms, WPF and more features and functions from .

Shouldnt the move be away from .NET Framework? I feel like if the Xamarin.UITest is targeting the .Net Framework there must be a reason why so it just made me question my next move to migrate that also.

iOS Simulator does not support metal?

$
0
0

Hi, been wondering about the correlation between info from Apple:

"In Xcode 11, Simulator adds support for Metal development. You can write iOS and tvOS apps that use Metal and test them in the Simulator, gaining the benefits of hardware acceleration on the Mac during development of your app. If you >use frameworks built on top of Metal, such as SceneKit, Core Animation, and UIKit, you'll also see better performance when testing your apps in Simulator."

.and the message i'm getting:
...\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(598,3): error : The iOS Simulator does not support metal. Build for a device instead.
Any thoughts, ideas?

How to adjust shadow in translucent navbar?

$
0
0

To make the navbar translucent, I used Custom Renderer:

`using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
using Xamarin.Forms.Platform.Android.AppCompat;
using AView = Android.Views.View;
using App1;
using Android.Content;
using TransparentNavBarXForms.Droid.Renderers;

[assembly: ExportRenderer(typeof(CustomNavigationPage), typeof(CustomNavigationPageRenderer))]
namespace TransparentNavBarXForms.Droid.Renderers
{
    public class CustomNavigationPageRenderer : NavigationPageRenderer
    {
        public CustomNavigationPageRenderer(Context context) : base(context)
        {

        }

        IPageController PageController => Element as IPageController;
        CustomNavigationPage CustomNavigationPage => Element as CustomNavigationPage;

        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            CustomNavigationPage.IgnoreLayoutChange = true;
            base.OnLayout(changed, l, t, r, b);
            CustomNavigationPage.IgnoreLayoutChange = false;

            int containerHeight = b;

            PageController.ContainerArea = new Rectangle(0, 0, Context.FromPixels(r - l), Context.FromPixels(containerHeight-t));

            for (var i = 0; i < ChildCount; i++)
            {
                AView child = GetChildAt(i);

                if (child is Android.Support.V7.Widget.Toolbar)
                {
                    continue;
                }

                child.Layout(0, 0, r, b);
            }
        }
    }
}`

To add a shadow, I added the property: android: elevation = "4dp" to Toolbar.axml The shadow was added not only from the bottom of the navbar, but from different sides inside, due to the transparency effect, this is visible. How to make a shadow only from below? Is it possible to implement it somehow differently?


Is there any way to finds out if i currently using wifi or gprs data plan?

$
0
0

Hello,
I need your help regarding Internet connectivity, right now i am using connectivity plugin for checking internet connection if its available or not but i also want to know that am i using wifi or gprs data because if i am conecting to wifi then i need to upload back-up data to my server but looks like i can not found proper solution or nuget package to do that.
Any help would be appreciate.
Thank you....


Native Library Linking Failed

$
0
0

issues:
1- Error: linker command failed with exit code 1 (use -v to see invocation)
2-/MT5209: Error: file not found: opencv2.a Native linking
3- Error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -ObjC (MT5201)
4-/ Error MT5202: Native linking failed. Please review the build log. (MT5202)

DatePicker.Margin and Entry.Margin

share a image with text on whatsapp

$
0
0

Hi

I want a share a image on whatsapp with text. how it possible with Xamarin.Essentials. currently share only image work fine but with text how it is possible. kindly guide me any solution.

Thanks

Unable to connect to Apple developer account/cant find provisioning profiles

$
0
0

I am trying to connect to my apple developer account to use my certificates/provisioning profiles for a Xamarin.Forms iOS account, but I keep getting the following error when I type my credentials and try to login in VS19 windows 16.5.1

I am connected to the mac, albeit with the version mismatch issues https://forums.xamarin.com/discussion/comment/406654 where in Xcode I can see my Distribution provisioning profiles in Xcode, but in my VS Windows it doesn't find anything

I tried Automatic Provisioning, but this takes me back to my first issue where I can't connect to the Apple account.

Help, please!

How to integrate Razorpay payment gateway in Xamarin.Android

$
0
0

Can any one please give me example of how to integrate Razorpay payment gateway in Xamarin.Android

Only the original thread that created a view hierarchy can touch its views exception Xamarin.Android

$
0
0

I have the following screen:

When I click on Ponentes ImageButton , after few seconds SpeakersActivity opens. After clicking on Ponentes ImageButton I don't want to stay on its screen for several seconds, but I want SpeakersActivity to open immediately with loadingSpinner ProgressBar while the data in SpeakersActivity is loading. I put the code which causes the delay in a thread in the OnCreate method of SpeakersActiviy:

protected override async void OnCreate(Bundle savedInstanceState)
{
    .....
    .....

    loadingSpinner.Visibility = ViewStates.Visible;
    await Task.Run(() =>
    {
        //get all the speakers from the db
        allSpeakers = DatabaseHelper.GetAllFromTable<Speaker>("speakers.db");

        //get only the international spakers
        internationalSpeakers = allSpeakers.Where(x => x.Nationality.Equals("international")).ToList();

        //get only the national speakers
        nationalSpeakers = allSpeakers.Where(x => x.Nationality.Equals("national")).ToList();

        //fill in the RecyclerView with data
        speakersRecyclerView = FindViewById<RecyclerView>(Resource.Id.speakersRecyclerView);
        speakersLayoutManager = new LinearLayoutManager(this);
        speakersRecyclerView.SetLayoutManager(speakersLayoutManager);
        speakersAdapter = new SpeakersAdapter(speakers);
        speakersAdapter.ItemClick += OnItemClick;
        speakersRecyclerView.SetAdapter(speakersAdapter);

        loadingSpinner.Visibility = ViewStates.Gone;
    });
    .....
    .....
}

I get Only the original thread that created a view hierarchy can touch its views exception. What is the cause of that exception and how can I achieve what I want? If there is a single command solution as mine:

await Task.Run(() => {.....}); 

it would be better, so if another person reads my code in the future, he doesn't wonder too much what's going on.

Here is the SpeakersActivity.axml :

<LinearLayout>
    <Toolbar>
        <TextView/>
    </Toolbar>
    <LinearLayout>
        <TextView/>
        <TextView/>
    </LinearLayout>
    <android.support.v7.widget.RecyclerView
        android:id = "@+id/speakersRecyclerView"/>
    <ProgressBar
        android:id = "@+id/loadingSpinner"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:indeterminateDrawable="@drawable/animdraw"
        android:visibility="gone"
        android:layout_gravity="center"/>
</LinearLayout>

I skipped View's attributes because they are irrelevant.

ListView items do not update

$
0
0

Hi all,
I update my binding object but the ListView doesn't update. I have to leave the page and reopen it.

My object:

`public class Variant
{
public Command TrashCommand { set; get; }
public Command AddCommand { set; get; }
public Variant()
{
TrashCommand = new Command(OnTrashTapped);
AddCommand = new Command(OnVariantTapped);
}

    private void OnVariantTapped(object obj)
    {
        var item = obj as Variant;
        item.Qta = item.Qta + 1;
    }

    private void OnTrashTapped(object obj)
    {
        var variant = obj as Variant;
        variant.Qta = variant.Qta - 1;
        if (variant.Qta < 0)
            variant.Qta = 0;
    }

    public string Id { get; set; }
    public string ItemId { set; get; }
    public string Text { get; set; }
    public int Qta { set; get; }
    public decimal Price { set; get; }

    public bool BadgeIsVisible
    {
        get
        {
            if (Qta > 0)
                return true;
            return false;
        }
    }
}`

My ViewModel:

`public class ItemDetailViewModel : BaseViewModel
{
public Item Item { get; set; }
public ObservableCollection Variants { set; get; }

    public ItemDetailViewModel(Item item = null)
    {
        Title = item?.Text;
        Item = item;
        Variants = new ObservableCollection<Variant>();
        foreach (var obj in item.Variants)
        {
            Variants.Add(obj as Variant);
        }
    }
}`

BaseViewModel.cs

`public class BaseViewModel : INotifyPropertyChanged
{
public IDataStore DataStore => DependencyService.Get<IDataStore>();

    bool isBusy = false;
    public bool IsBusy
    {
        get { return isBusy; }
        set { SetProperty(ref isBusy, value); }
    }

    string title = string.Empty;
    public string Title
    {
        get { return title; }
        set { SetProperty(ref title, value); }
    }

    protected bool SetProperty<T>(ref T backingStore, T value,
        [CallerMemberName]string propertyName = "",
        Action onChanged = null)
    {
        if (EqualityComparer<T>.Default.Equals(backingStore, value))
            return false;

        backingStore = value;
        onChanged?.Invoke();
        OnPropertyChanged(propertyName);
        return true;
    }

    #region INotifyPropertyChanged
    public event PropertyChangedEventHandler PropertyChanged;
    protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
    {
        var changed = PropertyChanged;
        if (changed == null)
            return;

        changed.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }
    #endregion
}`

My Page.cs

`[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ItemDetailPopup : PopupPage
{
ItemDetailViewModel viewModel;

    public ItemDetailPopup()
    {
        InitializeComponent();
    }
    public ItemDetailPopup(Item item)
    {
        InitializeComponent();
        BindingContext = viewModel = new ItemDetailViewModel(item);
    }
}`

My Page.xaml

<pages:PopupPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup" xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup" mc:Ignorable="d" x:Class="XamarinAPP.Views.Popup.ItemDetailPopup"> <pages:PopupPage.Animation> <animations:ScaleAnimation PositionIn="Bottom" PositionOut="Center" ScaleIn="1.2" ScaleOut="0.8" DurationIn="400" DurationOut="300" EasingIn="SinOut" EasingOut="SinIn" HasBackgroundAnimation="True"/> </pages:PopupPage.Animation> <StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" BackgroundColor="White" Margin="0, 0, 0, 0"> <Image Source="pizza.png" HorizontalOptions="FillAndExpand" HeightRequest="50" /> <Label Text="{Binding Item.Text}" HorizontalTextAlignment="Center" d:Text="{Binding .}" LineBreakMode="NoWrap" Style="{DynamicResource ListItemTextStyle}" FontSize="20" /> <Label Text="{Binding Item.Price, StringFormat='{0:C}'}" HorizontalTextAlignment="Center" LineBreakMode="NoWrap" Style="{DynamicResource ListItemTextStyle}" FontSize="18" /> <Label Text="{Binding Item.Description}" HorizontalTextAlignment="Center" LineBreakMode="NoWrap" Style="{DynamicResource ListItemTextStyle}" FontSize="16" /> <ListView HasUnevenRows="True" x:Name="listViewVariants" IsPullToRefreshEnabled="False" CachingStrategy="RecycleElement" ItemsSource="{Binding Variants}" > <ListView.Header> <Label Text="Varianti" BackgroundColor="LightGray" HorizontalOptions="FillAndExpand" LineBreakMode="NoWrap" VerticalTextAlignment="End" FontSize="18" HeightRequest="45" Padding="10, 0, 0, 5" /> </ListView.Header> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <StackLayout Padding="10"> <StackLayout> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="60*" /> <ColumnDefinition Width="20*" /> <ColumnDefinition Width="20*" /> </Grid.ColumnDefinitions> <BoxView x:Name="itemCount" IsVisible="{Binding BadgeIsVisible}" Grid.Column="0" BackgroundColor="Green" VerticalOptions="Center" HorizontalOptions="Start" WidthRequest="16" HeightRequest="16" CornerRadius="50"> </BoxView> <Label Text="{Binding Qta}" IsVisible="{Binding BadgeIsVisible}" Grid.Column="0" VerticalOptions="Center" HorizontalOptions="Start" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" FontAttributes="Bold" Padding="0,0,0,4" WidthRequest="16" HeightRequest="16" TextColor="White" FontSize="11"/> <Label Grid.Column="0" Text="{Binding Text}" d:Text="{Binding .}" LineBreakMode="NoWrap" Style="{DynamicResource ListItemTextStyle}" FontSize="16" VerticalTextAlignment="Center" Padding="20,0,0,0"/> <Label Grid.Column="1" Text="{Binding Price, StringFormat='{0:C}'}" d:Text="{Binding .}" LineBreakMode="NoWrap" Style="{DynamicResource ListItemTextStyle}" HorizontalTextAlignment="End" VerticalTextAlignment="Center" FontSize="16" TextColor="Red" /> <Image Source="trash.png" Grid.Column="2" WidthRequest="32" IsVisible="{Binding BadgeIsVisible}"> <Image.GestureRecognizers> <TapGestureRecognizer Command="{Binding TrashCommand}" CommandParameter="{Binding .}"/> </Image.GestureRecognizers> </Image> </Grid> </StackLayout> <StackLayout.GestureRecognizers> <TapGestureRecognizer Command="{Binding AddCommand}" CommandParameter="{Binding .}"/> </StackLayout.GestureRecognizers> </StackLayout> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> </StackLayout> </pages:PopupPage>


How to layout object properties

$
0
0

I want to get app structure:
First page: list of books

When you select a book in the list it navigates to the new page. Inside the page should be information like this:

  • List of chapters.
  • List of quetes.
  • Some properties like author, date and so on.

This information doesn't fit in a window. I don't want to make it scrollable. I want this page as one page, but splitted in three different tabs layout.

I thought to use tabbedpage, but docs says:
"While a NavigationPage can be placed in a TabbedPage, it's not recommended to place a TabbedPage into a NavigationPage."

Also thought about shell, but shell is tabbed from the first page. Is it possible to get sub tabs i a shell?

What are other options? To create diffetent buttons and change information visibility on pressing?

hypervisorlaunchtype off

$
0
0

I have to use this command when I bring up Mac
bcdedit /set hypervisorlaunchtype off

But mobile simulator must be ordered
bcdedit /set hypervisorlaunchtype auto

What exactly should be done to run both at the same time?

Help with push notifications

$
0
0

https://devblogs.microsoft.com/appcenter/app-center-mbaas-retirement/

I'm working on a cross platform project, and AppCenter push service will not be available in May.

I only want a simple way to send push notifications, and I had found with AppCenter the perfect tool, but now Microsoft tell us to use Azure Notification Hub. The description of Azure Notification Hub is... "If you want full control over your notifications and don’t mind doing a little bit more work inside of your applications to set it up then Azure Notification Hubs is for you. Notification Hub sits in the middle of your server and devices to handle registration and offer a single source" but no, I want something similiar to AppCenter, just to send notifications.

Which alternative tool do you recommend me?

Consume Activity in Jar Xamarin Android Bindings

$
0
0

I am creating a Xamarin Project where I wish to use Paynimo payment gateway. https://www.techprocesssolutions.co.in/PaynimoKit/index.html

I have downloaded the Paynimo Integration Kit for android. Also created a binding project and added Jar file from integration kit.

Everything is working other than activities in jar file.

I am unable to call the activities jar file.

When I decompile Jar I can see the activity files.

But when I decompile the binding dll I only see this much

No activities in dlls. Do I need to add anything else like in metadata ?

What are the steps I should take to access the activities in jar file.?

Thanks in advance.

App rejected because of errors in thinning process

$
0
0

Hi all!

first post here.. :) I've submitted my app to the store, but a few minutes after I got an email about webview not being accepted anymore.. So I followed this instructions and got rid of that message: cant post links.. so please stich it toghether: devblogs DOT microsoft DOT com/xamarin/uiwebview-deprecation-xamarin-forms/

But now, i do get this message:

While processing your iOS app, Appname, errors occurred in the app thinning process,
and your app couldn’t be thinned. If your app contains bitcode, bitcode processing
may have failed. Because of these errors, this build of your app will not be
able to be submitted for review or placed on the App Store.
For information that may help resolve this issue, see Tech Note 2432.

I already tried adding false to my project file. no change at all.. I am able to deploy the app ad hoc locally without any errors..

Could somebody please tell me how to solve this problem?

Thank you!

Viewing all 204402 articles
Browse latest View live


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