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

Hardware Back Button

$
0
0

I've got an app which displays a login page modally when it detects that the user has not logged in. However, the user can still dismiss the login page using the hardware back button, thus returning to the app without valid credentials which shouldn't normally happen. It's not designed to have the user attempting to do things without permission so this behaviour can be confusing. Can I somehow disable the back button on the login page?


Xamarin Forms Sliders - disable the tooltip?

$
0
0

Is there a way to easily hide/disable the tool tip on a slider control?

Xamarin.Forms Mac and Windows Desktop

$
0
0

Are there any plans to make a version of Xamarin.Forms for cross platform desktop development (Windows, Mac OSX, etc...)? That would be awesome!

Image.Source leaks memory on UWP, how to work around?

$
0
0

My app generates a bitmap on the fly as an array, and successive images generate animation. I place this in the Image element as

var memoryStream = new MemoryStream(bitmapArray);
    imageWindow.Source = ImageSource.FromStream(() => memoryStream);

This works on Android. However on UWP, memory increases on each frame and never releases even with an explicit GC request. If I comment out the display there is no problem.

How do I find out where memory is leaking, and how can I work around this?

Image not showing

$
0
0

Hey guys,

I am trying to make a very basic contentPage with just 2 buttons and an image. But no matter what I am trying, the image does not show .. Am I getting crazy or just missing something ? I made sure to include the image in both iOS and Android's Resource folders!

public class MainMenuPage : ContentPage
    {
        public MainMenuPage ()
        {
            Content = new StackLayout () {
                Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0),
                //Orientation = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children = {
                    new StackLayout(){
                        Orientation = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.FillAndExpand,

                        Children = {
                            new Button(){
                                Text = "Profile",
                                TextColor = Color.FromRgb(161,161,161),
                                BorderColor = Color.FromRgb(161,161,161),
                                BorderWidth = 1,
                                HeightRequest = 50,
                                BorderRadius = 1,
                                HorizontalOptions = LayoutOptions.FillAndExpand,
                            },
                            new Button(){
                                Text = "Skills",
                                TextColor = Color.FromRgb(161,161,161),
                                BorderColor = Color.FromRgb(161,161,161),
                                BorderWidth = 1,
                                HeightRequest = 40,
                                BorderRadius = 1,
                                HorizontalOptions = LayoutOptions.FillAndExpand,
                            },
                        },
                    },
                    new Image () {
                        IsVisible = true,
                        Aspect = Aspect.AspectFit,
                        Source = ImageSource.FromFile ("flint.png"),
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions = LayoutOptions.CenterAndExpand,
                    },
                },
            };
        }
    }

Thanks !

Themes and Merged Resource dictionaries

$
0
0

I am trying to Organize styles in Xamarin forms with merged resource dictionaries. I am able to get the dictionary on the page working.

But when I add the same merged dictionary to App.Xaml I get an System.NullReferenceException.

Is it possible to do merged dictionaries at app level instead of adding them to each page?

Custom Renderer, reset view properly?

$
0
0

I have a Custom Renderer that has an implementation on iOS, which uses SetNativeControl on an underlying UIView surface.

Once the view is finished being used, it has the last frame drawn into it by the native control I set, and I am trying to clear it out from just inside my renderer implementation:

public override void Draw(CGRect rect)
{
    base.Draw(rect);

    if (clear)
    {
        using (var context = UIGraphics.GetCurrentContext())
        {
            context.ClearRect(rect);

            UIColor.Clear.SetFill();
            context.SetAlpha(0.0f);
            context.FillRect(rect);

            UIColor.Black.SetFill();
            context.SetAlpha(0.0f);
            context.FillRect(rect);

            clear = false;
        }
    }
}

All of this succeeds- but doesn't clear the underlying surface.

I've tried instead just creating a new UIView surface underneath, and setting it as the native component again:

_videoView = new RTCEAGLVideoView();
SetNativeControl(_videoView);

This clears the surface, and I can subsequently render video with it later, however, when I rotate the device, I notice that the old Native Views are persisting underneath... Like they aren't actually being removed/destroyed or cleared...

What's the appropriate way to either clear the content of the UIView from the outside, or to replace the underlying native control?

Drag and Drop and matching rows to data model

$
0
0

I have a customized ViewCellRenderer to implement drag and drop functionality. I have discovered that ListView.IndexOfChild() is not doing quite what I thought it was doing. IndexOfChild is returning the index of the rows that are visible, and I can't find a way to use that to get the index of the data that the ViewCell is displaying.

I have 21 records bound to the ListView,

The code I'm working with follows. How do I find the index of the Xamarin.Form's ListView ViewCells?

Please help,

Vania

public class DraggableViewCellRenderer : ViewCellRenderer
{
public DraggableListView ParentListView { get; set; }
public DraggableViewCell ViewCell { get; set; }
public IList Items { get; set; }
protected override View GetCellCore(Cell item, View convertView, ViewGroup parent, Context context)
{
_context = context;
ViewCell = item as DraggableViewCell;
ParentListView = item.Parent as DraggableListView;
if (ParentListView != null)
{
Items = ParentListView.ItemsSource as IList;
}

        var cellcore = base.GetCellCore(item, convertView, parent, context);

        cellcore.Drag -= CellcoreOnDrag;
        cellcore.Drag += CellcoreOnDrag;

        return cellcore;
    }


    private void CellcoreOnDrag(object sender, View.DragEventArgs e)
    {
        try
        {
            ViewGroup = sender as ViewGroup;

            if (ViewGroup != null)
            {
                ListView = ViewGroup.Parent.Parent as Android.Widget.ListView;
            }

            switch (e.Event.Action)
            {
                case DragAction.Started:
                    e.Handled = true;
                    break;

                case DragAction.Entered:
                    e.Handled = true;

                    if (ListView != null)
                    {
                        if (FirstIndex == -1)
                        {
                            FirstIndex = ListView.IndexOfChild(ViewGroup.Parent as View);
                        }
                    }

                    break;

                case DragAction.Exited:
                    e.Handled = true;
                    break;

                case DragAction.Drop:
                    e.Handled = true;

                    if (SecondIndex == -1)
                    {
                        SecondIndex = ListView.IndexOfChild(ViewGroup.Parent as View);
                        if (SecondIndex < 0)
                            SecondIndex = 0;
                    }
                    if (FirstIndex > -1 && SecondIndex > -1)
                    {
                        var firstItem = Items[FirstIndex];

                        if (firstItem != null)
                        {
                            if (ParentListView.MoveRecord(Items[FirstIndex], Items[SecondIndex]))
                            {
                                Items.Remove(Items[FirstIndex]);
                                Items.Insert(SecondIndex, firstItem);

                                ParentListView.ItemsSource = null;
                                ParentListView.ItemsSource = Items;
                            }
                        }
                    }

                    FirstIndex = -1;
                    SecondIndex = -1;

                    break;
                case DragAction.Ended:
                    e.Handled = true;
                    break;
            }
        }
        catch (Exception ex)
        {

            throw;
        }
    }

    public Android.Widget.ListView ListView { get; set; }

    public ViewGroup ViewGroup { get; set; }

    private static int _firstIndex = -1;
    private static int _secondIndex = -1;
    private Context _context;

    public static int FirstIndex
    {
        get { return _firstIndex; }
        set { _firstIndex = value; }
    }
    public static int SecondIndex
    {
        get { return _secondIndex; }
        set { _secondIndex = value; }
    }
}

Can I overlay my own images on a Map control?

$
0
0

Right now I am using Map (Xamarin.Forms.Maps) to display a Google or Bing map. I need images fed to me from a local tilecache to be rendered on top of the map (opacity of images needs to be respected). What is my best bet here? If the map control does not support images to display on top I am thinking I might need to display them on top of the map control through some other element and manually update the tilecache requests when the map is zoomed/panned.

NSInternalInconsistencyException: Application windows are expected to have a root view controller

$
0
0

Hi,

I got the exception while opening the application in both iPhone and simulator.(using Xcode version 8.2.1), Please anyone help me. It's smashing me head now.

This is my log:

`Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3600.6.22/UIApplication.m:3680

Xamarin.iOS: Received unhandled ObjectiveC exception: NSInternalInconsistencyException Application windows are expected to have a root view controller at the end of application launch
Thread finished: #5

Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Application windows are expected to have a root view controller at the end of application launch
Native stack trace:
0 CoreFoundation 0x1e79ce0f + 154
1 libobjc.A.dylib 0x1d9ff077 objc_exception_throw + 38
2 CoreFoundation 0x1e79ccd1 + 0
3 Foundation 0x1f097931 + 92
4 UIKit 0x23accb63 + 3468
5 UIKit 0x23adf171 + 40
6 UIKit 0x23ac986d + 146
7 FrontBoardServices 0x200929b3 + 18
8 FrontBoardServices 0x2009286d + 220
9 FrontBoardServices 0x20092b57 + 44
10 CoreFoundation 0x1e75871b + 12
11 CoreFoundation 0x1e758225 + 438
12 CoreFoundation 0x1e7564fb + 762
13 CoreFoundation 0x1e6a5533 CFRunLoopRunSpecific + 486
14 CoreFoundation 0x1e6a5341 CFRunLoopRunInMode + 104
15 UIKit 0x238b3f01 + 728
16 UIKit 0x238ae591 UIApplicationMain + 150
17 MYPROJECT.iOS 0x005a8f6c wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 272
18 MYPROJECT.iOS 0x0050a234 UIKit_UIApplication_Main_string___intptr_intptr + 52
19 MYPROJECT.iOS 0x0050a1f4 UIKit_UIApplication_Main_string___string_string + 204
20 MYPROJECT.iOS 0x001916b4 INTRANSIT_iOS_Application_Main_string__ + 228
21 MYPROJECT.iOS 0x0086b010 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 256
22 MYPROJECT.iOS 0x000d24b3 mono_jit_runtime_invoke + 1650
23 MYPROJECT.iOS 0x0011acdd do_runtime_invoke + 78
24 MYPROJECT.iOS 0x0011c4f5 mono_runtime_exec_main + 608
25 MYPROJECT.iOS 0x0011c1e3 mono_runtime_run_main + 630
26 MYPROJECT.iOS 0x000c0e7f mono_jit_exec + 162
27 MYPROJECT.iOS 0x00190984 xamarin_main + 2508
28 MYPROJECT.iOS 0x01ae9533 main + 112
29 libdyld.dylib 0x1de6f50b + 2

`

How to use Editor inside a UITableViewCell

$
0
0

Hi - Am new to Xamarin and am using Xamarin forms to build a cross platform app. I'm trying to find out how to use a Editor (Text area) inside a Table View cell. I tried to google, but could not find out any solution. Can you pls help me with the code snippet for the same.

I thought I can create a custom renderer for an EntryCell, and try to customize height and enable multi line, but am not able to find out the properties to use, to maniupulate height and multi line.

If there is any other good way, pls let me know. Thanks always!!

Force upgrading the app, reducing launch delay

$
0
0

Hi,

In order to force upgrade the user I am checking latest version on server with existing app version on launch. In Forms shared code below is the place where exactly I am checking with server.

public App(){
}

Due to this check, my app is taking 7 seconds to show the home page from splash screen. Earlier it used to take 2 to 3 seconds. I can't use Async, Await for this since if latest version available I should redirect the user to upgrade alert page, before showing any other page. I need some suggestion to reduce this delay.

Button with an image, how to centre the image horizontally?

$
0
0

Hi guys,
Trying to get a little button with an image, I want the image to be centred within the button but it is always to the left.

        Button button = new Button();
        {
            //WidthRequest = 50
            BorderWidth = 0.5,
            BorderColor = Color.Gray,
            HorizontalOptions = LayoutOptions.Center,
            VerticalOptions = LayoutOptions.CenterAndExpand
        };
        button = (FileImageSource) ImageSource.FromFile("Images/image1.png");

Also strangely enough, the image is displaying in blue. The image is mostly gray...

Amazon Web Services vs Azure?

$
0
0

I would like to have following features for my app.

  • Offline snyc
  • Push notifications
  • Login with facebook, twitter, gmail etc.

I was evaluating AWS and Azure. what is the easiest to implement? what is the most economic one? AWS looks confusing. There are so many DB types. I couldnt understand which one is the best to use between SimpleDB, DynamoDB, Amazon Simple Storage Service (S3) etc.
Azure looks clear. I made some test project and it was quite easy to implement but It is more expensive than AWS looks like.

Can somebody shed me some lights if he has experiences or understanding on this?

Binding to Picker Items

$
0
0

Hi,

I believe it is not possible to Bind in XAML to the Items property of the Picker control.

If this is the case, which is the best approach to populate the Items collection from a ViewModel collection?

I believe it is possible to call the Add method against the Items collection however how might I reference the Picker, as defined in the XAML, in the code behind?

I have tried FindByName however I don't seem to be able to set the Name of the Picker control.

Thanks

Paul Diston


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 Estimated Release
2.3.3-next February 2017
2.3.4 Q1 2017
2.4.0 Q2 2017
2.5.0 Q3 2017

2.3.3-next Feb 2017

Update to Android API Dependency - Feature
When targeting framework 7.0 or above, Android API 23 or greater may now be used with Xamarin.Forms. Lower than 7.0 will remain capped at API 23. This does not guarantee compatibility, but removes the constraint to allow developers to use libraries dependent on newer Android APIs.

2.3.4 - Est Q1 2017

Performance


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

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

Features


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

  • ItemSource
  • SelectedItem

OnIdiom Support for Desktop (UWP) - Enhancement
PR
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 Idiom for UWP developers.

2.4.0 - Est Q2 2017

Performance


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.

Fast Renderers - Performance
Label and Image controls.

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

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

Features


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

CarouselView v1 Stable - Feature
Stability and performance improvements.

CSS with FlexBox Support - Feature, Enhancement
Review the Evolution Proposal.

Popover Control - Feature
A transient view that appears over other content, can anchor to existing UI elements, and resize.

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

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

Other

Deprecation of iOS 6

Deprecation of WP8

2.5.0 - Est Q3 2017

Performance


Bulk renderer creation - Performance
Optimize rendering performance on Android with bulk operations.

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

Fast Renderers - Performance
Optimize view renderers to streamline view creation and improve performance. Complete all other UI controls.

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

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

Features


G18n support - Enhancement
Globalization support enhancements including RTL.

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

Popover Control - Enhancement
Add nested navigation support

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

Open Source Contributions

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

[Edited 2/10/2017]

Getting CPU & Memory Usage in source code?

$
0
0

Hi,
Recently I installed Visual Studio 2013 Professional and Xamarin.Forms for Visual Studio. I wanted to create a mobile app with it, so I created a new project (Cross-platform PCL project). In this project I want to get the CPU and Memory Usage to control the number of working threads. In .NET I just can simply using PerformanceCounter class to get these information.
Is is posible to get these information in Xamarin.Forms (both of Android and iOS)?
Thank you for reading!

How to animate 'data loading' feature in Entry/Label ?

Multiple errors trying to create "Blank App (Xamarin.Forms Shared)" in Visual Studio.

$
0
0

Multiple Errors in visual studio 2015 community.

Missing Namespaces and more. see attached Pics

Httpclient putasync: Error in IOS depending of request length

$
0
0

Hi everyone,

I have a problem.
When I execute a request to webapi, depending of the request lenght, the body parameters, are null.
This problem is only for iOS, on Android works fine.

I send a object in the body like:
{
"id":"1234",
"file":"a byte array in base 64 format...."
}

When the webapi receives the request, the request body parameter is null.

WebApi Method:
[HttpPut]
[Route("people/1/update")]
public async Task UpdateProfileImage([FromUri] string personId, [FromBody]PersonModel specifications)

In this method, I receive the "specifications" parameter null depending of content length.

HttpClient code:
string serializedContent = JsonConvert.SerializeObject(data);

HttpContent contentPost = new StringContent(serializedContent, Encoding.UTF8, "application/json");
return await client.PutAsync(apiOperation.RequestUri, contentPost).ConfigureAwait(false);

¿Anyone has the same error?

Thanks

Viewing all 91519 articles
Browse latest View live


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