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

System.Data.SqlClient and SQLSERVER 2000

$
0
0

I know. I should not use System.Data.SqlClient, but I have no alternatives, so, can you help me?

I have installed using NuGet the System.Data.SqlClient and write some code to connect to a SQLSERVER 2000 DB.

My code works fine on a WinForms app.

Then I try to use it in a XF app. It seems to work but I have an exception when I try to open the connection:

"The SQL Server instance returned an invalid or unsupported protocol version"

It seems that I can't connect to a SQLSERVER 2000 DB because it is not supported..

Is this correct?

I have tried also the new Microsoft.Data.SqlClient, but it does not work at all (a nullreferenceexception is thrown).

Thanks for your help

 internal void Test()
    {

        //openConnection();

        string command = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES";

        try
        {

            using (SqlConnection sqlConnection = new SqlConnection(connectionString()))
            {

                SqlCommand sqlCommand = new SqlCommand(command, sqlConnection);

                sqlConnection.Open();

                SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
                while (sqlDataReader.Read())
                {
                    System.Diagnostics.Debug.WriteLine("Tablename = " + sqlDataReader[0].ToString());
                }
                sqlConnection.Close();
                sqlConnection.Dispose();
            }

        }
        catch(Exception ex)
        {
            System.Diagnostics.Debug.WriteLine(ex.Message);
        }
    }

    string connectionString()
    {


        string connectionString = "Server=tcp:" + _ipServer + ";" +
        "Initial Catalog=MYDB;" +
         "User Id=sa;" +
         "Password=;";

        return connectionString;
    }

Scrollview Content's not update Well after change Orientation

$
0
0

requestLayout() improperly called by md51558244f76c53b6aeda52c8a337f2c37.ScrollViewContainer

How to redirect from an Activity page of Android to the MainPage in Forms

$
0
0

Hi, Ive tried to implement this https://developer.xamarin.com/samples/monodroid/android5.0/NotificationsLab/ to my forms project but i have problems with the intent part.
I want to redirect the notifications to re-open if its closed the application and do nothing if its already open.
I have a thread in the Mainpage so if i create a new MainPage on the redirect everything screws up.
The other option its to open directly from the notification but i dont know either how to do it.

Class with the notification (Android):

[assembly: Dependency(typeof(NotificacionesDroid))]
namespace Alarmas3.Droid
{
public class NotificacionesDroid : Notificaciones
{
public NotificacionesDroid()
{}

    public void Crear()
    {
        NotificationManager notificationManager = Android.App.Application.Context.GetSystemService(Context.NotificationService) as NotificationManager;
        var context = Android.App.Application.Context;
        Notification.Builder builder = new Notification.Builder(context)
            .SetContentTitle("Title")
            .SetContentText("")
            .SetAutoCancel(true);

        builder.SetSmallIcon(Resource.Drawable.MyIcon);
        var textStyle = new Notification.BigTextStyle();

        textStyle.BigText("MyText");
        textStyle.SetSummaryText("Summary");

        builder.SetStyle(textStyle);

        builder.SetVisibility(NotificationVisibility.Public);
        builder.SetPriority((int)NotificationPriority.Default);
        builder.SetCategory(Notification.CategoryMessage);

        //Intent secondIntent = new Intent(context, typeof(SecondActivity));
        Intent secondIntent = new Intent(context, typeof(SecondActivity));
        secondIntent.PutExtra("message", "Hola");
        TaskStackBuilder stackBuilder = TaskStackBuilder.Create(context);
        stackBuilder.AddParentStack(Java.Lang.Class.FromType(typeof(SecondActivity)));
        stackBuilder.AddNextIntent(secondIntent);
        const int pendingIntentId = 0;
        //PendingIntent pendingIntent = stackBuilder.GetPendingIntent(pendingIntentId, PendingIntentFlags.OneShot);
        PendingIntent pendingIntent = PendingIntent.GetActivity(Forms.Context, 0, secondIntent, PendingIntentFlags.OneShot);
        builder.SetContentIntent(pendingIntent);
        Notification notification = builder.Build();

        notification.Defaults |= NotificationDefaults.Sound;
        notification.Defaults |= NotificationDefaults.Vibrate;

        Random random = new Random();
        int randomNumber = random.Next(4, 1000);
        notificationManager.Notify(randomNumber, notification);
    }

}

}

SeccondActivity (Android):

namespace Alarmas3.Droid
{
[Activity(Label = "Second Activity", Theme = "@android:style/Theme.Material")]
public class SecondActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);

        //Set the view from the "Second" layout resource:
        SetContentView(Resource.Layout.Second);


        Redirect();

    }

    async void Redirect()
    {
        await Xamarin.Forms.Application.Current.MainPage.Navigation.PopAsync();  //PushAsync(Xamarin.Forms.Application.Current.MainPage);
    }
}

}

To easy to see? Table view is not showing all cells on Android

$
0
0

Hi,

Problem description
A TableView, with one section, does not show all children on Android. The TableView is embedded in a ScrollView on a ContentPage, that is child to a TabbedPage.

The code works fine on iOS

Details
I have a list of 21 strings primitives of which I create 21 SwitchCells that become Children of the TableSection.
Tablesection.Count does show 21 children but only 13 are rendered to the screen.

Tools & Versions
I am working on VS 2019 Standard with a Mac; Xamarin.Forms 4.0.0.425677. I deploy to an Android device via USB cable, but the problem occures on multiple devices.

Code
XAML Code:

      <ScrollView  VerticalScrollBarVisibility="Always">
                    <TableView x:Name="tv_tableView" Intent="Menu" VerticalOptions="FillAndExpand">
                        <TableRoot>
                            <TableSection x:Name="ts_LabSelection" Title="Meine Anordnungen" >
                            </TableSection>
                        </TableRoot>
                    </TableView>
            </ScrollView>

C# Code:
I did put the code all together in one method for simplification here and removed other things like event handlers

   private void Init() //is called by ctor first thing
        {
            InitializeComponent();

            foreach (var option in _patient.LabOptions)
            {
                var cell = new SwitchCell();
                cell.Text = option.Topic;
                cell.On = option.State;
                ts_LabSelection.Add(cell);
            }
        }

I am still new to Xarmain.Forms but I really don't think I am doing something complicated here. Please help.

IValueConverter does not change UI when data change

$
0
0

Currently I use IValueConverter for handling data in listview, but when my data is changing real-time, although the converter is called, the item in listview is not changed. Can anyone have any idea?
<Label Style="{StaticResource MatchStatus}" Text="{Binding Converter={StaticResource matchStatusConverter}}" />

Why are the images not showing up in iOS?

$
0
0

We are using Wordpress as a backend for Xamarin forms, here the images are showing up in Android, but not iOS, from the remote URL. We have troubleshoot the issue and we didn’t find any solution for it. So, can you give us a solution for this issue.

Auto carousel View

$
0
0

Hi, I have a CarouselView on a page in my app. Right now one has to scroll by sliding to the left or right. I am looking for a way i can do an auto slide from right to left, then back to the first image.

My code is Attached. Any help will be greatly appreciated

Xamarin.Froms 3.0 Editor \r\n handling

$
0
0

Hi @all,

I'm, currently developing an UWP app with Xamarin.Forms 3.0 against an existing SQL Server database. Some fields are containing multi line text with \r\n as a line break. When I bind the content of such a field to an Editor control it seems that the Editor immediately sends a normalized version of the text back with only \n as a line break. Example:
"Text1\r\nText2\r\nText3" => "Text1\rText2\rText3".
This becomes a problem for several reasons:
1. My entity is marked as dirty and the user is ask for saving changes, even nothing has changed.
2. I don't know whether the native Win Forms clients would handle the change properly.

So my question is: Is there a way to control which character(s) are used for a line break?

Tanks in advance,
Carsten


How to find the child controls from StackLayout dynamically ?

$
0
0

I am using Xamarin.Forms (PCL project). I have created the stacklayout with some child controls. How can I get any control from this stacklayout dynamically (like findbyName , findbyID or Type) ?

Cannot see the other user in chat room

$
0
0

Hi xamarin forum im wondering why I can't see my other device inside the chatroom Im using TwilioChatXamarinBindings
I have setup everything from tokenprovider up to installing my app to my both devices

Issue on Navigating back Master Details Page in Xamarin forms MVVM prism using unity

$
0
0

Hi, I've attached a small project in which I'm currently facing the issue.
I've one Page it navigates to MasterDetail Page. MasterDetail Consist a Page1 in detail , there is one button which navigates to page2. Now when I navigate back then it navigates to Page1 but the MasterDetail Page is not available now..

Xamarin Forms 4 pre8 ListView bug!

$
0
0

Hi all!
I have a strange behavior of listview at 4.0.0.304370-pre8 version. It seems like a bug. Note: pre7 is stable

How to consume SOAP in Xamrin Forms Application

$
0
0

How to Integrate Soap Api in xamarin forms using wsdl file

Customize ListView

$
0
0

Hey,

I want to create a custom cell which should describe a transaction (like a banking app). The transactions should be group by there date.
The cell should look like the one in the attached photo.

My question is, is this possible with Xamarin.Forms?

I could create a cell with space between them using the DataTemplate for the ListView but there are two other major problems:
- How can I customize the grouping header (Label and Background) from the ListView?
- How can I change the selected background to only apply on my custom frame (not the entire cell, because I use space between them by "actual" cell
is a view inside the cell with margins around them)?

Is it better to use a Scroll view with custom views like cards for this? What is the performance of a ScrollView is like when there are many cells/views in there?

I have searched a lot but don't find anyone who is using such cells...

Thanks for your help!!

Flo

Xamarin MessagingCenter not working for some pages

$
0
0

I'm using messagingcenter to send message from a viewmodel to another viewmodel, the destination content page can be accessed from master page only(by clicking on hamburger icon). message can be send successfully to the previous and next pages but cannot send to pages within master page.Please help..

MessagingCenter.Send<Cart_page_vm>(this, "check_address_id");

MessagingCenter.Subscribe<Cart_page_vm>(this, "check_address_id", (sender) =>
    {
        //  getaddresses();
    });

Switch component size

$
0
0

Hi all I have no idea why that the switch component was made so small, to be begin with how can i make it bigger has anyone got a pure example of had to do it in xmairn forms.

Command Span Not Working Persian

$
0
0

hi
not working persian lang in run Command

I do not have a problem with English :)
I did not run when Farsi text :o

                    <Label>
                        <Label.FormattedText>
                            <FormattedString>
                                <Span Text="Forget" ForegroundColor="Red">
                                    <Span.GestureRecognizers>
                                        <TapGestureRecognizer Command="{Binding GoToForgetPage}" />
                                    </Span.GestureRecognizers>
                                </Span>
                                <Span Text="Forgot your password?" ForegroundColor="DodgerBlue">
                                    <Span.GestureRecognizers>
                                        <TapGestureRecognizer Command="{Binding GoToForgetPage}" />
                                    </Span.GestureRecognizers>
                                </Span>
                            </FormattedString>
                        </Label.FormattedText>
                    </Label>


    public ICommand GoToForgetPage { get; private set; }

    public LoginPage()
    {
        InitializeComponent();
        GoToForgetPage = new Command(async () => await DisplayAlert("Tapped", "This is a tapped Span.", "OK"));
        BindingContext = this;
    }

Help with Xamarin.Auth

$
0
0

I followed this tutorial but I can't get the URL redirect working. Maybe I have misunderstood but this is what I've tried ...

In the iOS project ...

I added this URL Scheme to info.plist: com.spike.Xamarin.OAuth:/oauth2redirect
I override the AppDelegate.OpenUrl method(s) (both overloads) and implement the code from the tutorial

In the PCL project ...

I pass same URL to the Xamarin.Auth.OAuth2Authenticator ctor.
I add an event handler to the Xamarin.Auth.OAuth2Authenticator.Completed event, to fetch the access token and so on.

In my protected Azure Mobile service (AAD / Express) ...

I registered the URL reversed: OAuth.Xamarin.spike.com:/oauth2redirect

Result

What happens is I get to the login page and I'm able to fill in my credentials as expected. But the final redirect never hits the AppDelegate.OpenUrl method.

What am I getting wrong here?

Debug works not on VisualStudio 2019

$
0
0

I have installed VisualStudio 2019 (instead of VS 2017) and in VisualStudio 2019 works debug not((. does anyone have any idea why?


PanGesture on item in ListView getting canceled, but only on Android

$
0
0

Hello!

I am making a swipe-to-delete function in my Xamarin Forms-project.
My current code works perfectly on iOS and UWP, but on Android the swipe gets canceled at random times.
Sometimes when i swipe it works for several seconds before getting canceled, and sometimes it gets canceled directly.

So what do i mean by "canceled"? It stops listening on the touch events, it freezes (look at image below) the element in place, and i have to lift my finger from the screen and press again to start firing touch events again. Moving around the finger and doing swipes after a freeze gives no events at all.

I am at a loss here, and i cant seem to find what is causing my cancelation of the swipe.

UPDATE:
It seems that the swipe works perfectly on Android while i only swipe left-to-right or right-to-left.
But if i move even 1 pixel vertical (up-to-down och down-to-up) it cancels the swipe completely and instead focusing on scrolling the listview.

-- IMAGE --

What is seen here is the first element in the standard position and the two other elements freezed while doing swipes on them

-- CODE --

Xaml with the ListView:
https://pastebin.com/8u8LPb2E

Xaml for "uiElements:CartViewCell" ( my ViewCell)
https://pastebin.com/zhq2YDWL

Code behind for ViewCell:
https://pastebin.com/XrUBLsBe

Cheers,
Tobias

Viewing all 77050 articles
Browse latest View live


Latest Images

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