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

creating nuget package with referenced project?

$
0
0

I have a .net standard Project with 2 layers which has main .net Standard Project A and Project B referencing on A.
when I use VS2017 to create nuget package, creating nupkg doesnt include Project B but in the nuspec file, it Shows it as another nuget package reference. Thats why when i try to install the nuget on my Project, it complains that it cant find ProjectB package. Does anyone know how to solve this Problem?

i am not sure if it is the best way but I solved the Problem number one using answer here https://stackoverflow.com/questions/46376256/visual-studio-2017-nuget-pack-exclude-project-reference-as-another-nuget-referen

So now my package has ProjectB as dll included in the zipped nuget package but in the nuspec is still showing ProjectB as a another package reference. How to solve this?


VS for Mac: MessageBox / MessageDialog / Popup to user

$
0
0

Hello everyone!

I am currently using Visual Studio for Mac and am struggling to find an equivalent way of displaying a popup message to the user inside a GUI the same way " MessageBox.Show("Invalid amount", "Error") does on Visual Studio for Windows. Is there such a method and if so, does it require using a specific library?

Best Regards
Robert

Save all the points and lines drawn in Skia Sharp

$
0
0

Hi,

I am completely new to Xamarin and I am trying to learn it.

I thought of doing the Drawing app where i have used SignaturePad and it was great.

Now I want to do draw complex geometry shapes, so thought of using SkiaSharp.

I am having an issue with storing points or lines drawn on canvas ( as in SignaturePad the user draws, paint on the screen and store the points). How do I store points or lines drawn on canvas when I save it as .png file. And when I open it, I need to retrieve back my drawn curves or lines.

How can I achieve this? Any suggestion would be helpful.

Thanks

How to reduce apk with Android App Bundle and how to build for 64-bit requirement

$
0
0

I have 2 questions both of them about building xamarin forms app for android for google play console, I will ask in one post

  1. I see in google play console that my apk would be smaller if I use Android App Bundle, is there an option in visual studio 2017 to do it? I also opened the apk with android studio and try to do it from there I couldn't make it

  2. Get your apps ready for the 64-bit requirement - I did the check https://developer.android.com/distribute/best-practices/develop/64-bit
    I found the armeabi-v7a I don't have the arm64-v8a or x86_64, so I have 32-bit , how should I build for for 64-bit requirement , is there a way with visual studio 2017 ? what should I do?

Unable to set aps-environment

$
0
0
Hello I am working on a xamarin iOS application with push notification and I keep getting rejected by the application loader saying that I have my aps-environment field in the plist file to be in development. I have tried changing the entitlement.plist aps-environment value to 'production' and saving it but it keeps on reverting back to its initial 'development' value.

I open the .plist file in external editor and change it to production but in visual studio when I open the entitlement.plist file 'push notifications' feature is unchecked. So if check that feature again the aps- environment is back to development.

Any help/tips would be greatly appreciated. Thanks in advance

Cannot get Azure notifications working reliably

$
0
0

Since Google forced the upgrade to 8.0, I cannot get notifications working reliably. Specifically, if the user puts my app into the background attempting to receive or perhaps display notifications causes a crash. It takes some time and/or number of notifications to cause the crash, usually a minute or two, and/or half dozen messages.

Google talks about calling methods like StartForegroundService() and StartForeground() in order to get things to work, but I cannot figure out how this fits into the Xamarin framework. StartForegroundService is supposed to be called in the MainActivity's OnCreate, and then StartForeground in the Service's OnCreate within 5 seconds. Well there is no way that is happening in 5 seconds.

Many Xamarin sample projects are old and/or limited in scope. How do you create a user app that can be put into the background, receive Azure push messages and display notifications without crashing on Android 8.0+?

And what, if anything, does this have to do with JobScheduler?

ListView is randomly changing ImageCircle's background color when scrolling and tapping

$
0
0

Using James Montemagno's ImageCircle plugin in a item template for a listview. The ImageCircle control is being used twice for each row - larger circle holds initials for the contact and the smaller circle indicates their online status. Very similar to what you would see in Outlook.

There is no code in the ItemTapped event other than setting the SelectedItem = null. I am hard-coding the background colors for each of the circles.

The Problem

On Android, as I scroll and tap thru the Listview the background colors for each of the circles will randomly change on their own. It's intermittent and scrolling seems to "trigger" the issue. Initial taps on a row will not change the circle colors but if I scroll thru the list and return to the first row and then tap the first row it might change the color - again it's intermittent. Doesn't happen each time but happens pretty frequently.

Desired Solution

I want the background color for the circles to remain at their original hard-coded value.

My guess is that the Listview's "recycler template logic" is assigning a background color from a cached template. I say that because the colors that are being randomly assigned are only colors being used in other rows.

Again problem only occurs on Android (so far cross fingers). Anyone know a fix or work-around? Thanks!

How to detect tapped item inside ListView in Xamarin Forms

$
0
0

I create a listview which has columns: checkbox and button. I found that when touch on Button inside ListView, I can catch Clicked event of Button control without raised ItemSelected of ListView
However, I can not catch either CheckedValueChanged event or TapGestureRecognizer on ContentView (parent of Checkbox control). When I touch on Checkbox, ItemSelected of ListView is always invoked. It wasn't raise CheckedValueChanged event.
Could you share me how to solved it please?
In xaml page:

        <ListView x:Name="listx"
            RowHeight="80"
            IsPullToRefreshEnabled="true"
            ItemSelected="Handle_ItemSelected"
            Refreshing="Handle_Refreshing"
            SeparatorVisibility="None">
            <x:Arguments>
                <ListViewCachingStrategy>RecycleElement</ListViewCachingStrategy>
            </x:Arguments>
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <Grid VerticalOptions="CenterAndExpand">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="80" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="10*" />
                                <ColumnDefinition Width="10*" />
                                <ColumnDefinition Width="10*" />
                                <ColumnDefinition Width="15*" />
                                <ColumnDefinition Width="10*" />
                                <ColumnDefinition Width="40" />
                            </Grid.ColumnDefinitions>
                            <Label Grid.Column="0"
                                VerticalTextAlignment="Center"
                                Text="{Binding id}" />
                            <Label Grid.Column="1"
                                VerticalTextAlignment="Center"
                                Text="{Binding usr}" />
                            <Label Grid.Column="2"
                                VerticalTextAlignment="Center"
                                Text="{Binding pass}" />
                            <Label Grid.Column="3"
                                VerticalTextAlignment="Center"
                                Text="{Binding Detail}" />
                            <Button Grid.Column="4"
                                Text="View"
                                HeightRequest="40"
                                TextColor="White"
                                VerticalOptions="Center"
                                BackgroundColor="#00AAE1"
                                Clicked="OnButtonView_Clicked" />

                            <ContentView Grid.Column="5"
                                VerticalOptions="Center"
                                HorizontalOptions="FillAndExpand">
                                <control:Checkbox
                                    WidthRequest="20"
                                    CheckedValueChanged="Handle_CheckedValueChanged"
                                    IsEnabled="true"
                                    IsVisible="true" />
                            </ContentView>

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

In code behind

    void Handle_ItemSelected(object sender, Xamarin.Forms.SelectedItemChangedEventArgs e)
    {
        if (e.SelectedItem != null)
        {
            var item = e.SelectedItem;
            System.Diagnostics.Debug.WriteLine("selected");
            listx.SelectedItem = null;
        }
    }
    void OnButtonView_Clicked(object sender, EventArgs e)
    {
        System.Diagnostics.Debug.WriteLine($"button clicked");
        var item = (sender as Button).BindingContext as UserModel;
        if (item != null)
        {
            System.Diagnostics.Debug.WriteLine($"{item.id}");
            Usr_List.Remove(item);
            newList.Remove(item);
        }
    }
    void Handle_CheckedValueChanged(object sender, DemoWorkList.Control.CheckedChangedEventArgs e)
    {
        System.Diagnostics.Debug.WriteLine("checked");
    }

In Checkbox control,

public event EventHandler<CheckedChangedEventArgs> CheckedValueChanged;
public class CheckedChangedEventArgs : EventArgs
{
    public CheckedChangedEventArgs(bool value)
    {
        Checked = value;
    }

    public bool Checked { get; }
}

XAM U closing - Xamarin Certification now meaningless/cancelled/worthless

$
0
0

cc: @NMackay Thought you'd find this interesting

After May 1, 2019, these programs, including Xamarin certification exams, will no longer be available and active subscriptions will be canceled. For more details, please read our FAQ.

Just got this in email. As I read it Xamarin University will soon be a thing of the past. It will all be self-taught and YouTube. I'm sure glad I had the opportunity to do these course with live instructors. I think this is saying that there won't be any more certifications. Is that what everyone else reads in this? I wonder how that affects the LInkIN area just for certified developers.

Xamarin University is moving to Microsoft Learn

In September 2018, Microsoft launched a free, interactive training portal, Microsoft Learn, incorporating many of Xamarin University's popular features. We're now preparing to merge Xamarin University into the new learning platform, where all coursework will be free.

What to expect

By early 2019, we'll transition most Xamarin University certification and Xamarin.Forms courses to our self-guided learning portal, where they'll be free. Then we'll gradually convert all self-guided learning courses to Microsoft Learn before we close Xamarin University in June 2019. At that time, remaining subscriber-only content, including labs and off-topic videos, such as guest lectures, will be made available on YouTube and GitHub.

Office hours and instructor-led-only courses will remain available until May 1, 2019, giving you time to finish any in-progress Xamarin certifications. After May 1, 2019, these programs, including Xamarin certification exams, will no longer be available and active subscriptions will be canceled. For more details, please read our FAQ.

Thanks for learning with Xamarin University. We're excited about sharing Xamarin content on Microsoft Learn, where we'll provide new features and content—free for everyone.

Use Javadoc JAR in bindings

$
0
0

Is there a way to specify the source of the javadocs as a jar? A lot of prepackaged library jars come with their javadocs as jars as well.

Push notifications do not work in "production " mode in IOS application

$
0
0

Hello, good afternoon.
I have the problem that notifications in my IOS app are not getting push notifications in "production" mode.
I'm using the following libraries:

-Xamarin. Firebase. IOS. Analytics 5.5.0
-Xamarin. Firebase. IOS. CloudMessaging 3.1.2
-Xamarin. Firebase. IOS. Core 5.2.0
-Xamarin. Firebase. IOS. InstanceID 3.4.0

If I run the app in "DEBUG " mode, push notifications arrive correctly.
When I upload the app to the AppStore I do with the configuration of APNS in "Production " and the file entitlements. plist also in "Production ".
The compilation form is "AppStore ".

Can someone help me with this problem?

Thanks a lot.
Best regards

ObjC-C# binding, native 'init' returns nil

$
0
0

Hello,

I am extending the Xamarin. SoupChef example to implement my own Intent. I correctly generated the library following the example in SoupChef, but when I try to reference it in the app (I am using the SoupChef app), i receive the following error:

Could not initialize an instance of the type 'SoupChef.SendCommandIntent': the native 'init' method returned nil.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.

I checked all the steps to generate the library, and including it in the original SoupChef.OrderSoupIntentBinding, including registering the intents in its Info.plist. But when it comes to using it, i get the error. Some code follows

// Order.cs
public OrderSoupIntent Intent
{
       get
       {
            *var myIntent = new SendCommandIntent(); // Only added this line!!!*
             var orderSoupIntent = new OrderSoupIntent();
             orderSoupIntent.Quantity = new NSNumber(Quantity);
             orderSoupIntent.Soup = new INObject(MenuItem.ItemNameKey, MenuItem.LocalizedString);

Exception is thrown here (file SendCommandIntent.g.cs)

[BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
[EditorBrowsable (EditorBrowsableState.Advanced)]
[Export ("init")]
public SendCommandIntent () : base (NSObjectFlag.Empty)
{
    IsDirectBinding = GetType ().Assembly == global::ApiDefinitions.Messaging.this_assembly;
    if (IsDirectBinding) {
HERE--> InitializeHandle (global::ApiDefinitions.Messaging.IntPtr_objc_msgSend (this.Handle, global::ObjCRuntime.Selector.GetHandle ("init")), "init");
    } else {
        InitializeHandle (global::ApiDefinitions.Messaging.IntPtr_objc_msgSendSuper (this.SuperHandle, global::ObjCRuntime.Selector.GetHandle ("init")), "init");
    }

}

Can anyone help me please?
Paolo

Relative layout works on android but not on iOS

$
0
0

Hey guys, I'm using a RelativeLayout in my application to have a text displayed over an image. On android it works just fine, but on iOS it doesn't. The image I have is relatively big and I want to make it fit in a stacklayout that is smaller than it is. So I am using Aspect="Fill" to have the image fill out the stacklayout and not overflow it. On Android it works just fine, but not on iOS.

Here is what it looks like:

So What I did is use the OnPlatform tag to give the aspect different values on iOS and on Android, but it doesn't behave the way I want it to. I tried all of them and none of hem give what I want. Here is a look of the closest one: Aspect="AspectFill"

Here is what my XAML looks like:

<RelativeLayout BackgroundColor="#E2E2E2" HeightRequest="210" HorizontalOptions="Fill">
    <Image Source="support.jpg">
        <Image.Aspect>
            <OnPlatform x:TypeArguments="Aspect" iOS="AspectFill" Android="Fill"/>
        </Image.Aspect>
    </Image>
    <StackLayout HorizontalOptions="FillAndExpand" BackgroundColor="#E0E0E0" Opacity=".6" Padding="10,5,10,5">
        <StackLayout.TranslationY>
            <OnPlatform x:TypeArguments="x:Double" iOS="160" Android="165"/>
        </StackLayout.TranslationY>
        <Label XAlign="Center" TextColor="Black" VerticalTextAlignment="Center" HorizontalOptions="CenterAndExpand" 
                Text="If you have feedback / comments or want to report a problem please contact us"/>
    </StackLayout>
</RelativeLayout>

I want the iOS to look just like the android version of my app, so I need to use the Aspect as "Fill". But it goes over the limit of my highRequest of 210... How can I make it fit?

Thanks

Binding to Swift Framework

$
0
0

I am trying to integrate a service into an app for a client. Unfortunately the SDK is a framework written in Swift and only Swift. I have managed to reach out to the developers and they have made the code as Objective-C accessible as possible.

The problem is that I now need to create a binding library for this SDK. I see that there are cases of people in the past that have bound directly to Swift cocoapods (I cant find any about frameworks). I tried to bind to the xxx-Swift.h header but that just fell apart.

Is there any way that I can bind to this library directly?

If not, I am considering creating an Objective-C framework, adding the Swift framework to that, and then using this wrapper in the binding library.

Surely someone out there has found a way to do this?

Do we have a bottom sheet in Xamarin.iOS ?

$
0
0

I am trying to build a bottom sheet for my map. Was wondering if there is an easy way to do it.


How long do I need to wait before placing links in forum a post?

$
0
0

I get this message when trying to submit a post: "You have to be around for a little while longer before you can post links."

the state of XmlReader must be EndOfFile after this operation

$
0
0

I tried to distributed my project Xamarin.android but i have this error message:

"impossible to distribute the project. the state of XmlReader must be EndOfFile after this operation "

Carousel Page PagesChanged Event

$
0
0

Are there any events that fire when a CarouselPage is swiped (ie, the CurrentPage changes)?

I have a situation where a binding doesn't quite work, and would like to perform an operation when the page is changed.

i know that page.Appearing() gets fired all at once rather than when it seems to 'appear' to the user, so I was hoping the MultiPage event NotifyCollectionChangedEventHandler PagesChanged would be my answer but the documentation doesn't seem like it is exactly what I am looking for (and it doesn't appear to be firing or I am doing it wrong).

Thanks

DatePicker.Focus() not opening the picker on Windows

$
0
0

Hi!

Anyone knows why calling Focus() on a Forms DatePicker opens the picker on Android and IOS, but not on Windows (WPF)?
I've seen some posts on bugzilla discussing about this issue, but they are almost all 2-3 years old and none of them seems to be correct.

Apply Flip transition to UIPageViewController

$
0
0

Hello,

I came across an animation sample included in the Xamarin Samples. https://developer.xamarin.com/samples/monotouch/TransitionsDemo/ . I want to implement the Flip animation shown in this sample to my UIPageViewController. Right now I have an page curl animation applied to the the UIPageViewController. I want to have the flip animation instead of curl

Can someone help me on how can I implement this with a UIPageViewController?

Viewing all 204402 articles
Browse latest View live