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

How to get System.Globalization.CultureInfo.OptionalCalendars to have > one entry on Android and iOS

$
0
0

I make use of CultureInfo.OptionalCalendars in order to support both Gregorian calendars and others, such as the Hijri and Hebrew calendars.
On Windows platforms (UWP desktop, UWP phone, WinRT 8.1, WinPhone 8.1 RT) I find the expected calendars available in CultureInfo.OptionalCalendars.

However, on Android and iOS devices, OptionalCalendars only ever contains one calendar. Can anybody tell me what I need to do in order to get more than one calendar in the OptionalCalendars collection ?


How to draw more than one circle on map?

$
0
0

Hi everybody!
I have follow docs.microsoft.com to draw a circle. The circle only draw one time when page loaded. I need to draw more and change radius of circle with out reload page!
Now:
1. How to draw the second circle?
2. How to change the radius of current circle
Thank you!

Frame + Images == Round Image? .....false, just an image with the corners cut off

$
0
0

Goal is to have images inside a circle.

Currently, the image will appear, but have the corners will be cut off. I tried to increase the size, but the image got resized to the smaller than Frame's height/width.

Is this a fundamental thing in Frames or there a setting I am not aware of?

<Frame WidthRequest="144" 
          HeightRequest="144" 
          CornerRadius="244" 
          HorizontalOptions="Center"
          BackgroundColor="Gray"
          >
          <Image Source="{Binding MyPicture}"
                    HeightRequest="544"
                    WidthRequest="544"
                    />
</Frame>

No luck in round image when setting the Image to:
- Aspect="AspectFill"
- HorizontalOptions="FillAndExpand"
- VerticalOptions="FillAndExpand"

Android app icon not changing

$
0
0
Hi,

I have uploaded this app on Play Store:

https://play.google.com/store/apps/details?id=com.softnames.samana

I changed the icon everywhere to my icon but I keep getting the Xamarin default icon when installing the app although I don’t have the Xamarin icon anywhere in my project.

I deleted obj and biin, cleaned the project and restarted several times but still having same problem.

and this is my MainActivity just in case:

[Activity(Label = "Samana", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ScreenOrientation = ScreenOrientation.Portrait, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]

and here is the AndroidManifest.xml












Can any one help please


Thanks,
Jassim

saurabhraut

$
0
0

I am trying to automate Xamarin.Forms android app.There are multiple radio buttons(third party) having same text on same page.
I am trying to tap on those with following code

var elements = app.Query(e => e.All().Property("text", "OK"));
        foreach (var element in elements)
        {
            app.Tap(element.Id);
        }
        but it is taking huge time (around 15 seconds) between 2 taps

what can be done for reducing this time ?

DependencyProperty equivalent for Xamarin Forms.

$
0
0

I'm writing a XAML + MVVM project for testing porpuses. So far i haven't had any problems trying to port my Windows code to Xamarin except for the DependencyProperty. Is there a way to get it working or probably a equivalent? Here is what i want to get working:

This is the dependencyproperty i want to use in Xaml:

public static readonly DependencyProperty MethodParameterProperty = DependencyProperty.RegisterAttached("MethodParameter", typeof(string), typeof(EventBehaviour), new PropertyMetadata(IsMethodChanged));

Here the setter:

public static void SetMethodParameter(DependencyObject d, string value) { d.SetValue(MethodParameterProperty, value); }

Here the event called:

private static void IsMethodChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var element = d as FrameworkElement; if (element != null) { // Create events here element.PreviewMouseUp += element_PreviewMouseUp; } }

macOS High Sierra and XCode 10.2 - A silent coup de grâce from Apple

$
0
0

Hi guys,

I am quite frustrated at the moment.. why? Because I updated the Visual Studio for Mac on my Macbook Pro Early 2011 15" that cannot support Mojave and guess what? It keeps saying, this version of Xamarin.iOS requires XCode 10.2 which is obviously incompatible with my macOS High Sierra 10.13.6.

Now I am trying to build a project but it throws a lot of problems at me.

I followed this link to download Xcode 10.2 manually, but then seems my problems never finish and it cannot build in release mode (which it does build it debug mode and runs it in simulator)

I just feel like Apple once again has become greedy and is committed to kill older machines to force everyone buying a new machine. I paid £2000 for my macbook pro when I had bought it and I think this is clearly a rip-off.

What is worse, Microsoft and Xamarin seem to be cooperating with Apple on that regard too. Why did it not give a warning that if I update to the latest VS for Mac and Xamarin.iOS I would run into issues? Now after a hefty download and spending time to download and apply the latest updates, when I open the project it says Xamarin.iOS is not compatible with the current version of xcode.

What a shame!

Test builds vs Production builds

$
0
0

With our mobile app we connect to a service. During the testing phase we connect to a test service and then when we are ready to publish to the ios and android stores we change the baseAddress uri to point to the production service. What I am worried about is if we forget to change the uri to production when we publish to the stores. If we did this then everyone who downloads and installs the app is now looking at our test uri instead of production uri.... which would be a disaster for us.

I am trying to think of a way so that I can minimize the chance of publishing to the app store and at the same time my baseAddress uri is pointing to the test environment. Anyone have any ideas? Maybe some sort of PreBuild event?


in iOS, to use Platform Effect, I got "no default constructor" exception. Works if "Don't Link".

$
0
0

I wanted a small tweak to how the keyboard worked in iOS and so decided to use an EFFECT.

But, I ran into trouble: System.MissingMethodException, no default constructor, on my iOS class implementing the effect. This was raised when I called Effect.Resolve().

I checked everything multiple times, and added an explicit default constructor, but no change.

Googling all I could find, I found a comment, "Check Link behavior option in iOS build window. For me, setting to "Don't Link" fixed the issue. But I didn't have enough time to investigate this further.", on this page, which doesn't seem like it would be directly related: [iOS] System.MissingMethodException: Default constructor not found for type System.Array #418

So, I went to the iOS build page, changed to "Don't Link" (it was "Link All"), and it suddenly started to work.

I'm not sure of the ramifications of "Don't Link", and if this will be a robust solution to this. It sure doesn't seem like it should be this way. Any further insights?

Setting Detail of Master Detail page causes flickering

$
0
0

Hello!
I'm trying to prevent flickering from happening when I change the Detail in MasterDetailPage.

In the constructor of the page I create all the required pages like so :
aboutPage = new NavigationPage(new Pages.About());

And then in the Clicked event I set the Detail to one of those instances:
Detail = aboutPage;
IsPresented = false;

This results in screen becoming completely white for a second, including the header, before pages show up.

How can I fix or mend this?

Thanks.

Setting the SelectedItem on a ListView (Android)

$
0
0

I can't for the life of me pre-set the selected item on a list view. The core of the problem is that the object I'm passed to be the default will not be the same instance of the object that is included in the select list. I'm using Sqlite to store my data, so each call returns newly created objects (all names have been changed to protect the guilty):

// The Widget class has a unique integer Id...
MyListView.ItemsSource = MySqlRepository.GetAllWidgets();
Widget defaultWidget = MySqlRepository.GetWidgetWithId(defaultId);

I proved this idea to myself with this code:

// Horrible brute-force method broken up so I could see each piece in the debugger...
IEnumerable<Widget> wl1 = (IEnumerable<Widget>) MyListView.ItemsSource;
List<Widget> wl2 = wl1.ToList<Widget>();
int idx = wl2.FindIndex(x => x.Id == defaultWidget.Id);
Widget listWidget = wl1[idx]; 

if (listWidget != defaultWidget)
{
    // This means that my two objects are different instances of the same "item"
    // If I set a breakpoint here, execution stops at it.
}

Ok, with me so far? I have a list of widgets, and I want to make the widget with a specific Id pre-selected when the list is first shown. (The user selected something, navigated away, and came back. I want to show the item he/she selected the last time...)

If I set MyListView.SelectedItem to defaultWidget, nothing is shown to as selected. In the debugger, SelectedItem looks like it's set to the correct item, but nothing is painted as selected.

Since I know that the object referenced by defaultWidget is not the object in the ItemsSource list, I tried brute-force finding the object in the ItemsSource list with the matching Id, and setting SelectedItem to THAT. First I put this code both in the initialization stuff in the xaml.cs:

Widget w2 = null;
foreach (Widget w in MyListView.ItemsSource)
{
    if (w.Id == defaultWidget.Id)
    {
        SelectedItem = w;
        break;
    }
}

That didn't work, so I bound SelectedItem to a property (SelectAWidgetPage.xaml):

<ListView x:Name="MyListView"
    CachingStrategy="RecycleElement"
    SelectedItem="{Binding TheSelectedWidget, Mode=TwoWay}"
    ItemsSource="{Binding TheWidgetList}" >

... and put my selection code in the setter (SelectAWidgetViewModel.cs):

private ObservableCollection<Widget> _listWidgets;
public ObservableCollection<Widget> TheWidgetList;
{
    get
    {
        return _listWidgets;
    }
}

private Widget _selectedWidget;
public Widget TheSelectedWidget
{
    get
    {
        return _selectedWidget;
    }
    set
    {
        if (value == null)
        {
            _selectedWidget = null;
        }
        else if ((_selectedWidget == null) || (value.Id != _selectedWidget.Id))
        {
            foreach (Widget w in _listWidgets)
            {
                if (w.Id == value.Id)
                {
                    _selectedWidget = w;

                    // I added this just in case it helped... it didn't. But, yes, I do implement INotifyPropertyChanged...
                    OnPropertyChanged("TheSelectedWidget"); 
                    break;
                }
            }
        }
    }
}

It's ugly, inefficient, brute-force code that should work. It does not. STILL, when I return to this page, the default item is not selected.

Help? I'm stumped at this point.

Thanks in advance for any insight you can provide!

AdUnitId Set For Admob Without MVVM

$
0
0

I have followed https://xamarinhelp.com/admob-xamarin-forms-display-google-ads-mobile-app/ and set upAdMob for my Xarain Forms app and it displays on both iOS and Android. The problem is trying to set the correct AdunitId after determining iOS versus Android. I have tried the code in many places and it compiles fine in one instance but returns an error that you can only set the AdUnitId once. Does anyone have a non-NVVM working solution for setting that?

How do I change the Resource Dictionary values programmatically?

$
0
0

I have this in my App.Xaml

<OnPlatform x:Key="XFactor" x:TypeArguments="x:Double">
                <On Platform="iOS" Value="0.25" />
                <On Platform="Android,UWP" Value="0.26" />
            </OnPlatform>```
I want to change the iOS value to 0.00 on the fly in the Code.
I added this the App_Start but no effect.


Here's is the code.

This is in the App.Xaml.cs

protected override void OnStart()
{
// Handle when your app starts

            Application.Current.Resources["XFactor"] = 0.00;

    }```

Any ideas?

Simple label wont show in ios simulator

$
0
0

I'm using the new shell with buttom nav. One of my pages is a content page. The content page wont show the label in my code. Works fine on android.

I tried many things, one of them is setting the horizontal and vertical properties to center and expand. Here I see the label on ios. Deleting those properties, makes the text disappear again. I'm going crazy over this problem! Tried to create a new content page, same problem.

Here are my page:

I can also insert a button, two buttons in a stack. Nothing shows - until I set the vertical and horizontal properties on the items.

Accessibility ignored in mostly controls (labels, entry, pickers)

$
0
0

Hello guys, I'm trying to understand how to use accessibility in some controls, I suspect that is not working, in particular:

  • inside a label, with IsInAccessibleTree set to true, Name and HelpText are ignored (just the text of the label is read)
  • inside an Entry same thing, just the placeholder is read and the rest is ignored
  • same inside a DatePicker (all ignored and the data is read)

I'm currently testing on Android, with Xamarin 3.6..thanks


UseSafeArea doesnt work for modal page?

$
0
0

Does UseSafeArea work for modal pages on xamarin.forms ? if i run it on ios simulator, it has no effect for me. should i use padding on modal pages?

How to link label with entry inside list view.

$
0
0

I have a list view with view cell containing label and entry horizontally in code behind file. I want to save label value with entry value. How can i link label value with corresponding entry value in List View.

How to implement PING identity for authentication in Xamarin.forms?

$
0
0

I am trying to implement PING identity authentication in our Xamarin.forms project. Please help me how to implement. Thanks in advance :)

RadAutoCompleteView changing property of tokens

$
0
0

I wonder if anyone knows a way to change the property of tokens (also seen in the image below) of RadAutoCompleteView such as background and text color?

us.v-cdn.net/5019960/uploads/editor/0b/fq6fppcgy3z2.png

Easiest and best-suited database for Xamarin.Forms app

$
0
0

For a smaller app I am working on - collecting responses/user data from random users who answer questions retrieved from the (same) database - I need to find the best way of storing that data in a suitable database. I have had a look at MongoDB and - since we are talking MS technology in terms of Xamarin - also considered MS SQL for this purpose. As I don't have a lot of experience in this area, I am turning to the forum for ideas and input.

I also found this forum post but since it is a bit old, I'm unsure as to whether or not this is still up to date in terms of applicable solutions.

https://forums.xamarin.com/discussion/104401/which-is-the-best-db-to-use-with-xamarin-form-app

I am not really interested in a cloud solution such as Azure but looking for a more 'common' type of database. The most important factors that I am looking for in a database are fast response time, ease-of-use, no-headache installation process and overall compatibility.

Looking forward to any input, no matter big or small.

Viewing all 91519 articles
Browse latest View live


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