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

How to fix 'NaN is not a valid value for height'

$
0
0

I'm trying to create a Grid Layout. I can't find any "Template" option for when binding to a ViewModel, so I'm trying to hand roll this thing.

Here's my XML

<ScrollView x:Name="ModuleScrolLView"
            BackgroundColor="#d3d6db">
    <StackLayout x:Name="ModuleStackLayout"
                 Orientation="Vertical"
                 VerticalOptions="FillAndExpand">
        <Grid x:Name="SegmentGrid"
              RowSpacing="10"
              ColumnSpacing="10"
              VerticalOptions="StartAndExpand">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
        </Grid>
        <WebView Source="{Binding DescriptionHtml}" BackgroundColor="White" />
    </StackLayout>
</ScrollView>

And here's my code behind

public partial class Module : ContentPage
{
    private readonly ModulePageViewModel _viewModel;

    public Module()
    {
        _viewModel = new ModulePageViewModel();

        InitializeComponent();
        BindingContext = _viewModel;

        var subscriber = new ModuleSubscription();
        WatchForViewModelUpdates(subscriber);
    }

    private void WatchForViewModelUpdates(ModuleSubscription subscriber)
    {
        MessagingCenter.Subscribe<MainMenu, ModulePageViewModel>(subscriber, "CurrentModuleMessage", (s, e) =>
        {
            subscriber.CurrentModule = e;
            _viewModel.Title = e.Title;
            _viewModel.Description = e.Description;
            _viewModel.Segments = FetchSegmentListAsync(e.Id).Result;
            BuildSegmentCards();
        });
    }

    private static Task<IList<SegmentViewModel>> FetchSegmentListAsync(Guid id)
    {
        var segmentService = App.Container.Resolve<ISegmentService>();
        return Task.Run(() => segmentService.FindByModuleId(id));
    }


    private void BuildSegmentCards()
    {
        var grid = ((Grid)SegmentGrid);
        grid.RowDefinitions.Clear();

        for (var i = 0; i < _viewModel.Segments.Count; i++)
        {
            var column = i % 2;
            var row = i / 2; // ints round up (1.5 rounds to 2)
            if (row % 2 != 0)
            {
                grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
            }

            grid.Children.Add(BuildFrame(_viewModel.Segments[i]), column, row);
        }
    }

    private Frame BuildFrame(SegmentViewModel value)
    {
        var palleteFrame = new Frame
        {
            BackgroundColor = Color.White,
            Padding = 12,
            Content = CreateStack(value),
            HasShadow = false,
            VerticalOptions = LayoutOptions.FillAndExpand
        };

        return palleteFrame;
    }

    private StackLayout CreateStack(SegmentViewModel value)
    {
        var stack = new StackLayout
        {
            Spacing = 3,
            Orientation = StackOrientation.Vertical,
            VerticalOptions = LayoutOptions.FillAndExpand,
            Children =
            {
                new Label {Text = value.Number.ToString(), BackgroundColor = Color.White, TextColor = Color.Aqua.WithLuminosity(0.3f)},
                new Label {Text = value.Title, BackgroundColor = Color.White, TextColor = Color.Aqua.WithLuminosity(0.3f)},
            },
        };

        return stack;
    }

The problem I'm getting is the error

NaN is not a valid value for height

How can I fix this?


06-16 14:32:55.651 E/SQLiteLog( 4732): (1) statement aborts at 2: [ROLLBACK] cannot rollback - no transaction is active
06-16 14:32:55.651 E/mono    ( 4732):
06-16 14:32:55.651 E/mono    ( 4732): Unhandled Exception:
06-16 14:32:55.651 E/mono    ( 4732): System.ArgumentException: NaN is not a valid value for height
06-16 14:32:55.651 E/mono    ( 4732):   at Xamarin.Forms.Size..ctor (Double width, Double height) [0x00000] in <filename unknown>:0
06-16 14:32:55.651 E/mono    ( 4732):   at Xamarin.Forms.StackLayout.SumOfSizeRequests (Double widthConstraint, Double heightConstraint, System.Int32& numOfExpanders) [0x00000] in <filename unknown>:0
06-16 14:32:55.651 E/mono    ( 4732):   at Xamarin.Forms.StackLayout.OnSizeRequest (Double widthConstraint, Double heightConstraint) [0x00000] in <filename unknown>:0
06-16 14:32:55.651 E/mono    ( 4732):   at Xamarin.Forms.VisualElement.GetSizeRequest (Double widthConstraint, Double heightConstraint) [0x00000] in <filename unknown>:0
06-16 14:32:55.651 E/mono    ( 4732):   at Xamarin.Forms.Layout.GetSizeRequest (Double widthConstraint, Double heightConstraint) [0x00000] in <filename unknown>:0
06-16 14:32:55.651 E/mono    ( 4732):   at Xamarin.Forms.ScrollView.LayoutChildren (Double x, Double y, Double width, Double height) [0x00000] in <filename unknown>:0
06-16 14:32:55.651 E/mono    ( 4732):   at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00000] in <filename unknown>:0
06-16 14:32:55.651 E/mono    ( 4732):   at Xamarin.Forms.Layout.OnSizeAllocated (Double width, Double height) [0x0
06-16 14:32:55.651 E/mono-rt ( 4732): [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: NaN is not a valid value for height
06-16 14:32:55.651 E/mono-rt ( 4732):   at Xamarin.Forms.Size..ctor (Double width, Double height) [0x00000] in <filename unknown>:0
06-16 14:32:55.651 E/mono-rt ( 4732):   at Xamarin.Forms.StackLayout.SumOfSizeRequests (Double widthConstraint, Double heightConstraint, System.Int32& numOfExpanders) [0x00000] in <filename unknown>:0
06-16 14:32:55.651 E/mono-rt ( 4732):   at Xamarin.Forms.StackLayout.OnSizeRequest (Double widthConstraint, Double heightConstraint) [0x00000] in <filename unknown>:0
06-16 14:32:55.651 E/mono-rt ( 4732):   at Xamarin.Forms.VisualElement.GetSizeRequest (Double widthConstraint, Double heightConstraint) [0x00000] in <filename unknown>:0
06-16 14:32:55.651 E/mono-rt ( 4732):   at Xamarin.Forms.Layout.GetSizeRequest (Double widthConstraint, Double heightConstraint) [0x00000] in <filename unknown>:0
06-16 14:32:55.651 E/mono-rt ( 4732):   at Xamarin.Forms.ScrollView.LayoutChildren (Double x, Double y, Double width, Double height) [0x00000] in <filename unknown>:0
06-16 14:32:55.651 E/mono-rt ( 4732):   at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00000] in <filename unknown>:0
06-16 14:32:55.651 E/mono-rt ( 4732):   at Xamarin.Forms.Layout.OnSizeAllocated (Double width, Double

how to attach custom Keyboard.Telephone to Entry in UIView itself as it appear in Nymgo app

xamarin feed rss

$
0
0

How can I work with feeds, some tutorial, course or video for example?

Java.Lang.NoSuchMethodError

$
0
0

Java.Lang.NoSuchMethodError: no static method "Landroid/text/Html;.fromHtml(Ljava/lang/String;I)Landroid/text/Spanned;"

I'm getting this error on Android 6 and older. On Android 7 it works.
This is happening on a Label Renderer for Android, running this command:

Html.FromHtml(myText, FromHtmlOptions.ModeCompact)

I'm using the Xamarin.Forms version 2.3.3.180, Xamarin.Android 7.0.2.42 and Xamarin 4.2.2.11

Any ideas?

Is there a way to handle opacity differently at some point?

$
0
0

I am using the skiasharp library to create an image editor in xamarin forms.

Is there a way to handle opacity differently at some part?

For example, you can divide the area of the background canvas, one of which looks like the original image and the other looks opaque. Is this possible?

ex

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.

Size Doesn't get applied to custom controls

$
0
0

I have a custom rendered view in android which is bound to some data in runtime, the problem is that when I use it without bounding the size gets calculated correctly, but when I create and bound the control in runtime after the form is initialized (with relative layout constraints) it always defaults to minimum size unless I set the exact size in pixels which I don't want to do, have anyone encountered such a problem before?

How can I use RecycleElement with Custom Renderers in a ListView?

$
0
0

I have followed this guide to make a custom cell and a custom renderer. The custom cell displays properly, and everything works as expected until I try to add in

        <x:Arguments>
          <ListViewCachingStrategy>RecycleElement</ListViewCachingStrategy>
        </x:Arguments>

Then I get a System.InvalidCastException: Specified cast is not valid. Stack trace as follows:

>   0x24 in Xamarin.Forms.Platform.Android.ListViewAdapter.HandleItemClick at C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\Renderers\ListViewAdapter.cs:372,5 C#
    0x34 in Xamarin.Forms.Platform.Android.CellAdapter.OnItemClick at C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\CellAdapter.cs:142,5   C#
    0x20 in Android.Widget.AdapterView.IOnItemClickListenerInvoker.n_OnItemClick_Landroid_widget_AdapterView_Landroid_view_View_IJ at /Users/builder/data/lanes/3819/5a02b032/source/monodroid/src/Mono.Android/platforms/android-24/src/generated/Android.Widget.AdapterView.cs:215,5  C#

I have tried to search around but I have not found any real answers. Since I followed the guide and the sample code, I really don't understand the problem. All of my data is bound, so I thought everything would just work automatically. When I use a non-custom cell and renderer, I can recycle just fine. I will post the other relevant files:

HandbookViewCell.cs (this is my custom cell, in the Forms PCL)

using Xamarin.Forms;

namespace MyApp.Pages.Routines.CustomCells
{
    public class HandbookViewCell : ViewCell
    {
        public static readonly BindableProperty TitleProperty =
            BindableProperty.Create("Title", typeof(string), typeof(HandbookViewCell), "");

        public string Title
        {
            get { return (string)GetValue(TitleProperty); }
            set { SetValue(TitleProperty, value); }
        }
    }
}

HandbooksPage.xaml (the page with the custom cell)

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MyApp.Pages.Routines.HandbooksPage"
             xmlns:statics="clr-namespace:MyApp.Statics;assembly=MyApp"
             xmlns:cells="clr-namespace:MyApp.Pages.Routines.CustomCells;assembly=MyApp"
             Icon="hamburger.png">
  <ContentPage.Content>
    <StackLayout VerticalOptions="FillAndExpand"
                 HorizontalOptions="FillAndExpand"
                 Orientation="Vertical"
                 Spacing="0">
      <ListView ItemsSource="{Binding HandbookInfo}"
                x:Name="HandbooksView"
                ItemSelected="HandbookClicked">
        <x:Arguments>
          <ListViewCachingStrategy>RecycleElement</ListViewCachingStrategy>
        </x:Arguments>
        <ListView.ItemTemplate>
          <DataTemplate>
            <cells:HandbookViewCell Title="{Binding DocumentTitle}" />
          </DataTemplate>
        </ListView.ItemTemplate>
      </ListView>
    </StackLayout>
  </ContentPage.Content>
</ContentPage>

HandbooksPage.xaml.cs

using MyApp.ViewModels;
using System;

using Xamarin.Forms;

namespace MyApp.Pages.Routines
{
    public partial class HandbooksPage : ContentPage
    {
        private HandbooksViewModel _viewModel;
        private bool _fromCompany;
        private string _projCompName;

        public HandbooksPage(Guid? projectId, string name, bool fromCompany)
        {
            InitializeComponent();
            _projCompName = name;
            Title = _projCompName;
            _fromCompany = fromCompany;
            _viewModel = new HandbooksViewModel(projectId);
            _viewModel.RetrieveHandbookRoutinesList();
            BindingContext = _viewModel;
        }

        async void HandbookClicked(object sender, SelectedItemChangedEventArgs e)
        {
            //since this is also called when an item is deselected, return if set to null
            if (e.SelectedItem == null)
                return;

            var selectedHandbook = (HandbookInfo)e.SelectedItem;
            var docId = selectedHandbook.DocumentId;
            var topLevelRoutinesPage = new TopLevelRoutinesPage(docId, _fromCompany, _projCompName);
            await Navigation.PushAsync(topLevelRoutinesPage);

            //take away selected background
            ((ListView)sender).SelectedItem = null;
        }
    }
}

HandbookAndroidCellRenderer.cs (the renderer in the android project)

using Android.App;
using Android.Content;
using Android.Graphics;
using Android.Support.V7.Widget;
using Android.Views;
using Android.Widget;
using MyApp.Droid.Renderers;
using MyApp.Pages.Routines.CustomCells;
using MyApp.Statics;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;

[assembly: ExportRenderer(typeof(HandbookViewCell), typeof(HandbookAndroidCellRenderer))]
namespace HolteApp.Droid.Renderers
{
    class HandbookAndroidCellRenderer : ViewCellRenderer
    {
        protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, ViewGroup parent, Context context)
        {
            var x = (HandbookViewCell)item;

            var view = convertView;

            if (view == null)
            {
                // no view to re-use, create new
                view = (context as Activity).LayoutInflater.Inflate(Resource.Layout.handbook_cell, null);
            }

            var drawable = AppCompatDrawableManager.Get().GetDrawable(context, Resource.Drawable.circle_drawable);

            Android.Graphics.Color color = Palette.Secondary.ToAndroid();
            drawable.SetColorFilter(color, PorterDuff.Mode.SrcAtop);
            view.FindViewById<FrameLayout>(Resource.Id.hb_icon_frame).Background = drawable;

            view.FindViewById<TextView>(Resource.Id.hb_text).Text = x.Title;

            return view;
        }
    }
}

And the xml of the actually cell isn't important. Is there any reason why this exception should occur?

I did attempt to use the answer here but I still had the same problem.


Xamarin.Firebase Not Compatible With Forms?

$
0
0

Trying to install Xamarin.Android and it appears that yet again Forms is restricting package dependencies:

Attempting to gather dependency information for package 'Xamarin.Firebase.Messaging.32.961.0' with respect to project 'IntelliDrive.Droid', targeting 'MonoAndroid,Version=v6.0'
Attempting to resolve dependencies for package 'Xamarin.Firebase.Messaging.32.961.0' with DependencyBehavior 'Lowest'
Unable to find a version of 'Xamarin.GooglePlayServices.Basement' that is compatible with 'Xamarin.Firebase.Common 32.961.0 constraint: Xamarin.GooglePlayServices.Basement (= 32.961.0)', 'Xamarin.Firebase.Iid 32.961.0 constraint: Xamarin.GooglePlayServices.Basement (= 32.961.0)', 'Xamarin.Firebase.Messaging 32.961.0 constraint: Xamarin.GooglePlayServices.Basement (= 32.961.0)', 'Xamarin.GooglePlayServices.Base 29.0.0.1 constraint: Xamarin.GooglePlayServices.Basement (= 29.0.0.1)', 'Xamarin.GooglePlayServices.Gcm 29.0.0.1 constraint: Xamarin.GooglePlayServices.Basement (= 29.0.0.1)', 'Xamarin.GooglePlayServices.Iid 32.961.0 constraint: Xamarin.GooglePlayServices.Basement (= 32.961.0)', 'Xamarin.GooglePlayServices.Maps 29.0.0.1 constraint: Xamarin.GooglePlayServices.Basement (= 29.0.0.1)', 'Xamarin.GooglePlayServices.Measurement 29.0.0.1 constraint: Xamarin.GooglePlayServices.Basement (= 29.0.0.1)', 'Xamarin.GooglePlayServices.Tasks 32.961.0 constraint: Xamarin.GooglePlayServices.Basement (= 32.961.0)'.

It requires a higher version of GooglePlayServices.Basement which can't be upgraded due to what Xamarin.Forms requires. Has anyone else managed to get Firebase working with XF? Or any word when there will be an update to it so we can work with newer technologies?

Xamarin.Forms.UWP crash in OnLaunched() Native Toolchain ON

$
0
0

When build-setting "Compile with .NET Native tool chain" is ON, I get the following exceptions in Xamarin.Forms.Forms.Init(e); in OnLaunched():

Exception thrown: 'System.IO.FileNotFoundException' in System.Private.Reflection.Core.dll
Additional information: Cannot load assembly 'ClrCompression'. No metadata found for this assembly.

Exception thrown: 'System.IO.FileNotFoundException' in System.Private.Reflection.Core.dll
Additional information: Cannot load assembly 'sqlite3'. No metadata found for this assembly.

Exception thrown: 'System.IO.FileNotFoundException' in System.Private.Reflection.Core.dll
Additional information: Cannot load assembly 'ucrtbased'. No metadata found for this assembly.

I can just continue and the app seems to run fine, but when the app is installed from AppStore, it just crashes.

Any ideas?

Tom

Tool Bar Item in Center

$
0
0

how can i title will be set center align in toolbar ? I am using cross Platform

<ContentPage.ToolbarItems>


</ContentPage.ToolbarItems>

Binding a value to a property of a markup extension

$
0
0

I have a working markup extension (deriving from IMarkupExtension).
The extension has a string property named "MyText".
It works great to use it like this

However, now, I want 'some text' to be bound from my BindingContext.
I have tried things like:

The bindingcontext works fine however, since this works:

Please Point me in the right direction :)
Regards Andreas

'Resource.Styleable' does not contain a definition

$
0
0

I am getting error when i Installed Xlab 2.0.5782 in Xamarin.android.I got many error like this.
Please give solution for this. i got this type of error many times.when i uninstall Xlabs then all error Solved but i can not integrate with my project.

  `  2>,164): error CS0117: 'Resource.Styleable' does not contain a definition for 'Theme_textColorAlertDialogListItem'
    2>E:\Pranav\xamarin\XamainKcsControl\XamainKcsControl\XamainKcsControl.Droid\Resources\Resource.Designer.cs(1552,120,1552
    2>,144): error CS0117: 'Resource.Styleable' does not contain a definition for 'Theme_textColorSearchUrl'
    2>E:\Pranav\xamarin\XamainKcsControl\XamainKcsControl\XamainKcsControl.Droid\Resources\Resource.Designer.cs(1553,130,1553
    2>,164): error CS0117: 'Resource.Styleable' does not contain a definition for 'Theme_toolbarNavigationButtonStyle'
    2>E:\Pranav\xamarin\XamainKcsControl\XamainKcsControl\XamainKcsControl.Droid\Resources\Resource.Designer.cs(1554,114,1554
    2>,132): error CS0117: 'Resource.Styleable' does not contain a definition for 'Theme_toolbarStyle'
    2>E:\Pranav\xamarin\XamainKcsControl\XamainKcsControl\XamainKcsControl.Droid\Resources\Resource.Designer.cs(1555,117,1555
    2>,138): error CS0117: 'Resource.Styleable' does not contain a definition for 'Theme_windowActionBar'
    2>E:\Pranav\xamarin\XamainKcsControl\XamainKcsControl\XamainKcsControl.Droid\Resources\Resource.Designer.cs(1556,124,1556
    2>,152): error CS0117: 'Resource.Styleable' does not contain a definition for 'Theme_windowActionBarOverlay'
    2>E:\Pranav\xamarin\XamainKcsControl\XamainKcsControl\XamainKcsControl.Droid\Resources\Resource.Designer.cs(1557,125,1557
    2>,154): error CS0117: 'Resource.Styleable' does not contain a definition for 'Theme_windowActionModeOverlay'
    2>E:\Pranav\xamarin\XamainKcsControl\XamainKcsControl\XamainKcsControl.Droid\Resources\Resource.Designer.cs(1558,124,1558
    2>,152): error CS0117: 'Resource.Styleable' does not contain a definition for 'Theme_windowFixedHeightMajor'
    2>E:\Pranav\xamarin\XamainKcsControl\XamainKcsControl\XamainKcsControl.Droid\Resources\Resource.Designer.cs(1559,124,1559
    2>,152): error CS0117: 'Resource.Styleable' does not contain a definition for 'Theme_windowFixedHeightMinor'
    2>E:\Pranav\xamarin\XamainKcsControl\XamainKcsControl\XamainKcsControl.Droid\Resources\Resource.Designer.cs(1560,123,1560
    2>,150): error CS0117: 'Resource.Styleable' does not contain a definition for 'Theme_windowFixedWidthMajor'
    2>E:\Pranav\xamarin\XamainKcsControl\XamainKcsControl\XamainKcsControl.Droid\Resources\Resource.Designer.cs(1561,123,1561
    2>,150): error CS0117: 'Resource.Styleable' does not contain a definition for 'Theme_windowFixedWidthMinor'
    2>E:\Pranav\xamarin\XamainKcsControl\XamainKcsControl\XamainKcsControl.Droid\Resources\Resource.Designer.cs(1562,121,1562
    2>,146): error CS0117: 'Resource.Styleable' does not contain a definition for 'Theme_windowMinWidthMajor'
    2>E:\Pranav\xamarin\XamainKcsControl\XamainKcsControl\XamainKcsControl.Droid\Resources\Resource.Designer.cs(1563,121,1563
    2>,146): error CS0117: 'Resource.Styleable' does not contain a definition for 'Theme_windowMinWidthMinor'
    2>E:\Pranav\xamarin\XamainKcsControl\XamainKcsControl\XamainKcsControl.Droid\Resources\Resource.Designer.cs(1564,115,1564
    2>,134): error CS0117: 'Resource.Styleable' does not contain a definition for 'Theme_windowNoTitle' `

Upload image to server

$
0
0

I need upload image to server using api. Now I'm using System.Net.Http;

        byte[] lFileBytes= DependencyService.Get<IFileHelper>().ReadAllBytes(ImagePath);
        ByteArrayContent lFileContent = new ByteArrayContent(lFileBytes,0,lFileBytes.Length);
        lFileContent.Headers.ContentDisposition = ContentDispositionHeaderValue.Parse("form-data");
        lFileContent.Headers.ContentType=new MediaTypeHeaderValue("image/jpg");
        lFileContent.Headers.ContentDisposition.Parameters.Add(new NameValueHeaderValue("name", "file"));
        lFileContent.Headers.ContentDisposition.Parameters.Add(new NameValueHeaderValue("filename", "9.jpg"));
        lFileContent.Headers.ContentLength= lFileBytes.Length;
        lContent.Add(lFileContent);

    public byte[] ReadAllBytes(string path) {
                using (var streamReader = new StreamReader(path))
                {
                    using (var memoryStream = new MemoryStream())
                    {
                        streamReader.BaseStream.CopyTo(memoryStream);
                        return memoryStream.ToArray();
                    }
                }
            }

After sending request i have error "Type file is invalid". I'm thinking problem in "byte[] ReadAllBytes(string path)" For request i can use Stream or byte[] Please, help

Push a page and wait until it is poped

$
0
0

Hi,

I would like to achieve something like the following:

while (true)
{
    try
    {
        getData();
        return;
    }
    catch (NotLoggedInException e)
    {
        await PushAsync(new LoginPage());
    }
}

If within the getData() method a NotLoggedInException is thrown, catch it, show the user the LoginPage, but wait until the Login is completed.
But somehow the await doesn't stop the code from execution, as it shows the LoginPage but continues with the while loop which results in being again in the catch clause pushing the next LoginPage...

Cheers


Custom renderer for Master-Detail - add an icon on top right corner

$
0
0

I'm trying to modify the default appearance of master-detail Xamarin Forms page and add a small icon on the top right corner of the title.
Can someone post examples of custom renderers that add visual elements to the page (for both iOS and Android)?
Most of the examples I've seen only modify existing elements that are already defined in the page, rather than adding new.

Thank you!

Disable bounce for ListViews and ScrollViews in iOS

$
0
0

Hello.
Is there a way to disable the bounce effect of ListViews and ScrollViews in iOS in a Forms App?

For completeness: can we do it in WebViews too?

Use an Android Intent to open a new page

$
0
0

So heres my problem:

I have an Application which sends notifications to the user , if an Entry has been created, updated or deleted. If you click onto the notification, you should directly get redirected to the given page.
Problem is: Only possible way to do an onClick on an Notification is by creating an intent.

Does anyone know how I can run Forms Code inside of an Intent?

My first approach was to run a service inside the Intent but this does not seem to work (no errors, nothing.)

Unable to make custom font work in Android like mentioned in below link.

iOS ScrollView jumps to top on layout change

$
0
0

On a XAML page I've got a ScrollViewer with many elements, so I can scroll vertically. I also have one or more elements right before the ScrollViewer, which turn visible or invisible based on certain criteria. Whenever the visibility changes the ScrollViewer jumps back to the top, but only on iOS. On UWP it remains its scroll position. Is this intended? Is there a common workaround to have the ScrollViewer remain its scroll position? Since there are more elements before the ScrollViewer I wouldn't like to register to all of them, but that's my last resort right now.

Viewing all 91519 articles
Browse latest View live


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