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

Xamarin.Forms not generating the partial class of the code behind

$
0
0

I'm using Xamarin.Forms 1.4.2.6359 on VisualStudio 2015 RC + Windows 10 Build 10130 and from on day to another
my Xamarin.Forms project stoped compiling. It seems to be about Xamarin.Forms or VS2015 RC not being able to generate the partial classes related to the xaml files I have in the solution. This is not the first time it happened to me. A week before the same issue had happened.
It also occurs sometimes when I import a pré existing Xaml page (with its related code behind file) to a new PCL Xamarin.Forms project on VS 2015 RC.
For some reason if I buil -> clean my solution and try to build it again. the build breaks since VS can't find the auto generated partial class of my xaml pages and the build fails.


custom ContentView Controller not showing bound text

$
0
0

I have a custom ContentView Controller that is not showing text being bound to it, not sure what the problem is. Everything runs fine, but when its done loading the text is not being displayed. Please Help!, Thanks

>!         public class MenuItemControl : ContentView
    >!  {
    >!      StackLayout main;
    >!      Label title, subTitle;
    >!      public static BindableProperty ItemClickedCommandProperty = BindableProperty.Create("ItemClicked", typeof(MenuItemControl), typeof(Command), defaultBindingMode: BindingMode.TwoWay);
    >!      public static BindableProperty titleProperty = BindableProperty.Create("Title", typeof(MenuItemControl), typeof(string), defaultBindingMode: BindingMode.TwoWay);
    >!      public static BindableProperty SubTitleProperty = BindableProperty.Create("SubTitle", typeof(MenuItemControl), typeof(string), defaultBindingMode: BindingMode.TwoWay);
    >!      public string Title
    >!      {
    >!          get
    >!          {
    >!              return (string)GetValue(TitleProperty);
    >!          }
    >!          set
    >!          {
    >!              SetValue(TitleProperty, value);
    >!              OnPropertyChanged();
    >!          }
    >!      }
    >!      public string SubTitle
    >!      {
    >!          get
    >!          {
    >!              return (string)GetValue(SubTitleProperty);
    >!          }
    >!          set
    >!          {
    >!              SetValue(SubTitleProperty, value);
    >!              OnPropertyChanged();
    >!          }
    >!      }
    >!      public Command ItemClickedCommand
    >!      {
    >!          get
    >!          {
    >!              return (Command)GetValue(ItemClickedCommandProperty);
    >!          }
    >!          set
    >!          {
    >!              SetValue(ItemClickedCommandProperty, value);
    >!          }
    >!      }
    >!
    >!      public static BindableProperty TitleProperty
    >!      {
    >!          get
    >!          {
    >!              return titleProperty;
    >!          }
    >!
    >!          set
    >!          {
    >!              titleProperty = value;
    >!          }
    >!      }
    >!
    >!      public void UpdateVisualElements()
    >!      {
    >!          title.Text = Title.ToString();
    >!          subTitle.Text = SubTitle.ToString();
    >!      }
    >!
    >!      public MenuItemControl()
    >!      {
    >!
    >!          TapGestureRecognizer itemTapped = new TapGestureRecognizer();
    >!          itemTapped.Tapped += ItemWasClicked;
    >!
    >!          BoxView line = new BoxView
    >!          {
    >!              HeightRequest = 1,
    >!              HorizontalOptions = LayoutOptions.FillAndExpand,
    >!              BackgroundColor = Color.FromHex("#f1f1f1")
    >!          };
    >!
    >!           title = new Label
    >!          {
    >!              Text = Title,
    >!              Margin = new Thickness(10, 2, 0, 0),
    >!              HorizontalOptions = LayoutOptions.StartAndExpand,
    >!          };
    >!
    >!           subTitle = new Label
    >!          {
    >!              Text = SubTitle,
    >!              Margin = new Thickness(10, 2, 10, 0),
    >!              FontSize = 14,
    >!              TextColor = Color.FromHex("#c1c1c1"),
    >!              HorizontalOptions = LayoutOptions.End,
    >!          };
    >!
    >!          Image image = new Image
    >!          {
    >!              HorizontalOptions = LayoutOptions.End,
    >!              Source = "icons/blue/next",
    >!              WidthRequest = 20
    >!          };
    >!          main = new StackLayout()
    >!          {
    >!              Children = {
    >!
    >!                  line,
    >!                  new StackLayout{
    >!                      Orientation = StackOrientation.Horizontal,
    >!                      HorizontalOptions = LayoutOptions.Fill,
    >!                      Padding = new Thickness(10),
    >!                      Children ={
    >!
    >!                          title,
    >!                          subTitle,
    >!                          image
    >!                      }
    >!                  }
    >!              }
    >!          };
    >!          main.GestureRecognizers.Add(itemTapped);
    >!
    >!      }
    >!
    >!      public void ItemWasClicked(object sender, EventArgs e)
    >!      {
    >!          ItemClickedCommand.CanExecute(true);
    >!      }

How to create a 1 row and 2 column layout?

$
0
0

Hi! i would like to ask if how can i achieve this kind of layout..
please see attached file... thank you

height should be equally divided into two column..

Is possible connect to a specified WIFI in iOS?

$
0
0

I have a SSID and password for a WI-FI and i try to connect it automatically. I have found the solution for Android, but have anyone same solution for iOS?

remove extra space / embedded ListView

$
0
0

I am trying to figure out how to remove the white space you see in the image below (surrounded by a red rectangle). Notice I have a ListView embedded in a parent ListView.

enter image description here

XAML

<ListView x:Name="___listview" HasUnevenRows="True">
    <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <StackLayout>
                    <Button Image="{Binding ImageName}" Command="{Binding ShowDetailsCommand}" />
                    <ListView ItemsSource="{Binding Notes}">
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <TextCell Text="{Binding Note}" />
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                </StackLayout>
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

This probably isn't needed, but here is the model...

MODEL

namespace ViewCellClick
{
    public class ModelBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    public class Model : ModelBase
    {
        public Model()
        {
            _imageName = "ellipses_vertical.png";
            _showDetails = true;
            ShowDetailsCommand = new Command(() =>
            {
                ShowDetails = !_showDetails;
                ImageName = (_imageName == "ellipses_vertical.png")
                                        ? "ellipses_horizontal.png"
                                        : "ellipses_vertical.png";
            });
        }

        bool _showDetails;
        public bool ShowDetails
        {
            get { return _showDetails; }
            set { if (_showDetails != value) { _showDetails = value; OnPropertyChanged("ShowDetails"); } }
        }

        string _imageName;
        public string ImageName
        {
            get { return _imageName; }
            set { if (_imageName != value) { _imageName = value; OnPropertyChanged("ImageName"); } }
        }

        public ICommand ShowDetailsCommand { get; set; }

        List<ChildModel> _notes;
        public List<ChildModel> Notes { get { return _notes; } set { _notes = value; } }
    }

    public class ChildModel : ModelBase
    {
        public ChildModel(string note) { _note = note; }
        string _note;
        public string Note
        {
            get { return _note; }
            set { if (_note != value) { _note = value; OnPropertyChanged("Note"); } }
        }
    }
}

SVG Image issue

$
0
0

Hi ,

I am getting below error while rendering SVG image in Xamarin forms. Can you please help.

Unhandled Exception: System.AggregateException: One or more errors occurred.

How to Resolve Exception: Cannot create an instance of "WindowsPage".

$
0
0

Hey everyone,

Brand new to Xamarin forms here and trying to get started in cross platform app development using the package. However right out of the gate I seem to be running into an issue that has been asked a few times elsewhere but I haven't really seen an actual response on. Currently I'm trying to work on the UWP / Universal Windows / Windows 10 User Interface in a Portable Forms / PCL setup.

It's the Cannot create an instance of WindowsPage error message in the Microsoft Visual Studio 2015 Xaml designer. I'm following the guide at https://developer.xamarin.com/guides/xamarin-forms/platform-features/windows/installation/universal/ so I added the line for "xmlns:forms="using:Xamarin.Forms.Platform.UWP" the xaml file before changing the page tag from Page to forms:WindowsPage thus referencing the xamarin forms package. I did update all the NuGet packages to the latest version. Xamarin forms is something like 2.2 at the moment.

I initially installed the defaults for the VS2015 Xamarin package and I just tried modifying that installation with every extra component included so I don't think I'm missing anything there. I believe Xamarin is installed properly since it shows up in the Help -> Xamarin menu and I can choose new solutions out of the Xamarin forms package but I'm not sure what could be causing the issue.

Here's the XAML code

<forms:WindowsPage
    x:Class="SoloPathfinderPCL.UWP.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:forms="using:Xamarin.Forms.Platform.UWP"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:SoloPathfinderPCL.UWP"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

</forms:WindowsPage>

Here's my Stack Trace for Exception: Cannot create an instance of "WindowsPage".

at Microsoft.VisualStudio.DesignTools.Platform.InstanceBuilders.InstanceBuilderOperations.InstantiateType(Type type, Boolean supportInternal)
   at Microsoft.VisualStudio.DesignTools.Platform.InstanceBuilders.ClrObjectInstanceBuilder.InstantiateTargetType(IInstanceBuilderContext context, ViewNode viewNode)
   at Microsoft.VisualStudio.DesignTools.Platform.InstanceBuilders.ClrObjectInstanceBuilder.Instantiate(IInstanceBuilderContext context, ViewNode viewNode)
   at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.InstanceBuilders.FrameworkElementInstanceBuilder.Instantiate(IInstanceBuilderContext context, ViewNode viewNode)
   at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.InstanceBuilders.UserControlInstanceBuilder.Instantiate(IInstanceBuilderContext context, ViewNode viewNode)
   at Microsoft.VisualStudio.DesignTools.Platform.InstanceBuilders.ViewNodeManager.CreateInstance(IInstanceBuilder builder, ViewNode viewNode)

Hope someone can point me and everyone else having this issue in the right direction. Thanks.

What is the difference between a View and a ContentView class?

$
0
0

What is the difference between the two?


CarouselView 2.3.0-pre2

$
0
0

Xamarin.Forms.CarouselView

News

CarouselView is now open source:
https://github.com/xamarin/Xamarin.Forms.CarouselView

2.3.0-pre2

bugs fixed

  • 41463 - "CarouselView Crashes with "Sequence Does not Contain a Matching Element'"

  • 40513 - "Adding views to CarouselView after rendered and swiping crashes Forms"

Other fixes

Reduced assemblies referenced per platform project from three to one so
that now each platform gets its own version of Xamarin.Forms.CarouselView
into which the portable library has been merged.

For example, Android used to referenced:
  Xamarin.Forms.CarouselView
  Xamarin.Forms.CarouselView.Platform
  Xamarin.Forms.CarouselView.Android

But now only references:
  Xamarin.Forms.CarouselView (android specific)

2.3.0-pre1

Nuget package

Notes

Creating this thread to collect all CarouselView feedback until it is merged back into the Xamarin.Forms package.
James Montemagno put together a post on CarouselView here

Chars get cut off on larger Android Phone emulators - how to fix?

$
0
0

PCL project. I have a picker control. I have attached two images, of two different Android emulator phones. The XXHDPI image shows correctly (5" KitKat XXHDPI Phone (Android 4.4 API 19)), in that the entire character N or S shows. The XHDPI, (5.7" Marshmallow XHDPI Phone (Android - API 23)), cuts off the top of the N. At first I thought that it had something to do with XHDPI VS XXHDPI, but then I tried it on a 5.5" Marshmallow (6.0.0) XXHDPI Phone (Android 6.0 - API 23), and again the N was cut off. So...it has something to do with a larger screen size?

Haven't tested yet on Apple, will I need to do something different there?

Font Awesome not working in iOS

$
0
0

Hello Guys,

I am using font awesome for fonts in application.
These fonts are working fine on ios emulator,
But when I create .ipa file and install that on iPhone then those fonts are not working.
Except the font it shows "?" images.

I added "fontawesome.ttf" in resource folder.
Also edited "Info.plist" file.

Plz help me out.

DependencyService not working (iOS 10.2, XF v2.3.3.180)

$
0
0

Hi,
I have an issue that the DependencyService is not working in iOS, while the same works perfectly in Andorid and UWP.

Example code:

using System.IO;
using Foundation;

[assembly: Xamarin.Forms.Dependency(typeof(FontHelper))]

namespace Controls.iOS
{
    public sealed class FontHelper : IFontHelper
    {
        public string GetFontPath(string fontName)
        {
            var fileName = Path.GetFileNameWithoutExtension(fontName);
            var extension = Path.GetExtension(fontName);
            return NSBundle.MainBundle.PathForResource(fileName, extension);
        }
    }
}

When calling var fontHelper = DependencyService.Get<IFontHelper>(); I only get a null result.

Registering the service manually in AppDelegate.OnActivated(UIApplication uiApplication) did not help either. I tried this variants:

DependencyService.Register<IFontHelper, FontHelper>();
DependencyService.Register<FontHelper>();

The same problem applies to ViewRenderer, which are declared as follows:

[assembly: Xamarin.Forms.ExportRenderer(typeof(TestView), typeof(TestViewRenderer))]

namespace Controls.iOS
{
    [Preserve(AllMembers = true, Conditional = false)]
    public sealed class TestViewRenderer : ViewRenderer<TestView, UIView>
    {
        [Preserve]
        public TestViewRenderer()
        {
        }
    }
}
  • According to the documentation this can happen in UWP when using Native Compilation, but shouldn't happen in iOS.
  • The setting Linker behavior is set to Don't link.
  • A Xamarin.Forms.Forms.Init(string[] assemblies) method seems to be missing. However, the Application Output (NSLog) confirms that all necessarily assemblies got loaded.
  • A imperatively method for registering ViewRenderer and EntryRenderer seems to be missing. There is only the declarative method using the ExportRendererAttribute.
  • When resolving the renderer, I get the Xamarin-renderer for the base class. So the resolving appears to work, while the registering of custom types seems to be the problem.

I am wondering if this is a problem with the DependencyService or an mistake in the documentation.

XF on Android: From a notification action, how can I start my app then navigate to a specific page?

$
0
0

I'm somewhat new to Android, so be gentle. I have a notification with an action "Accept" which launches a non-UI activity to process that the user has accepted something and navigate the user to a specific page like a dashboard. This is all fine and good when the app is running or in the background, but when the app isn't running and I tap "Accept" from the notification, the app looks like it tries to start but immediately crashes. My app does require authentication so I need some way to launch the application with "something" that will allow me, in code, to navigate to a specific page after authentication.

Being new to Android I realize I may or may not be taking the right approach on this. If anyone can point me to some docs, or some feature, or something it would be greatly appreciated!

OnPlatform XAML

$
0
0

Hi!
I am trying to add the OnPlatform tag in my XAML ContentPage definition file.
I have a working Android App and now wnat to to make tweaks for the IOS version.
I would like to use the OnPlatform tag to detect whether Android or IOS are being used.
I would also like to detect whether a tablet or phone is in use, but I did not see a tag for this.

1) I tried to add the OnPlatform to my buttons to set the font, but then the text on the buttons just disappeared
OnPlatform version:

<Button>
  VerticalOptions="CenterAndExpand" Text="{Binding ItsVal}" Clicked="OnAquaDeviceCellClick"
  <OnPlatform x:TypeArguments="Font"
    iOS     ="15"
    Android ="13"
    WinPhone="14" />
</Button>

Generic version that works:
<Button Font="13" VerticalOptions="CenterAndExpand" Text="{Binding ItsVal}" Clicked="OnAquaDeviceCellClick" />

2) I tried to add the OnPlatform in my ListView to set the RowHeight but got a Java exception on Android
OnPlatform version:

<ListView>
      <OnPlatform x:TypeArguments="RowHeight"
        iOS     ="50"
        Android ="40"
        WinPhone="30" />
        ItemsSource="{Binding}" ItemTapped="OnGetRidOfSelection"
        ItemTemplate="{local:DataTemplateSelector Page={x:Reference thePage}"
    </ListView>

Generic version that works:

<ListView RowHeight="40" ItemsSource="{Binding}" ItemTapped="OnGetRidOfSelection"
             ItemTemplate="{local:DataTemplateSelector Page={x:Reference thePage}" />

What am I doing wrong?
Do I have to use the code "Device.OS" to do this?

Thanks!

Xamarin form Prism navogation

$
0
0

hello everyone, I am creating an application inziando adopting prism, I wanted to open a modal window to full screen how can I do?

then another problem my scenario is as follows, when you access the app, if the user is not logged in, you should see a login page (full screen, modal window), with a button to possible registration (and should open another window), but if the user is logged in should see the master-detail, more the first time you should always mode and refer to modal a page type Carousel classic "Walkthrough", how can I implemenare something with prism?


Xamarin.Forms Feature Roadmap

$
0
0

This roadmap outlines our anticipated feature releases.

Are there things you don't see here that you feel strongly deserve a spot? Make your voice heard and open a proposal on the Xamarin.Forms Evolution forum.

Primary Focus

Quality is top of the list. This means stability and performance first and foremost. Xamarin.Forms has been swiftly adopted as a preferred tool for delivering production apps in addition to rapid prototypes. Our focus and priorities are to support the Xamarin.Forms community in those areas. In the release schedule below, we've highlighted how and where we are making those investments.

A Note About Bugs

As this thread is primarily about the feature roadmap, we anticipate the important question "what about ___ bug"?! Improving quality by addressing bugs is huge priority and ongoing focus for the team, in addition to improve our communication across the board.

Disclaimer

We cannot predict the future and how everything will shake out. Things will change. Timing may be adjusted due to priority changes, in pursuit of quality standards, or any number of other really good reasons that we will strive to proactively and openly communicate.

The Features Roadmap

Milestone Release Date
2.3.3 December 2016
2.4.0 February 2017
2.5.0 May 2017

2.3.3 - December 2016

Native View Declaration - Feature
Native view declaration allows you to add bindable iOS, Android, and Windows views directly to XAML. Rather than having to write a custom renderer, you can simply add the control directly to XAML with no additional configuration. This not only works with stock platform controls, but custom controls as well.

Platform-Specifics - Feature
Platform-specifics allow you to take advantage of native functionality that is only available on select platforms that Xamarin.Forms targets from shared code.

UWP Blur Support (3rd party nuget) - Feature
Adds the UWP blur platform-specific.

2.4.0 - February 2017

Bindable Picker - Feature
Adds data binding to the Picker control, specifically the following properties:

  • ItemSource

  • SelectedItem

https://github.com/xamarin/Xamarin.Forms/pull/515

Accessibility (A11y) Support - Feature
Proposal
Adds accessibility support to Xamarin.Forms by exposing the underlying accessibility features on iOS, Android, and Windows 10.

CarouselView v1 Stable - Feature
CarouselView was introduced at Xamarin Evolve 2016 and has been in prerelease ever since. v1 brings stability and performance improvements.

Xamarin.Forms for macOS Preview - Feature
Xamarin.Forms is coming to macOS, joining iOS, Android, Windows, and Tizen as target platforms for Xamarin.Forms.

Fast Renderers - Performance
Optimize built-in and custom view renderers to streamline view creation and improve performance.

Startup Time Improvements - Performance
Improve the startup and initialization time for Xamarin.Forms apps.

Compiled Native Views - Enhancement, Performance
Bring native view declaration to XAMLC, so users don't have to opt-out of XAMLC in PCLs where pages use native view declaration.

OnIdiom Support for Desktop (UWP) - Enhancement
Developers have lots of options when it comes to configurability based on operating system (Android, iOS, UWP, etc.), version (9, 10, etc.), and idiom (mobile or tablet). This adds Desktop as an OnIdiom for UWP developers.

https://github.com/xamarin/Xamarin.Forms/pull/420

XAMLC Enhancements - Enhancement, Performance
Approaching full support for currently supported XAML features. Compile time support for all value providers.

Deprecation of iOS 6/7

Deprecation of WP8

2.5.0 - May 2017

Xamarin.Forms Embedding - Feature
Embed Xamarin.Forms into a native Xamarin.iOS, Xamarin.Android, or Windows 10 app.

Xamarin.Forms for macOS - Feature
Xamarin.Forms is coming to macOS, joining iOS, Android, Windows, and Tizen as target platforms for Xamarin.Forms.

MenuPage - Feature
Alternative to the MasterDetail page, but rendered as a platform-specific menu that makes creating flyouts easy.

Cut down on GPU overdraw for Android - Performance
Try to avoid overdraw on Android where possible to improve performance.

Reduce native views created - Performance
Cut down on backing native views created for Xamarin.Forms, as noted by Miguel in #42948.

Layout Compression - Performance
LayoutCompression allows multiple layers of Xamarin.Forms layouts to be packed into a single native one.

Prism-Like URI Navigation Routing - Enhancement
Navigate to a page using Uri navigation, similar to what Prism does.

NavigationService.NavigateAsync("ListPage/DetailPage?id=1");

Single DLL - Enhancement
Ship Xamarin.Forms as a single DLL to improve startup performance and assist the linker.

Open Source Contributions

As noted above, the Xamarin.Forms Evolution forum is the place to start.

Button HeightRequest and WidthRequest ignore if RowDefinition and ColumnDefinition set to *

$
0
0

Hi,

I have created a button in C#, setting the HeightRequest and WidthRequest, however these values seem to be ignored when the RowDefinition and ColumnDefinition are set to *. They are only taken into account if Auto is used.

Is this expected? I would have thought that the HeightRequest and WidthRequest would be used regardless of the RowDefinition and ColumnDefinition values.

Thanks

Paul Diston

Connect mobile application to SQL server

$
0
0

Hello everyone,

I am new in developing mobile applications. I am trying to start a simple project on Android/iOS/Windows phones. The application should contain a login page that the user enters username and password and the application should check these info on the local SQL server and check whether the user is registered or not. I have couple of questions and just need your help :)

1) How to create the server tasks (PHP, Json...etc) and what should the server send to the application?
2) How to connect the xamarin.form project to that SQL server to check the info the user entered?

your help will be really appreciated :)
Thank you in advance!

Frame not in module

$
0
0
Hello ,


When I go for authicaution via Google API .so I got error frame not in module.

How to implement Expandable/Collapsible ListView in xamarin forms?

$
0
0

Can anyone help me to implement Expandable/Collapsible ListView in xamarin forms. I have attached a screenshot as an example.

Viewing all 91519 articles
Browse latest View live


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