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

Unable to launch application after updating to latest version of Visual Studio for Mac

$
0
0

Hello,

I am working on a Xamarin Forms application. Everything was fine until I updated Visual Studio for Mac to the latest version of Xamarin and Mono. Now users are unable to open the application on their iOS devices. After install, when they click on the app icon the application launches and then immediately closes. I have gone through the logs and found the following error:

error 09:40:36.951392 -0500 assertiond Failed to start job with error <NSError: 0x7f97f2801640; domain: NSPOSIXErrorDomain; code: 3; reason: "No such process"> { description = "Unable to get pid for label UIKitApplication:com.myapplication[0xca85][1468]"; failureReason = "No such process"; userInfo = { BKLaunchdJobLabel = UIKitApplication:com.myapplication[0xca85][1468]; BKLaunchdOperation = launch_get_running_pid_4SB; } }

After some searching online I have found similar posts where the issue is that certain certificates were set to "Always Trust" instead of "Use System Defaults". However, I have checked all the related certificates (Apple Worldwide Developer Relations Certification Authority, Developer ID Certification Authority, iPhone Developer, and iOS Distribution). They are all set to use system defaults.

Has anyone else experienced this issue? If so, how did you resolve it?

Thank you


Working with ListView only in C# - How to pass ItemTapped values?

$
0
0

Hello everyone, I'm working on a project that I'm doing everything in C#, now that I started implementing ListView I'm worried if I can do everything I want to do in C#.

I have this class:

    public class PlacesBD
    {
        [PrimaryKey,AutoIncrement]
        public int Id { get; set; }
        public string name { get; set; }
        public double lat { get; set; }
        public double lon { get; set; }
        public sbyte timeZone { get; set; }
        public string ImageResourceId { get; set; }
    }

This CustomCell:

 public class PlaceCustomCell:ViewCell
    {
        public static readonly BindableProperty SelectedItemBackgroundColorProperty = 
            BindableProperty.Create("SelectedItemBackgroundColor", 
                typeof(Color), typeof(PlaceCustomCell),
                Color.Default);  

        public Color SelectedItemBackgroundColor
        {
            get
            {
                return (Color)GetValue(SelectedItemBackgroundColorProperty);
            }
            set
            {
                SetValue(SelectedItemBackgroundColorProperty, value);
            }
        }

        public PlaceCustomCell()
        {
            var placeImage = new Image
            {
                HeightRequest = 50,
                WidthRequest = 50,
                Aspect = Aspect.Fill,
                VerticalOptions = LayoutOptions.Center
            };
            placeImage.SetBinding(Image.SourceProperty, new Binding("ImageResourceId"));
            SelectedItemBackgroundColor = Color.FromRgb(0, 160, 220);
            var nameLabel = new Label
            {
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                FontAttributes = FontAttributes.Bold,
                VerticalOptions = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Start,
            };
            nameLabel.SetBinding(Label.TextProperty, new Binding("name"));

            string stringPercentage = RandomNumber(300, 699).ToString();
            stringPercentage+= "%";
            var percentageLabel = new Label
            {
                Text = stringPercentage,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                FontAttributes = FontAttributes.Bold,
                VerticalOptions = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.End
            };


            var grid = new Grid()
            {
                ColumnDefinitions = {
                    new ColumnDefinition { Width = new GridLength(0.2, GridUnitType.Star)},
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star)},
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star)},
                },
                ColumnSpacing = 0,
                RowSpacing = 0
            };
            grid.Children.Add(placeImage, 0, 0);
            grid.Children.Add(nameLabel, 1, 0);
            grid.Children.Add(percentageLabel, 2, 0);

            View = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Padding = new Thickness(5, 5, 5, 5),
                HeightRequest = 60,
                Children = { grid }

            };
        }

The ItemSource comes from:

            protected async override void OnAppearing()
            {
                base.OnAppearing();
                LocalSQLService BD = new LocalSQLService();
                List<PlacesBD> resultado = BD.Consultar();
                placesListView.ItemsSource = resultado.ToList();            
            }

And I want to pass values of the PlacesBD class when the item is tapped:

        public async void OnPlaceTapped(object sender, ItemTappedEventArgs e)
        {
            if(e == null)
            {
                return;
            }
            Debug.WriteLine("Tapped: " + e.Item);
            ((ListView)sender).SelectedItem = null; // de-select the row
        }

How can I create a new page and pass my object PlacesBD data to the new page?

X.Forms Android Button OnPress Visual Bug

$
0
0

Hey guys,

I'm really frustrated and require some help from you. I'm not really new at Xamarin, but some things won't get in my brain. Maybe I haven't understood the entire logic so far.

But, my problem is: I've been adding a Button to the content page and all were working fine. So, I had to change the background color and now it's messed up! When I click the button, it shows WHILE the press event is invoked, a small visible rectangle with the 0.25 scale of the entire button on the top left of the button.

Can someone help me? I've made a screenshot WHILE PRESSING THE BUTTON here:

Note: BEFORE changing the background color, all has been working fine. AFTER setting the background color, the color gets changed well and is correct but the PRESS/CLICK/ACTIVE state of the button shows a small - unrequired - rectangle on the top left of the button.

Thankful for every answer.

Kind regards,
Dominik G.

Underlying connection closed error when running UI Tests

$
0
0

SetUp : System.Net.Http.HttpRequestException : An error occurred while sending the request.
----> System.Net.WebException : The underlying connection was closed: The connection was closed unexpectedly.
at Xamarin.UITest.Shared.Http.HttpClient.SendData(String endpoint, String method, HttpContent content, ExceptionPolicy exceptionPolicy, Nullable1 timeOut) at Xamarin.UITest.Shared.Http.HttpClient.Post(String endpoint, String arguments, ExceptionPolicy exceptionPolicy, Nullable1 timeOut)
at Xamarin.UITest.Shared.Android.HttpApplicationStarter.Execute(String intentJson)
at Xamarin.UITest.Shared.Android.LocalAndroidAppLifeCycle.LaunchApp(String appPackageName, ApkFile testServerApkFile, Int32 testServerPort)
at Xamarin.UITest.Android.AndroidApp..ctor(IAndroidAppConfiguration appConfiguration, IExecutor executor)
at Xamarin.UITest.Configuration.AndroidAppConfigurator.StartApp(AppDataMode appDataMode)
at Elog.UITest.Regression59.BeforeEachTest()
--WebException
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)

ENV:
Xamarin 4.11.0.776 (d15-8@1ae9b59d7)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 4.15.9 (d000f568b)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 1.1.116 (9619170)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 9.0.0.19 (HEAD/a8a3b0ec7)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK 12.0.0.15 (84552a4)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Andriod SDK 8.1 Oreo, Platform 27
Visual Studio 15.8.4

Samsung keyboard covers entry cells in xamarin forms; Other android and iOS seem to work w/o issue

$
0
0

I have a form with a table view to display info to the user as well as let them edit it.

<StackLayout>
    <Frame>
        <TableView>
            <TableRoot>
                <TableSection>
                    <EntryCell/>
                </TableSection>
                <TableSection>
                    <ViewCell>
                        <StackLayout >
                            <Label />
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Editor Text="{Binding Service.ExtProblem, Mode=TwoWay}" 
                                         HorizontalOptions="FillAndExpand"
                                         VerticalOptions="FillAndExpand"
                                        AutoSize="TextChanges"
                                        InputTransparent="{Binding ProblemLocked}"/>
                            </Grid>
                        </StackLayout>
                    <EntryCell Keyboard="Numeric"
                                           x:Name="AmtToCollectEntry"
                                           Label="Amt To Collect" 
                                           Placeholder="$0.00"
                                           Text="{Binding Service.AmtToCollect, Mode=TwoWay, Converter={StaticResource CurrencyConverter}}"
                                           LabelColor="{DynamicResource headerFooterIconColor}"/>
                </TableSection>
            </TableRoot>
        </TableView>
    </Frame>
</StackLayout>

This is the basic format of the form, with a few more of the ViewCells containing Editors. For whatever reason when some of my testers with Samsung devices try to use the form, the keyboard covers the entry fields so the user can't see what they are typing. Additionally, when first selecting the numeric EntryCell, it seems to get deselected and none of the input gets recorded. Some playing around on the form and coming back seems to let you select it correctly the second time.

What's weird is I can't repeat this with another android device (Google pixel and some no-name android tablet) or iOS. Anything I was able to research on it seemed to only come up with iOS keyboard issues and a few years old. Please help.

ExpandableView nuget package

CarouselView: How to access control inside DataTemplate?

$
0
0

Hi,

I would like to access the control lblName on page 2 for example, is it possible?

   <control:CarouselView.ItemTemplate>

       <DataTemplate>

            <Label x:Name="lblName" Text="{Binding LabelText}" />

       </DataTemplate>

   </control:CarouselView.ItemTemplate>

Thank you and best regards
Chris

Entry is not showing Done option on keypad in ios. It is working fine in android

$
0
0

Snippet:

                        <Entry.Behaviors>
                            <b:EventToCommandBehavior EventName="Completed" Command="{Binding DurationCompletedCommand}"></b:EventToCommandBehavior>
                        </Entry.Behaviors>
                    </Entry>

Please let me know in case missed anything.


Provisioning profiles in visual studio 2017

$
0
0
Hello experts

I have a problem with my new provisioning profile created in the apple developer portal I can see it in the Xcode but no in visual studio I already reconnect the Mac server I don’t know why the profile don’t show up

Thanks in advance.

MacOS menu question

$
0
0

I'm building a cross-platform app, and I'd like to make the standard "Preferences" menu responsive on MacOS. I can see how to add the code for an "open preferences" action, but it isn't clear what class this code should live in. I have a SettingsPage already built, so what I mainly need to do is find a way to call Navigation.PushModalAsync() in response to the Preferences item in the menu bar.

There's some documentation for how to do this in Xamarin.mac, but it's not clear (to me) how to do it in Xamarin.Forms. Can somebody steer me in the right direction, or perhaps suggest a sample to look at?

BeginInvokeOnMainThread NOT Invoked?

$
0
0

Is there any known reason why BeginInvokeOnMainThread would not be invoked, i.e. jumped over. I have a class file with numerous calls to BeginInvokeOnMainThread in different methods that work, but in this one method it doesn't execute. I can place breakpoints in the others, but in this one forget it. I originally had the same code in a separate class with the same issue. I am using them in order to asynchronously end DataServiceQuery'ies in the PCL of Xamarin cross-platform forms solution. I know that the query I am making is returning a result by just making it using a browser.

There are no associated error messages that I have seen, directly or in Output.

Is there a limit on the number of invokes?

Pending Add Error

$
0
0

So yesterday i started to get "Pending Add" whenever i tried to add for example a png file to my resource folder or basically any folder.
I've already have some images added to the project and they are safe and sound(checked in)

Ive tried following workaround:

  • Copy/paste and adding the image in the cs.proj file manually
  • Exclude/Include in project
  • Add existing file
  • Copy/paste the image through file explorer to the desired folder and then include in project
  • Restarted VS more times then i can count.

Anyone encountered this before?

Current versions in use:

Visual Studio Community 2017 Version 15.1 - 26403.3 Release
Xamarin 4.4.034
Android SDK 7.2.07

How can i detect key events in xamarin.forms?

$
0
0

Is there any way to detect key events from a physical keyboard on UWP project?, or its posible to create a custom renderer and assign "onkeydown event" to it?

In VS 2017 Xamarin.Forms WebView exceprion

$
0
0

In VS 2017 Xamarin.Forms I add WebView control to my app MainPage when i try build
I have exception "Value cannot be null. Parameter Name: thisActivity

Error Native linking error: framework not found

$
0
0

Native linking error: framework not found FoxitRDK.
How to solve this Error.


How Close Master Detail Page? (Landscape mode)

$
0
0

Hi everyone!
I want to close menu Phone or Tablet in Horizontal mode.
I try this code

DriverDashBoard test = new DriverDashBoard(); test.IsPresentedChanged+= (object sender, EventArgs e) => { test.IsPresented = false; }; test.IsPresented = false;

Result:

Still open :) How close this ?Thanks

Can we show Same Date Pikcker UI for iOS and Android instead of default iOS date picker

$
0
0

I want to show Android date time picker dialog in iOS instead of iOS native date picker. Will I able to do it ?

Forms Tabbed Page OnAppearing

$
0
0

I have the following code for tabbed Main page but would like to know why are the OnAppearing method being called on all the tabbed pages on first run of the App. Is there a way to only run the OnAppearing then the Tab is the active one ?

TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" 
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
            xmlns:local="clr-namespace:MyApp.View;assembly=MyApp"
            x:Class="MyApp.View.MainTabbedPage" 
            xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
            android:TabbedPage.ToolbarPlacement="Bottom"

            BarBackgroundColor="#4caf50"
            BarTextColor="White"
            android:TabbedPage.IsSwipePagingEnabled="False"
            android:TabbedPage.BarItemColor="#66FFFFFF"
            android:TabbedPage.BarSelectedItemColor="White" >

    <TabbedPage.Children>
        <NavigationPage x:Name="DeviceNavPage" 
                        Title="Devices" 
                        Icon="devices" 
                        BarBackgroundColor="#4caf50" >
            <x:Arguments>
                <local:DevicePage />
            </x:Arguments>
        </NavigationPage>
        <NavigationPage x:Name="SharingNavPage" 
                        Title="Sharing" 
                        Icon="share" 
                        BarBackgroundColor="#4caf50" >
            <x:Arguments>
                <local:SharingPage/>
            </x:Arguments>
        </NavigationPage>
        <NavigationPage x:Name="SettingNavPage" 
                        Title="Settings" 
                        Icon="settings" 
                        BarBackgroundColor="#4caf50" >
            <x:Arguments>
                  <local:SettingPage/>
            </x:Arguments>
        </NavigationPage>


    </TabbedPage.Children>

</TabbedPage> 

Xamarin.Forms and NotificationHub; RegisterAsync error

$
0
0

With a Xamarin.Forms app that needs to register with a NotificationHub from the specific platform (in my case Android) I get the error 404 0 2 with message : "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable".

Provided that the NotificationHub was working correctly until few days ago, I suppose that something is not working properly in NotificationHub.

The exception occurs when device needs to register :

var client = new MobileServiceClient(MyApp.App.MobileServiceUrl);
var push = client.GetPush();
await push.RegisterAsync(token, templates); <=================== results in 404 Error

The MobileServiceUrl is an App Service backend connected with the Azure Notification Hub.

Has someone else solved the same problem?

Thanks,

Enrico.

Striped listview - performance

$
0
0

Hello,
I created a ListView with alternating row colors. There are many tutorials over the Internet how to do that, i.e. here:

https://forums.xamarin.com/discussion/27896/listview-alternating-row-background-colors

Unfortunately, the performance is quite bad when the number of items grows. For normal Listview, we can use caching strategy "Recycle Element" to have a nice performance. Unfortunately, it does not work for striped Listviews because cells are not identical. So how to have a nice performance in striped ListViews?

Viewing all 91519 articles
Browse latest View live


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