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

UITest for Splash Screen

$
0
0

I have a splash screen which will be open for like 2-3 seconds.
I need to do a testing of splash screen on different device.
How can I achieve it as I have already tried app.Screenshot("") method but it's not taking the screenshot of splash screen but the home page.
I can take the screenshot of splash and compare with it splash Image..But how can I compare screenshot with splash image file?

app = AppInitializer.StartApp(platform);
app.Screenshot("Splash Screen"); //It's not taking the screenshot of splash screen but home screen


Grid Paging buttons, how to add dynamic paging buttons

$
0
0

In grids, the page numbers available based on the selected page size should be visible at the bottom of the grid. By clicking on a page number the user will navigate to the appropriate page.

Only want to show the Current Page number and 5 pages before and after.
If there are more than 5 pages before or after, show an ellipses (...) to indicate that we have more records.

Example: on page 8 of 20:
... 3 4 5 6 7 8 9 10 11 12 13 ...

Xamarin.UITest : UItest for Splash Screen

$
0
0

How to do a UI test for splash screen?

Xaml C# how use x:Name

$
0
0
             x:Class="AppMobile.Views.About">
    <ContentPage.Content>
        <StackLayout>
            <Editor x:Name="editor1" Text="EDITOR1 TEXT" TextChanged="textEditorChanged"></Editor>
      <Editor x:Name="editor2" Text="EDITOR2 TEXT" ></Editor>
        </StackLayout>
        [XamlCompilation(XamlCompilationOptions.Compile)]
        public partial class About : ContentPage
        {
            public About ()
            {
                InitializeComponent ();
                SetTextEditor();
            }


                Editor editor1 = new Editor();
                public void TextChangedEvent(object sender, TextChangedEventArgs e)
                {
                    editor1.Text = e.OldTextValue;
                }
                            Editor editor2 = new Editor();
                 public void SetTextEditor()
                {
                        editor2.Text = "NEW text EDITOR2";
                 }

        }
}

Error Position 10:59. EventHandler "textEditorChanged" not found in type "AppMobile.Views.About" PictureCodeAppMobile D:\Pic\mobile\AppMobile\AppMobile\Views\About.xaml 10

What you need to do to make it work.
How to use X: Name.
I'm used to the fact that no one wants to give a good answer or set an example. Only links.

Best way to integrate spotify to xamarin.forms applicaiton

$
0
0

Hi all,

Can someone point me to a proper way to play music from spotify in my xamarin.forms application?

What would be the best approach: can we use their web api to play music, are there some libraries for xamarin (I can't find any), should we try to link iOS / Android libraries from spotify (and did anyone had any experience with this)?

ItemSource Property of Picker

$
0
0

Hi Everyone,
I am trying to the binding list of data in the picker. I am using a view model, web services.

    var response = kitchenDetailServices.GetAllKitchen(BaseClass.UserId, BaseClass.Token);

              weight_picker.ItemsSource = new List<string>();
              foreach (var item in response.parameters)
              {
                 weight_picker.ItemsSource.Add(item.kitchen_name);
               // weight_picker.ItemsSource = item.kitchen_name[0];
            }

xaml

 <controls:JarPicker x:Name="weight_picker" Title="Select Kitchen" TextColor="LightGray" VerticalOptions="Center" HeightRequest="40">
     </controls:JarPicker>

But picker is not showing the items?

help

Cross geolocator location not being captured in background

$
0
0

Hi,
I'm using Plugin.Geolocator.CrossGeolocator(4.5.06) in Xamarin.forms(3.2.0.871581) for capturing location of path user traveled.
Using background(Displayoff/App running background) location change not being captured.
Below is the code of listener and its changed event.

    ListenerSettings listenerSettings = new ListenerSettings
                    {
                        AllowBackgroundUpdates = true, ActivityType = ActivityType.AutomotiveNavigation, DeferLocationUpdates = true,
                        DeferralDistanceMeters = 5, ListenForSignificantChanges = true, PauseLocationUpdatesAutomatically = false
                    };
            CrossGeolocator.Current.StartListeningAsync(TimeSpan.FromSeconds(5), 5, true, listenerSettings);
            CrossGeolocator.Current.PositionChanged += Current_PositionChanged;
            CrossGeolocator.Current.PositionError += Current_PositionError;

I need custom info window with multiple line text in mkmap view any relevant reference for that ??

$
0
0
I need custom info window with multiple line text in mkmap view any relevant reference for that ??

How do i achieve a sleek calendar UI with Xamarin Forms like the one below?

$
0
0

Good day everyone.
I'm kind of new with Xamarin Forms and i'm creating an app which would require a sleek calendar view like the one in the image below.
Any ideas please?

Issue on iOS when pushing modal on master detail during application startup.

$
0
0

I have an unusual problem only appearing on iOS. After setting the main page (master detail) I am doing long asynchronous task. When this task is finished I am pushing modally another page like this:

MainPage = new MasterDetail();
await FetchSthFromDb();
MainPage.Navigation.PushModalAsync(new SomePage());

I got the following error:

Warning: Attempt to present <Xamarin_Forms_Platform_iOS_ModalWrapper: 0x7f9eb84694f0> on <Xamarin_Forms_Platform_iOS_PlatformRenderer: 0x7f9eb8444d80> whose view is not in the window hierarchy!

This error only appears on iOS. On Android everything is working fine. Did anyone encounter sth similar?

Create DataGrid in xamarin with column rearranging facility.

$
0
0

I want to create a DataGrid with column rearranging facility . I don't want to use third party DataGrids and also avoid custom renderers.

How to implement Link Preview in Xamarin froms?

Cannot change Navigation page barbackgroundcolor programmatically

$
0
0

Hi
Wondering if is possible to change the navigation bar background programmatically
without using renderers.

I have an app that uses prism not that matters .
I have a masterpage and in my app.xaml I have the following

     <Style TargetType="NavigationPage">
        <Setter Property="BarBackgroundColor" Value="OrangeRed" />
        <Setter Property="BarTextColor" Value="Blue" />
      </Style>

so far so good!!!

Now when I go to a particular page I need to change the BarBackgroundColor.

Whatever I tried did not work(below code anywhere is always null!!)

        //does not work as navigationPage is null
        var navigationPage = App.Current.MainPage as NavigationPage;
        navigationPage.BarBackgroundColor = Color.Red;


I even created a class :MyNavigationPage and injected it and still does not work

public class MyNavigationPage : Xamarin.Forms.NavigationPage, INavigationPageOptions, IDestructible
{
    public MyNavigationPage()
    {

    }
}
     private readonly myNavigationPage navPage;

    public MenuViewModel(INavigationService navigationService,
    MyNavigationPage navigationPage) : base(navigationService)
    {
        this.navPage = navigationPage;
    }
    private void OnMenuItemTapped(MasterMenuItem menuItem)
    {
       navPage.BarBackgroundColor=Color.Red;
    }

    }

any samples out there where it works!!!
Is this a bug?

many thanks

Listview Selected Item background unable to to change?

$
0
0

Here I am using a ViewCellRenderer fro chnage the listview selected item background color,but it will chnage the color when I tap on an item after that it chnage to the default background color.

here is the example

My ViewCell Renderer Class

public class ViewCellTransparent : ViewCellRenderer
    {
        protected override View GetCellCore(Cell item, View convertView, ViewGroup parent, Context context)
        {
            var cell = base.GetCellCore(item, convertView, parent, context);
            var listView = parent as ListView;

            if (listView != null)
            {
                listView.SetSelector(global::Android.Resource.Color.HoloGreenDark);
                listView.CacheColorHint = global::Android.Graphics.Color.Transparent;
            }
            return cell;
        }        
    }

How to fix this?

Webview Navigating event not working

$
0
0

I have created a webview renderer in android, where I've made POST calls.
In portable project webview's navigating event has stopped working, Navigated event is working fine.
If I remove renderer than navigating event is working fine.


iOS SQLite auto closing?

$
0
0

Hello,

I've run into an issue with sqlite-net-pcl v1.4 It's only occuring on iOS, not on Android.

This project is a .net standard 2 project, in a MVVM methods (mostly).

What I'm running into is that I've got a ViewModel that has two repositories. Each repository has a reference to the common database library. At finalization time, it appears that the 1st repository is garbage collected - (the database library is disposed first before each repository), somehow the SQLite connection is closed and I'm not sure why.

None of my code - common or iOS specific actually does a close. At the finalize of the second repository, this message shows up:

2018-10-09 18:25:39.413082-0400 Project.iOS[5915:371800] [logging] API call with invalid database connection pointer
2018-10-09 18:25:39.413239-0400 Project.iOS[5915:371800] [logging] misuse at line 154262 of [95fbac39ba]

Since this doesn't show up at every finalize occurrence and since it's disposing of the objects, it could be ignored - but I'd like to fix it.

I didn't see much out there excepting this, but that's more of a problem with the open side of things, not why it's auto closing the connection.

This isn't happening on iOS when the ViewModel only has one repository on it.

Has anyone run into this, if so, how did you fix it?

The iOS common code:

public class IOSSQLite : ISQLite
{
    public SQLiteConnection GetConnection()
    {
        string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder  
        string libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder  
        var path = Path.Combine(libraryPath, DatabaseHelper.DbFileName);
        var conn = new SQLiteConnection(path);

        // Return the database connection  
        return conn;
    }
}

Common code:

public class GetMyDBConnection
{
    SQLiteConnection _sqliteconnection;
    public SQLiteConnection Connection
    {
        get
        {
            return _sqliteconnection;
        }
    }

    public GetMyDBConnection()
    {
        _sqliteconnection = Xamarin.Forms.DependencyService.Get<ISQLite>().GetConnection();
        System.Diagnostics.Debug.WriteLine("GetMyDBConnection() pointer addr: " + _sqliteconnection.Handle.ptr.ToString());
        System.Diagnostics.Debug.Flush();
    }
}

public class ViewModelList : ViewModelBase
{
public ICommand FinishCommand { get; private set; }
private SQLiteConnection MyConnection { get; set; }

    public ViewModelList(INavigation navigation, int Id)
    {
        System.Diagnostics.Debug.WriteLine("ViewModelList");
        System.Diagnostics.Debug.Flush();

        _navigation = navigation;
        GetMyDBConnection connection = new GetMyDBConnection();
        MyConnection = connection.Connection;
        connection = null;
        System.Diagnostics.Debug.WriteLine("ViewModelList - connection ptr: " + MyConnection.Handle.ptr.ToString());
        System.Diagnostics.Debug.Flush();

        _repositoryOne = new RepositoryOne(MyConnection);
        _repositoryTwo = new RepositoryTwo(MyConnection);

        FinishCommand = new Command(async () => await Finish());

        FetchData(Id);
    }

    various other methods...
}

public class RepositoryOne : IRepositoryOne 
{
    DatabaseHelper _databaseHelper;

    public RepositoryOne(SQLiteConnection connection)
    {
        _databaseHelper = new DatabaseHelper(connection);
    }

     various repository methods...
}

public class RepositoryTwo : IRepositoryTwo 
{
    DatabaseHelper _databaseHelper;

    public RepositoryTwo(SQLiteConnection connection)
    {
        _databaseHelper = new DatabaseHelper(connection);
    }

     various repository methods...
}

public class DatabaseHelper
{
    static SQLiteConnection sqliteconnection;
    public const string DbFileName = "information.db";

    public DatabaseHelper(SQLiteConnection connection)
    {
        System.Diagnostics.Debug.WriteLine("DatabaseHelper() - sqliteconnection ptr: " + connection.Handle.ptr.ToString());
        sqliteconnection = connection;
        sqliteconnection.CreateTable<Table>();
    }

    various specific database items...
}    

Application over other apps

$
0
0
Hello guys! Is there any tutorial that shows how can I run a layout over other apps? For example, Messenger uses it. I want something like Floating Action Button. The user sees it for example in the right corner, and can interact with it. Thank you!

How to make a Cross Platform Bubble Control? (example of request provided)

SignaturePad JPG image has black background

$
0
0

using SignaturePad.Xamarin.Forms.PCL

When trying to save a JPG from the SignaturePad it is saved with a black background no matter what background color I specify in the signature pad

A PNG saves properly with transparency and in the JPG I also see the signature if I use a stroke color other than black

Looks like there is an issue with the transparency not being converted to the background color

I do need a JPG in this case so the question is is there something I can do to make the JPG have a white background?

thanks

Mike

Build Hello World Xamarin Forms app ist too slow

$
0
0

I created simple Hello World Xamarin.Forms 3.2.0 application. Shared project is .NET Standard 2.0

Average build time is 52 seconds.

In my opinion build is too slow.

What is your opinion? Is build time OK or is wrong in settings?

Build on Dell Precission M33800

  • Intel(R) Core(TM) i7-4702HQ CPU @ 2.20GHz
  • 16 GB RAM
  • Samsung SSD 850 EVO mSATA 500GB
  • Windows 10 x64
  • Visual Studio Enterprise 2017 15.8.6
Viewing all 91519 articles
Browse latest View live


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