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

How to get image source in UI test?

$
0
0

I have an image that toggles which image is shown based on if the typed in password is valid.

                            <Image AutomationId="passwordImageValidation" Source="fail.png" Grid.Column="0">
                                <Image.Triggers>
                                    <DataTrigger
                                        Binding="{Binding Source={x:Reference Password},
                                              Path=IsValid }"
                                        TargetType="Image"
                                        Value="false">
                                        <Setter Property="Source" Value="fail.png" />
                                    </DataTrigger>```
                                    <DataTrigger
                                        Binding="{Binding Source={x:Reference Password},
                                              Path=IsValid }"
                                        TargetType="Image"
                                        Value="true">
                                        <Setter Property="Source" Value="pass.png" />
                                    </DataTrigger> </Image.Triggers></Image>

I was trying to check in a UI test if the image is pass.png or fail.png.

I can do
app.Query(q => q.Marked("passwordImageValidation")).FirstOrDefault()
This returns an AppResult, however I cannot get from that to the source of the image.

Is this possible?


What are the plans for UrhoSharp?

$
0
0

I have been using UrhoSharp for the past 1,5 years (and have heavily invested my game on it). Generally speaking I'm really satisfied with it (I'm feeling really productive working with it).
BUT my concern is the support and maintenance of it, from Xamarin/Microsoft. There have been some activity from time to time from @EgorBo. But most of the time there's no activity going on at all, neither here on the forums nor in the GitHub repo.
I'm not asking to add new functionality to UrhoSharp, just support and maintain the bindings (keeping up with new releases of Urho3D, fixing bugs and answering questions here on the forum). I think it's come to the point where users don't even post questions here anymore, instead they go to the Urho3D forum for help.

I would like to know what the plans for UrhoSharp are, so that I (and the rest of UrhoSharp users) know how to proceed forward (either sticking with UrhoSharp or going to another game engine)?
I would really like continue using UrhoSharp, but I don't know if I dare (due to the insecure future of it).

I think UrhoSharp is a really great library, and I hate the thought of it "dying" (like CocosSharp seems to have).
SkiaSharp seems to get a lot more attention from Xamarin (based on the forum support).
What are the resources from Xamarin for UrhoSharp? Is it "just" @EgorBo that gets some time now and then to work with UrhoSharp (which is my impression right now)?

Finally, what's happening with the latest pre-release version on nuget? Isn't it time to publish a new "official" (stable) release?
I know there have been some bug fixes during the autumn, which I would like to get my hands on.

With the hope of getting some (honest) reply from Xamarin.

How to disable scrolling on WebView

$
0
0

Hello friends,

I'm trying to disable the scroll on the webview, however I could not find a workaround yet.
I was expecting to use something like this: _webView.ScrollView.ScrollEnabled = false;

do you know how can I do it?

I'm using Xamarin.Forms 1.3.0 stable version

Thanks in advance

how to overcome this error in visual studio2017?

$
0
0

Unhandled Exception:

Java.Lang.NoSuchMethodError: no method with name='setElevation' signature='(F)V' in class Landroid/view/View;

Visual Studio always rebuild app, even without code change

$
0
0

When I'm debugging Android app, VS always build whole project, even when I don't make any change to any of the files.

That's why everybody in our team use VS for writing code & XS to debug and deploy.

Can we prevent somehow every time building in VS?

UrhoSurface is always on top, can't show a popup over it

$
0
0

I have a ContentPage that uses an absolute layout. In that layout, I have a ContentView to show my content, and I overlay another ContentView for popups.

Generally, the popup ContentView is not visible. When I want to show a popup, I set the content, set Opacity to 0, set IsVisible to true, then fade it in.

Everything works perfectly.

Now I have a UrhoSurface in my main content, and my popup ContentView is rendered under the UrhoSurface, but above everything else (the Xamarin.Forms controls).

I'm using Xamarin.Forms and a WPF project where I get the UrhoSurface via a custom renderer that returns a Urho.Extensions.Wpf.UrhoSurface.

It seems that the UrhoSurface has an "always on top" attribute set.

The popups work perfectly fine for all other views, it's only when I have a UrhoSurface showing, that it is drawn under the surface.

Is there a setting in WPF or Xamarin.Forms where I can address the Z order?

ForceUpdateSize slows UI

$
0
0

Hi!

I have this strange issue, i have a ViewCell inside a ListView that expands when you tap inside, calling cell.ForceUpdateSize() , this works OK, but if you it repeated times (say, like 3 or 4 times) it starts to get slower every time, until it stops working (freezes)

 void Cell_OnTapped(object sender)
        {
            var cell = sender as InventoryCell;
            cell.Height = cell.Height == 40 ? cell.Height + 30 : cell.Height = 40;
            cell.ForceUpdateSize();

        }

Any info about it?... btw, using XF on iOS

Xamarin.Android 2D frame by frame animations

$
0
0

I'm currently trying to make a game project containing custome made frame by frame animations, my problem is that I can't make 2 animations accure at the same time, I know how to make one animation after another but can't figure out how to make multiple animations simultaneously.

AnimationDrawable animation;
ivPlayer1.SetImageResource(ShootAnimation);
animation = (AnimationDrawable)ivPlayer1.Drawable;
animation.Start();
I've been also trying to delay animations using handlers but I don't know what they do:

Handler h = new Handler();
Action changeAnimations = () =>
{
animatiosn and stuff...
}
h.PostDelayed(changeAnimations, animation.NumberOfFrames * 50);


Can't debug apps on Android 4.4

$
0
0

I have quite an old phone with Android 4.4 (Kit Kat). Everything was fine till I decided to update Microsoft Visual Studio. Now when I try to debug any app using my phone I get a bunch of exceptions “Package Xamarin.Android.Support.Design 27.0.2.1 is incompatible with monoandroid44 (MonoAndroid,Version=v4.4)” and others like that although I do the same actions I would do before. Could you please explain how to deal with that?

Xamarin has stopped working and throws an exception

$
0
0

Xamarin used to work fine but now when I start a new Xamarin project I get this exception:
**Expected 1 exports(s) with contract name "Merq.ICommandBus"
but found 0 after applying applicable constraints.
**
I'm also getting this exception:
**The 'XamarinAndroidPackage' package did not load correctly.
**Sometimes it will say 'XamarinShellPackage'

When I open an existing project I get the above exceptions and the project files
do not show up in Solution Explorer. Instead, it says "(incompatible)" next to my project name.

I have disabled all of my extensions. I have uninstalled Xamarin and reinstalled it.
Nothing changes no matter what I do. I am in the middle of developing a Xamarin.Android
app and I'm stuck like chuck because of this.
A couple of days ago, I updated VS and installed the stuff for Python, Node.JS, and mobile development with Javascript.
I'm pretty sure that's all I did. After that, Xamarin died. :(

Here is the log entry after the exceptions:

789

Error

VisualStudio
LegacySitePackage failed for package [XamarinAndroidPackage]Source:
'Xamarin.VisualStudio' Description: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Diagnostics.UserTraceExtensions.UserError(ITracer tracer, Exception
exception, String format, Object[] args) in
E:\A_work\157\s\src\Core\VisualStudio\Diagnostics\UserTraceExtensions.cs:line 77
at Xamarin.VisualStudio.Android.XamarinAndroidPackage.Initialize()
in E:\A_work\157\s\src\Core\VisualStudio.Android\XamarinAndroidPackage.cs:line 146
at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite
(IServiceProvider sp)
{296E6A4E-2BD5-44B7-A96D-8EE3D9CDA2F6}

80004003 - E_POINTER



790

Error
VisualStudio
SetSite failed for package XamarinAndroidPackage
{296E6A4E-2BD5-44B7-A96D-8EE3D9CDA2F6}

80004003 - E_POINTER

Looks like a null exception but I have no idea what to do about it.

Here is some install information:
Microsoft Visual Studio Community 2017
Version 15.8.5
VisualStudio.15.Release/15.8.5+28010.2036
Microsoft .NET Framework
Version 4.7.03056

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.

Please help.

Thanks, Dave

Problems in Firebase Push Notification Plugin with Android Icon

$
0
0

Hi,

I have a problem with the FirebasePushNotification Plugin for Xamarin.Forms to send message with icon in Android.

I use this to send my push notifications and works perfectly but I can't find the way to show my icon.

var message = new Message()
{
To = pushnot.Token, //topic example /topics/all

            Notification = new AndroidNotification()
            {
                Body = pushnot.Body,
                Title = pushnot.Title,
                Icon = "icona",
                Color = "#3AAAF4"
            }
        };

        var result = await client.SendMessageAsync(message);

Anyone can help me?

Thanks a lot

How to Start Activity Intent for another APP that opens in Current APP View

$
0
0

There are many example showing starting external Apps using Activity Intent Start. But these App become stand alone TOP MOST.

How to start them inside my current app that launches it using Intent. The current app has Fragment and CanvasView.

Thanks

What is the best way to list scan and list available Bluetooth LE devices?

$
0
0

I am new to Xamarin but have been using c# for some time. I started attempting to create a list of all nearby Bluetooth devices but am not sure if there are plugins required or if there is a simple way to do this. All I need to receive is the Bluetooth identity.

Thanks in advance

How to evaluate the DisplayAlert return when using MessageCenter

$
0
0

For normally we use,
bool res = await this.pg.DisplayAlert("Attention", "identifier", "S'identifier", "Annuler");

But I am using MessagingCenter.Send<LoginViewModel, string>(this, "Hi", "Title"); from ViewModel. I have two buttons. If user clicks on Ok or Cancel button how can i get that response.

MessagingCenter.Subscribe<LoginViewModel, string>(this, "Hi", (sender, arg) => {

        UIAlertController vc = UIAlertController.Create("", arg, UIAlertControllerStyle.Alert);
        UIAlertAction action1 = UIAlertAction.Create("OK", UIAlertActionStyle.Default, null);
        UIAlertAction action = UIAlertAction.Create("Cancel", UIAlertActionStyle.Destructive, null);
        vc.AddAction(action);
        vc.AddAction(action1);
            var window = UIApplication.SharedApplication.KeyWindow;
            window.RootViewController.PresentViewController(vc, true, null);
        });        

Getting the SSID of the CONNECTED WIFI on IOS 12- Xamarin

$
0
0

I could get the ssid of the connected wifi to my iphone. After Installing Xcode 10, Updating Visual Studio for Mac and Visual Studio 2017 and xamarin.forms, it returns me an empty ssid.

This is my piece of code for getting the ssid:

    public override string GetCurrentWiFi()
{
    String ssid = "";
    try
    {
        string[] supportedInterfaces;
        StatusCode status;
        if ((status = CaptiveNetwork.TryGetSupportedInterfaces(out supportedInterfaces)) != StatusCode.OK)
        {

        }
        else
        {
            foreach (var item in supportedInterfaces)
            {
                NSDictionary info;
                status = CaptiveNetwork.TryCopyCurrentNetworkInfo(item, out info);
                if (status != StatusCode.OK)
                {
                    continue;
                }
                ssid = info[CaptiveNetwork.NetworkInfoKeySSID].ToString();
            }
        }
    }
    catch
    {

    }
    return ssid;
}

I tried to add "Access WiFi Information" entitlement for iOS 12 app as it is mentioned here but the app still get an empty ssid:https://forums.xamarin.com/discussion/139476/adding-access-wifi-information-entitlement-for-ios-12-apps

I would be thankful if anyone could help.


Clear cached images in FFimageloading.

$
0
0

Hi.
I am trying to make the app to display images on the server.
So the app fetches the url of Images from the server at first.
Then I should display images in list view.
I have used the nuget packages.One is Xamarin.FFImageLoading.Forms and the other is DLToolkit.Forms.Controls.FlowListView.

PhotosPage.Xaml

                    <flv:FlowListView.FlowColumnTemplate>
                        <DataTemplate>
                            <Grid Padding="3">

                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>

                                <ffimageloading:CachedImage HeightRequest="100" Aspect="AspectFill"
                                    DownsampleHeight="100"
                                    DownsampleUseDipUnits="false" 
                                    CacheDuration="0"
                                    Source="{Binding ImageUrl}"
                                    x:Name="cachedImage"
                                    CacheType="Memory"
                                    />
                                <!--<Image WidthRequest="100" HeightRequest="100" Source="{Binding ImageUrl}" Aspect="AspectFill"></Image>-->
                                <Label x:Name="Label" HorizontalOptions="Fill" HorizontalTextAlignment="Center" VerticalOptions="End"
                            BackgroundColor="Silver" Opacity="0.5" Text=""/>
                            </Grid>
                        </DataTemplate>
                    </flv:FlowListView.FlowColumnTemplate>

                </flv:FlowListView>

Everything is Ok and I can display cached images.
The problems is that when i return to this photoscreen,the previous images still remained and they are replaced with new images slowly.
I have researched about the ffimageloading library and tried followings for clearing cache when i leave the photoscreen page.

     for (int i = 0; i < image_list.Count; i++)
                {
                    ImageSource cachedSource = UriImageSource.FromUri(new Uri(image_list[i].ImageUrl));
                    await FFImageLoading.Forms.CachedImage.InvalidateCache(cachedSource, CacheType.Memory, true);

                }
       await ImageService.Instance.InvalidateCacheAsync(CacheType.All);
       image_list.Clear();

But i can not still solve this problem.
Please help me how to do it.

View with ViewModel and Behaviour

$
0
0

Hello,
I have a View which contains the userprofile of the current user. The view contains a viewmodel with a two-way binding to the single attributes like username or email adress. The view also has a behaviour, which validates the input and shows an error, of the input is not valid. Because of the two-way binding, the viewmodel updates the value even if the behavior says the input is wrong. I need to solve that.

My current approach is to use include the behavior in the viewmodel as a attribute. So I can access the attributes of the behavior in the setter of the attributes in the viewmodel. So I cant stop the update to the wrong inputs. But I can not get access the behavior from my viewmodel in the xaml of the view. Is that a way I can do it at all?

My next approach would be to pass the "isValid" attribute of the behavior to the viewmodel. But here again, I don't know how to do it, is it possible at all?

Last approach would be to create a command in the viewmodel, binding it to a new button in the userprofile, using a one-way binding and somehow pass the inputs from the view to the command and updateing the userprofile.

May be here is someone who can help me?

Viewcell with stacklayout containing two stacklayouts

$
0
0

Hello everybody,

I have a profile page within my app. I am using a tableview with tablesections. In one Section I want to add a stacklayout with vertical orientation, which shall contain two other stacklayouts with horizontal orientation. In the inner stacklayouts I want to add a label and an entry which are next to each other. But the second stacklayout is not visible...can you help?

<ViewCell>
    <StackLayout Orientation="Vertical" VerticalOptions="CenterAndExpand">
            <StackLayout Orientation="Horizontal">
                    <Label Text="Hausarzt: " VerticalOptions="Center"></Label>
                <Entry x:Name="familyDoctor" Placeholder="Name" HorizontalOptions="FillAndExpand" VerticalOptions="Center"></Entry>
                </StackLayout>
                <StackLayout Orientation="Horizontal">
                    <Label Text="Telefonnummer: " VerticalOptions="Center"></Label>
                <Entry x:Name="phoneNumberDoc" Placeholder="Tel." HorizontalOptions="FillAndExpand" VerticalOptions="Center"></Entry>
               </StackLayout>
      </StackLayout>
</ViewCell>

Stepper in Xamarin Forms

$
0
0

Hi There, I want to use a Xamarin.Forms stepper to add quantity. I searched a lot but I couldn't find any proper solution for this. I want to customize it like it's buttoned width, color, and most important, I want to insert label between stepper.

If you guys have suggestions for adding quantity for items in xamarin forms, please let me know.

Thanks in Advance

How to print a long page from webview

$
0
0

Hello, I implemented a print function in webview based my project but it only prints the visible part of the page.
This is the function:

            var printMgr = (PrintManager)activity.GetSystemService(Context.PrintService);
            PrintAttributes.Builder builder = new PrintAttributes.Builder();
            builder.SetMediaSize(PrintAttributes.MediaSize.UnknownPortrait); //some tries

            if (((int)Android.OS.Build.VERSION.SdkInt) >= 21)
                printMgr.Print("page", webview.CreatePrintDocumentAdapter("page"), builder.Build());
            else
                printMgr.Print("page", webview.CreatePrintDocumentAdapter(), builder.Build());

I don't find any help on that.
Is it possible to print the full page ?

Thanks in advance.

Viewing all 204402 articles
Browse latest View live


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