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

is there a Tabbed view in Xamarin.forms?

$
0
0

Hello,
any idea how to make a Tabbed view in xamarin.forms,
i only found Tabbed page which is not possible to put it inside a content page!

choosing Xamarin.forms is bad choice? should i've used each platforme beside with xamarin.android and xamarin.ios!

Thanks in advance


Can not add Xamarin.Essentials.

$
0
0

Hi

When i try to add Xamarin.Essentials package to Xamarin.Android project i am getting following error. Can any one tell me how can i resolve this error.

Error:
Severity Code Description Project File Line Suppression State
Error NU1107 Version conflict detected for Xamarin.Android.Support.Compat. Reference the package directly from the project to resolve this issue.
MyProject.Android -> MyProject -> Xamarin.Essentials 1.0.0 -> Xamarin.Android.Support.Core.Utils 26.1.0.1 -> Xamarin.Android.Support.Compat (= 26.1.0.1)
MyProject.Android -> Xamarin.Android.Support.CustomTabs 25.4.0.2 -> Xamarin.Android.Support.Compat (= 25.4.0.2).

Thanks.

Recording - Twitch Workshop: Build Your First Mobile App with C#, Xamarin, and the Cloud

$
0
0

Hi,

I was hoping someone has a recording of the "Twitch Workshop: Build Your First Mobile App with C#, Xamarin, and the Cloud" from blog.xamarin.com?
It was hosted by Jame Montemagno.

Kind Regards

Custom Stepper with 2 buttons and Entry

$
0
0

Hi ,
I used stepper but since i couldn't change it's seize now I have to replace it by 2 buttons .

Is there any sample like that ? working just like stepper ?

PCL Assembly compression and combining it in few set of single assemblies.

$
0
0

Hi,

I have a project under development, which is using few plug-ins as well.
The thing bothering to me is there are 114 (so far) dll files which gets packed in resulting APK.

I want to merge (with or without ILMerge tool) and compress these dlls in few groups, like systm.x???.dll into system.merged.dll and like wise.

Has anyone tried it? my main motto is to reduce the APK size and at the same time remove clutter from application packaging,
All thoughts - sample (build) scripts are welcome.

Thanks
N Baua

I need to Implement a Search option for Dropdown...How to do

$
0
0

When i Select an item in dropdown1. it need to search for similar items (similar text) in the table and need to bind that items to Dropdown2

How to implement this..
if any please help
im Struct in this

Thanks in advance

System.InvalidCastException: Specified cast is not valid, caused by casting Master Detail Page

$
0
0

Hi,

I just developed the application which has button that can redirect within the same Master Detail Page, but still retain the hamburger button. In this case I used the code as followed:

((HamburgerMenu)Parent).Detail = new NavigationPage(new MyNextPage());

Then, when I tested on Android Emulator, this happened:

System.InvalidCastException: Specified cast is not valid.

I'm not sure what is caused the problem because when I used StackLayout, it never caused this problem. If you have any solution, don't hesitate to reply this thread, I can't be more welcome.

Thanks!

Map changes

$
0
0

1. Don't move Map by default to Rome

Current Map implementation moves map to Rome by default (albeit Rome, Italy is a cool city), but many times you want to move it to a different and specific position.
Which means the control will be updated twice instead of just once, wasting draw cycles.
Making the control not go to the default location requires some work and investigation which is completely unnecessary.
I don't understand the decision to have a default location.

2. Add 'animate' parameter to MoveToRegion(MapSpan mapSpan)

On all platforms the native map control has a way to animate when moving the map position. All current renderers in Xamarin Forms already use an animation value when moving the position on the native map.
The Xamarin.Forms.Map control should have the bool animate parameter in the MoveToRegion(MapSpan mapSpan):

void MoveToRegion(MapSpan mapSpan, bool animate = true)


Firebase messaging token "NotRegistered"

$
0
0

I recently implemented my own push service, because we had some special needs. The ID Service for this is a near copy paste from the original docs and looks like this:
`const string TAG = "MyFirebaseIIDService";
public override void OnTokenRefresh()
{
var refreshedToken = FirebaseInstanceId.Instance.Token;
Debug.WriteLine("Refreshed token: " + refreshedToken);
SendRegistrationToServer(refreshedToken);
}

    void SendRegistrationToServer(string token)
    {
        var context = global::Android.App.Application.Context;
        var prefs = context.GetSharedPreferences(context.PackageName, FileCreationMode.Private);

        var edit = prefs.Edit();
        edit.PutString("registrationId", token);
        edit.Commit();

        // Add custom implementation, as needed.
    }`

But i see 2 Behaviours here:

  • Android 8.0 and higher: All works fine and my token is useable across multible sessions.
  • Android 7 and lower(having a 6.0.1 test device): I Start a debug build with the app not installed on the device. i get my token and all works like expected.
    But if i start the app again (via visual studio or manual doesnt matter) i do not get a new token(wich is fine, if there wassnt the following part), but if i send my remove message again the firebase service answeres with "NotRegistered" and the notification doesnt get delivered.
    If i use a release Build it all works fine even if i restart the phone. I would guess its due too some fact cause its a Debug build, but i have no clue where the problem lies.

Had anyone a problem like this in the past and may has some Information how i could fix this? (
This is for now not a huge Problem, but its present and makes debugging stuff with included Pushnotifications harder and costs a lot of time(and then money)).

Listview item selected is not working for 2nd time selection

$
0
0

I had a listview with n list items. I had selected list item "a" and able to access data related to that item and once I come back to the list and attempted to select item "a" again which does nothing. It is working only If I select item "a" then "b" and then back to "a". Is there a way to do repetitive selection of same item in xamarin forms?

Linking C# to additional Objective C header file.

$
0
0

Hi guys, I have created a UI on Mac OS recently (Not phone Apps), and I am trying to link it to an additional Objective C code.
The source of this approach is really limited as all I found was about phone apps development. Hence I am trying to verify whether my concept is do-able or not. My Approach is as below :

My solution consist of Objective C and C#, which is linked internally when I created a new solution. These are done in the background by developers of these templates, where C# is the main sequence of the whole User Interface operations. Now I have created an Objective C file (externally), with all the functions to be called in its header file. I would love to link my UI (C# and Objective-C) to this Objective C file, the similar way developers used to link C# to Objective C.

This is the only link related to the subject that I am looking for, unfortunately it is mainly about phone Apps development.
https://docs.microsoft.com/en-us/xamarin/ios/platform/binding-objective-c/index

Below are small parts of my code /:

UI code:

MainViewController.designer.cs (Visual Studio for Mac)

using Foundation;
using System.CodeDom.Compiler;

namespace Main
{
    [Register ("MainViewController")]
    partial class MainViewController
    {
        [Outlet]
        AppKit.NSButton btnConnect { get; set; }

        [Action ("btnSubWindow:")]
        partial void BtnPopOut (AppKit.NSButton sender);
    }

    void ReleaseDesignerOutlets ()
        {
            if (btnConnect != null) {
                btnConnect.Dispose ();
                btnConnect = null;
            }
        }
}

MainViewController.m (Xcode)

#import "TestLauncherViewController.h"

@implementation TestLauncherViewController

@synthesize btnConnect = _btnConnect;
- (IBAction)btnSubWindow:(NSButton *)sender {
}

@end

MainViewController.h (Xcode)

#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>


@interface TestLauncherViewController : NSViewController {
    NSButton *_btnConnect;
@property (nonatomic, retain) IBOutlet NSButton *btnConnect;
- (IBAction)btnSubWindow:(NSButton *)sender;

@end

From here, we know that Objective-C has been linked to C#, and ready to be altered from C#.

Below are part of my externally created Objective C file:

Addition.h

@interface Addition : NSObject{
    int     progress;
    Status  state;
}
-(instancetype)initWithIP:(char*)ipaddress andUIdelegate:(id)del;
-(void)startToRun;
-(int)Multiplication;
@end

I am trying to use C# to access this Objective C header file to search for the entry point of any functions that I wish to call.
Please tell me if my concept is doable or not.

If do-doable :
Please provide me some guidance to achieve this approach.
Thank you in advance.

Azure SQL and API app not working."This [app name].azurewebsites.net page can’t be found"

$
0
0

the problem is that when publishing API from visual studio to azure, and trying to deploy the website, google cant find the page

I have set up my MySQL and API app in azure. And when creating a new project (web api) in xamarin forms and publishing my API app, everything seems to work, untill i try to open https://[app name].azurewebsites.net/

I have followed these steps, but cant figure out what the source of the problem is:
https://azuremobilehelp.com/creating-api-azure/
https://azuremobilehelp.com/creating-sql-azure-database/

Background color of "ActionBar"/"Toolbar v7" with FormsAppCompatActivity

$
0
0

Hi there,

I finally figured out I should migrate from FormsApplicationActivity to FormsAppCompatActivity. After doing that and adapting a few configuration options here and there, my theme is now as follows:

  <style name="CustomTheme" parent="CustomTheme.Base">
  </style>

  <style name="CustomTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
    <!-- We will be using the toolbar so no need to show ActionBar -->
    <item name="windowActionBar">false</item>

    <!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette-->
    <!-- colorPrimary is used for the default action bar background -->
    <item name="colorPrimary">@color/primary</item>
    <!-- colorPrimaryDark is used for the status bar -->
    <item name="colorPrimaryDark">@color/primary_dark</item>
    <!-- colorAccent is used as the default value for colorControlActivated
         which is used to tint widgets -->
    <item name="colorAccent">@color/accent</item>
    <!-- You can also set colorControlNormal, colorControlActivated
         colorControlHighlight and colorSwitchThumbNormal. -->
    <!--item name="colorControlHighlight">@color/primary_light</item-->
    <!--item name="colorControlActivated">@color/primary_light</item-->
    <!--item name="colorLongPressedHighlight">@color/listitem_longpressed</item-->
  </style>

That's dumb but I don't figure out how to get back a dark actionbar:

It does not look dark at all, since it's white background with black text...

Debugging Session issues.

$
0
0

A number of versions ago I started noticing odd debugging to device behaviours, I'm wonder if someone here can shed light on my situation. I'm debugging my Xam Forms PCL project to a Sony Xperia Android device. On the device I use SQLite to store some local data for the app. In the past, no matter how many times I unplug my device and plug it back in - the SQLite data source always persisted between debugging sessions. Recently I've started noticing this data being cleared whenever I unplug and replug in the device... Its frustrating as I have to keep re-entering credentials each time. If I leave the device plugged in it does keep the sqlite details for multiple debug sessions, but once I go for a break - unplug the phone and then re-plug it in - my local data source vanishes?

Furthermore - after initial plug-in and on first debug session - it is taking the Visual Studio 2017 8 minutes....YES 8 MINUTES to start the app... Once it has started this delay shortens drastically, but once I replug it in - its again 8 minutes for the first debug session.... Wasting lots of my time....

Anyone else experienced this? Any suggestions of how to find the cause of the problem also welcomed...

E-mail apps listing on ios

$
0
0

Hello, I use
Device.OpenUri(new Uri(shareurl));
and share url is
shareurl = "mailto:" + email + "?subject=" + WebUtility.UrlEncode(subject) + "&body=" + WebUtility.UrlEncode(body);
on ios.
When user clicks to email button in Android opens a menu and shows the mail applications on the phone such as : Gmail, Yahoo, Yandex etc. but in iOS directly opens Apple's default mail application. Is there a way of listing the mail apps and then redirect to them in ios.


Xamarin Form async Function unable to await.

$
0
0

Hi guys, I am new to Xamarin form using Visual Studio and Xcode to develop a Mac OS platform software. (Not phone Apps)

In my application, I need to let user Connect to TCPIP by clicking a button to receive TCPIP message but at the same time prevent the deadlock. I managed to build my project, and it runs through the async Task. The reason of using Async is to ensure that it can listen to TCPIP connection and won't freeze the UI at the same time.
However, after it went into the Task, it never await for the message from the Network that it was listening.

Below are my code:

partial void ConnectAttempt(Foundation.NSObject sender)
{

       Task.Run(async () =>
        {
            try{
                listener = new TcpListener(localAdd, PORT_NO);
                listener.Start();                 
                TcpClient client =await listener.AcceptTcpClientAsync();
                NetworkStream nwStream = client.GetStream();
                byte[] buffer = new byte[client.ReceiveBufferSize];
                int bytesRead = nwStream.Read(buffer, 0, client.ReceiveBufferSize);
                string dataReceived = Encoding.ASCII.GetString(buffer, 0, bytesRead);
                temp = dataReceived;

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Received.StringValue = string.Format("I have received {0} .", temp);
        }
                );
        ConnectStatus.StringValue = string.Format("Listening now...");
    }

It went well when I tried it purely in C#, of course without the Async feature. I am trying to make it parallel with my main sequence.
ConnectAttempt is the button outlet for connection. Please tell me what solution should I apply to fix this. Thank you in advance.

How to catch home button click in xamarin forms page

$
0
0

Hi Team,

Is there any way to catch home button click event in xamarin form page ?

Thanks,
Mahesh K

Using AbsoluteLayout for a background image but an element not correctly positioned

$
0
0

Hi, I am using a relative layout to add a background image so that I can set the aspect property, however now that I've done that, the share button which was supposed to be at the bottom of the screen is no longer there.

This is my code (inside the ContentPage):

<RelativeLayout Parent="0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">

    <Image Source="Background.jpg" Aspect="Fill" RelativeLayout.WidthConstraint= "{ConstraintExpression Type=RelativeToParent, Property=Width}"
            RelativeLayout.HeightConstraint= "{ConstraintExpression Type=RelativeToParent, Property=Height}"></Image>

    <StackLayout>

        <Label Text="Timetable" TextColor="Silver" HorizontalOptions="EndAndExpand" Margin="0, 10, 20, 0">
        </Label>

        <Image Margin="15, 20" HorizontalOptions="Center" WidthRequest="350" Source="subtle-logo.png"></Image>

        <Image HorizontalOptions="Center" x:Name="PlayPauseButton" Source="play.png" WidthRequest="75">
        </Image>

        <Image HorizontalOptions="Center" x:Name="shareButton" Source="share-button.png" WidthRequest="50" 
               VerticalOptions="End" Margin="0, 0, 0, 20">
        </Image>

    </StackLayout>

  </RelativeLayout> 

This is it currently:
us.v-cdn.net/5019960/uploads/editor/ew/7on5hu6uszq0.png

This is where it should be (without the background image and without the relative layout).

us.v-cdn.net/5019960/uploads/editor/i4/r20ottjzqdhc.png

How Close Master Detail Page? (Landscape mode)

$
0
0

Hi everyone!
I want to close menu Phone or Tablet in Horizontal mode.
I try this code

 DriverDashBoard test = new DriverDashBoard();
        test.IsPresentedChanged+= (object sender, EventArgs e) =>
        {
            test.IsPresented = false;
        };
        test.IsPresented = false;

Result:

Still open :) How close this ?Thanks

How to display a popup menu

Viewing all 91519 articles
Browse latest View live


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