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

I can't build any Android project!!!

$
0
0

For weeks I'm trying to build the Android project with no success!
I got any type of erros, such as:

  • Error CS0117 'Resource.String' does not contain a definition for 'status_bar_notification_info_overflow' (ALL resources are missing)
  • Error "aapt.exe" exited with code - ***** (The code always varies)
  • Please download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip and extract it to the /Users/MyUser/.local/share/Xamarin/Android.Support.v4/23.3.0.0/content directory. (I got this error to any folders on this directory)
  • Severity Code Description Project File Line Suppression State
    Error The file "obj\Debug\android\bin\packaged_resources" does not exist.

And others.
I try to build:

  • On Xamarin Studio on a Mac.
  • On Visual Studio inside the Parallels Desktop, on a Mac.
  • On Visual Studio in Windows.
    3 different machines!!!

My Xamarin on mac and windows are updated.
My VS is Community 2015.
I install ALL the items, for all version, on Android SDK Manager above the 5.1 Lollipop.
I try to set up the target version.

Even I create a new project, and build without any changes, with that message "Welcome to Xamarin Forms!", I got the same erros!!


Unable to select document using FilePicker plugin (document greyed out)

$
0
0

Hi I'm using the FilePicker plugin to enable user to select a document from iCloud in iOS from shared PCL using Visual Studio 2015.
I setup provisioning profile for iCloud and installed the plugin but when using the code below it shows file picker from iCloud where I have 2 documents created with Pages app but they are greyed out and unable to select them (see image below)? Not sure why I'm unable to select either of them any ideas? Has anybody had success using FilePicker and have suggestion/sample?

Plugin nuget page here: https://www.nuget.org/packages/Xam.Plugin.FilePicker

Or is there a better way to allow a user to pick a document in Xamarin PCL?

My PCL code:

` try
            {
                FileData fileData = await CrossFilePicker.Current.PickFile();
                Byte[] byteArray = fileData.DataArray;
                string fileName = fileData.FileName;

            }
            catch(Exception e)
            {
                await DispalyUserMessage("Exception Caught", e.Message, "OK");
            }`

I also followed this method to install iOS dll's manually: https://github.com/Studyxnet/FilePicker-Plugin-for-Xamarin-and-Windows/issues/3

Image ->(https://www.dropbox.com/s/6wh92ges0be0q56/WP_20161121_17_17_50_Pro.jpg?dl=0)

Many thanks

How to remove features?

$
0
0

Hello,

I make a master detail page on my app and I would like remove the features present on my app on iOS. It's possible?
And i would like replace the text "Menu" by a hamburger menu, I use a image only?

Thank you

How to style a ListView ImageCell with xaml

$
0
0

Hi,

I am new so please be gentle.

I am wondering how to style a ListView ImageCell.

I have tried this, but it doesn't seem to work.

in App.Xaml I added this Style

<Style TargetType="ImageCell">
         <Setter Property="TextColor" Value="Blue"></Setter>
</Style>

And I have this xaml in my page:

 <ListView
      ItemsSource="{Binding Items}" x:Name="List" ItemSelected="ListOnItemSelected">
        <ListView.ItemTemplate>
        <DataTemplate>
                    <ImageCell Height="30"
                                     Text="{Binding Title}"
                                     Detail="{Binding Description}"
                                     ImageSource="{Binding ImageUrl}">
                     </ImageCell>
                </DataTemplate>
      </ListView.ItemTemplate>
    </ListView>

The items display as excpected, but, at least in Android, the style is not applied.

How to select navigation menu when set detail page from portable library

$
0
0

Hello,

I am new in Xamarin form.
I have created application with Master Detail template.
I have implemented page navigation to assign page in Detail page,but issue is that menu not selected according assign detail page.I try to implement using navigation render but not able how to implement it.

So can you please suggest how to implement it.

Thanks in advance

How to draw route in xamarin froms Map?

$
0
0

How to draw route in xamarin froms Map? when i moving.

Error when timer elapsed second time

$
0
0

Hello

I'm making an application where I get device ( IPhone) current location after every X second ( Using timer ) and send it to one restful api. When code runs first time, it gets latitude and longitude but when it tries to run second time, it throws exception like "System.NullReferenceException: Object reference not set to an instance of an object". I don't know exact line from where exception is getting generated. VS shows NullReferenceException on following line in Main.cs in xamarin.forms.iOS project.

UIApplication.Main(args, null, "AppDelegate");

Here is my code

protected override void OnStart()
        {
            Device.StartTimer(new TimeSpan(0, 0, 60), CallDeviceMethod());
        }
        private Func<bool> CallDeviceMethod()
        {
            GetDeviceLocation();
            return null;
        }
        public async Task<string> GetDeviceLocation()
        {

            var locator = CrossGeolocator.Current;
            locator.DesiredAccuracy = 50;
            var position = await locator.GetPositionAsync(timeoutMilliseconds: 10000);
            HttpClient client = new HttpClient();
            var todoItems = true;
            var response = await client.GetStringAsync("ResulFull Api URL link=" + position.Latitude + "&Longi=" + position.Longitude);
            todoItems = JsonConvert.DeserializeObject<bool>(response);
            return null;
        }

Looking for any solution and sorry for my bad programming practices.

Regards
Zahid

security questions on drop down(picker) is truncated in Xamarin forms.

$
0
0

while selecting security questions form drop down picker in Xamarin forms the text is truncated . what we have to do ignorer to avoid text truncation in dropdown ?


Binding on nested class on XAML does not working anymore (update Xamarin.Forms 2.3.4.224)

$
0
0

Binding with nested class doe not working.

I have an class in another assembly like this:

public static class Car
{
    public static class Wheel
    {
        int value = 20;
    }
}

On XAML file:

<?xml version="1.0" encoding="utf-8" ?>
<Grid xmlns="http://xamarin.com/schemas/2014/forms"
   xmlns:LibStatic="clr-namespace:com.car.Lib;assembly=com.car.Lib">

  <Label FontSize="{x:Static LibStatic:Car+Wheel.value}" />

</Grid>

I'm gettting the error "Type Car+Wheel not found in xmlns clr-namespace:com.car.Lib;assembly=com.car.Lib"

Prism + Xamarin.Forms Project error after closing app on Android?

$
0
0

I am developing an app using Prism and Xamarin Forms. I used Prism template to create the project in Visual Studio 2017 community edition.

Here is the app.cs page

protected override void OnInitialized()
{
    InitializeComponent();

    NavigationService.NavigateAsync("BasePage");
}

protected override void RegisterTypes()
{
    Container.RegisterTypeForNavigation<BasePage>();
    Container.RegisterTypeForNavigation<MainNavigationPage>();
    Container.RegisterTypeForNavigation<MilkPurchasePage>();
    Container.RegisterTypeForNavigation<TruckSheetPage>();
    Container.RegisterTypeForNavigation<LocalSalePage>();
    Container.RegisterTypeForNavigation<MembersPage>();
}

Now BasePage contains Hamburger menu and from there it will navigate to MilkPurchasePage

Now everything works when I run the project on mobile but once I close the app I get

Unfortunately , MilkApp.Droid has stopped.

I only added user interface. No background code has been added other than navigation.

I tried to debug bug I am unable to get it in visual studio. I checked all errors in Error Settings too. But still I am unable to solve it.

Why I am getting this ?

Scrollable GridLayout

$
0
0

Hello Guys.

I need to do a layout similar to the attached image.

As you can see, I will have objects stored on a database and I will dynamically load them onto my grid.

The thing is, I'll have more than 50 objects and I don't want them inside the same grid, because they'll be very small if I do that. I need them to scroll. Vertically would be better.

I thought about a ScrollView and a Grid inside but failed attempting to create such thing.

Could you please help to achieve that?

Thank you!

PCL Storage System.NotImplementedException

$
0
0

Dear all,

I have installed PCLStorage nuget package to all of Portable Project, Android Project and iOS Project. Then i have get this piece of code from github page of PCL Storage:

public async Task PCLStorageSample()
{
    IFolder rootFolder = FileSystem.Current.LocalStorage;
    IFolder folder = await rootFolder.CreateFolderAsync("MySubFolder",
        CreationCollisionOption.OpenIfExists);
    IFile file = await folder.CreateFileAsync("answer.txt",
        CreationCollisionOption.ReplaceExisting);
    await file.WriteAllTextAsync("42");
}

Then called this method after click of a button and see this error:

System.NotImplementedException: This functionality is not implemented in the portable version of this assembly. You should reference the PCLStorage NuGet package from your main application project in order to reference the platform-specific implementation.

I searched a lot and can not find a solution. I need your helps.

Thanks,

Onur

Android - Method 'Xamarin.Forms.Device.get_RuntimePlatform' not found.

$
0
0

Hi, Ive just updated my Xamarin packages to the latest version recently for all my projects (PCL, iOS and Android). PCL and iOS work perfectly fine but Android, I cannot build and deploy my Android package to either the simulator or a real device; I get this error message "Method 'Xamarin.Forms.Device.get_RuntimePlatform' not found." on LoadApplication(new App()); in OnCreate method.

Im completely lost and really need your help. Ive looked on the forums and I cannot find an answer/solution. Please, please help. Ive tried to roll back Xamarin.Forms to a previous version and I still get this error message for Android.

Please help.

Navigation Bar In A Modal Page

$
0
0

I was wondering if it is possible to put a navigation bar in a modal page to show a title etc?

Thanks

Get Contacts. DependecyService.

$
0
0

Hello. How i can get contacts from Android, iOS with DependecyService?


Get UIBarButtonItem from ToolbarItem

$
0
0

So, I have a UIAlertController action sheet that I display using iOS-only code in my cross-platform Xamarin.Forms app. The action sheet is displayed when a Xamarin.Forms.ToolbarItem is tapped by the user. When on iPad, the UIAlertController containing the action sheet needs to have its UIPopoverPresentationController.BarButtonItem set to the menu item that caused it to appear, or I have to manually specify a location on screen where I want the action sheet to appear.

Is there no way of converting a Xamarin.Forms.ToolbarItem into its corresponding UIBarButtonItem?

I've tried for hours by intercepting calls to PageRenderer and NavigationRenderer to no avail, since the ToolbarItems properties of the respective native views are never set. I can see the Xamarin.Forms.ToolbarItems I provided at Xamarin.Forms.Page construction, however. I cannot use Platform.GetRenderer() as it requires a VisualElement, which Xamarin.Forms.ToolbarItem doesn't implement.

I also looked at Xamarin.Forms.Platform.iOS.ToolbarItemExtensions.ToUIBarButtonItem, which gives me a proper UIBarButtonItem from a Xamarin.Forms.ToolbarItem, but the provided item is a new such, and has no correspondence on screen. Using the returned item as a value for UIPopoverPresentationController.BarButtonItem causes the application to crash.

Any other ideas?

Text on Button

$
0
0

Hi All,

The text given to Button control in xamarin forms appears in Capital letter all times. Can you please suggest solution on it.

Thanks..

ActionSheet not staying in the middle of the screen on iPads after rotation?

$
0
0

I recently started using ActionSheets in my application but noticed that when I rotate my iPad, the ActionSheet does not stay in the center of the screen. Has anyone else seen this? See screenshots below. I'm just simply using the Page.DisplayActionSheet() method to do this. Android seems to work just fine.

I think it may have to do with the UIDevice.OrientationDidChangeNotification. I tried to create a custom ActionSheet and based it on the Xamarin.Forms code found here.

The notification name implies that the orientation change already did occur. However, the bounds of the view are still the same as the bounds before the rotation happens. Should the bounds be correct (the bounds it will be once the rotation completes), it works just fine. The notification seems to be more of an orientation will occur/is occuring type of thing.

This is happening as far back as Xamarin.Forms 2.3.2.127 (maybe further) and also in 2.3.4.224.

Starting position (landscape):

image

Rotate right (portrait):

image

Rotate back to starting position (landscape):

image

AbsoluteLayout.LayoutBounds from a ResourceDictionary?

$
0
0

Are the AbsoluteLayout.LayoutBounds of a control able to be set through a ResourceDictionary object, specifically using OnIdiom with it as well? Whenever I try it, my controls just seem to disappear. But if I set the same LayoutBounds directly onto the control, it works just fine.

AbsoluteLayout.LayoutFlags does not seem to have this issue.

This works:

<ResourceDictionary>
  <AbsoluteLayoutFlags
    x:Key="ContainerAbsoluteLayoutFlags">
    All
  </AbsoluteLayoutFlags>
</ResourceDictionary>

<AbsoluteLayout>
  <ContentView
    VerticalOptions="FillAndExpand"
    HorizontalOptions="FillAndExpand"
    AbsoluteLayout.LayoutFlags="{StaticResource ContainerAbsoluteLayoutFlags}">
    <AbsoluteLayout.LayoutBounds>
      <OnIdiom
        x:TypeArguments="Rectangle"
        Phone="0.5, 0.5, 1, 1"
        Tablet="0.5, 0.5, 0.8, 1" />
    </AbsoluteLayout.LayoutBounds>
    <StackLayout
      VerticalOptions="Center"
      HorizontalOptions="Center">
      <Label
        Text="My Label" />
      <Button
        Text="My Button" />
    </StackLayout>
  </ContentView>
</AbsoluteLayout>

This does not work:

<ResourceDictionary>
  <AbsoluteLayoutFlags
    x:Key="ContainerAbsoluteLayoutFlags">
    SizeProportional
  </AbsoluteLayoutFlags>
  <Rectangle
    x:Key="ContainerAbsoluteLayoutBounds">
    <OnIdiom
      x:TypeArguments="Rectangle"
      Phone="0.5, 0.5, 1, 1"
      Tablet="0.5, 0.5, 0.8, 1" />
  </Rectangle>
</ResourceDictionary>

<AbsoluteLayout>
  <ContentView
    VerticalOptions="FillAndExpand"
    HorizontalOptions="FillAndExpand"
    AbsoluteLayout.LayoutFlags="{StaticResource ContainerAbsoluteLayoutFlags}"
    AbsoluteLayout.LayoutBounds="{StaticResource ContainerAbsoluteLayoutBounds}">
    <StackLayout
      VerticalOptions="Center"
      HorizontalOptions="Center">
      <Label
        Text="My Label" />
      <Button
        Text="My Button" />
    </StackLayout>
  </ContentView>
</AbsoluteLayout>

Interestingly, if I don't use OnIdiom, the ResourceDictionary object does work. The problem is I need OnIdiom to work.

<ResourceDictionary>
  <Rectangle
    x:Key="ContainerAbsoluteLayoutBounds">
    0.5, 0.5, 0.8, 1
  </Rectangle>
</ResourceDictionary>

9 Patch Image not stretching properly

$
0
0

I have two 9-patch images that are not scaling properly. This is the code in xaml

<controls:StretchImage Aspect="Fill" Source="{Binding Image}" RelativeLayout.WidthConstraint="{ConstraintExpression
        Type=RelativeToParent,Property=Width,Factor=1,Constant=0}" x:Name="mainImage"></controls:StretchImage>
    <controls:StretchImage Aspect="Fill" Source="{Binding ScaledImage}" WidthRequest="{Binding Ratio, Converter={StaticResource ParameterToImageYOffsetConverter}, ConverterParameter={x:Reference Name=mainImage}}">

StretchImage is just a class that inherits Image so that iOS can create the areas that are protected from stretching, and this does actually work.

I'm confident that all the different dpi images are created correctly, but they're just stretching uniformly. Any ideas?


Viewing all 76418 articles
Browse latest View live