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

best way to implement a exercise database

$
0
0

Hi All.

I am trying to develop a cross platform app that would allow me to plann exercise routines. my question right now is what is the best way to have a databse of exercises split by category? I was looking at SQLite but id be open to hearing if any other developers have any ideas...Ideally i would like the user to be able to add his/her own exercises to the ones i would include by default in the category lists. Thanks in advance for any suggestions!


How do I take form data and put it 'somewhere'

$
0
0

I have this so basic form and I am lost of how I get the form data out of the event stuff. Basically I want it so that when the user click the button I can see a message that says what each filed was completed as. Eventually I would like to make a json API POST call with it but I'm trying to learn so this is 1 step at a time.

public GreetPage()
    {
        InitializeComponent();
    }

    void Button_Clicked(object sender, EventArgs e)
    {
        // This is the current state I am using this as a place holder
        DisplayAlert.Text
    }
    // returning public string just trying to figure out how to "free" the data
    public string JobNum_Completed(object sender, EventArgs e)
    {
        var jobNumText = ((Entry)sender).Text;
    // This is the current thing I have just tried it is not working and says I can not convert some object type to a string
        return JobNum_Completed;
    }

    void Barcode_Completed(object sender, EventArgs e)
    {
        var barcodeText = ((Entry)sender).Text;
    }

    void Qty_Completed(object sender, EventArgs e)
    {
        var qtyText = ((Entry)sender).Text;
    }

How to binding two way CustomRenderer to UI?

$
0
0

Hi everybody, wish you have a nice day!
I using Circular Map Ovlerlay (sample) to draw a circle on Map.
Now on UI, I a slider, I want to change circle radius when slider value changed.
How to binding two way CustomRenderer to UI?

Thank you!

Creating a Log out in masterdetailpage

$
0
0

Hi xamarin forum
can I have an idea how to create a fully function log out inside a listview here is my code

<ListView x:Name="listView">
        <ListView.ItemsSource>
            <x:Array Type="{x:Type local:MasterPageItem}" x:Name="defaultList">
                <local:MasterPageItem Title="Home Page" TargetType="{x:Type local:MainPage}" />
                <local:MasterPageItem Title="Log Out" TargetType="{x:Type local:Logout}" />
            </x:Array>
        </ListView.ItemsSource>
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <Grid Padding="5,10">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="30"/>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Image Source="{Binding IconSource}" />
                        <Label Grid.Column="1" Text="{Binding Title}" TextColor="White" />
                    </Grid>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

I tried to use void Logout(object sender, eventArgs e) but it doesnt work

Prayer Times Notifications - Local or OneSignal?

$
0
0

Hi,

I have an app for prayer time notifications which will notify the user five times a day (not fixed times).

I will download the prayer times to the device and save it using SettingsPlugin so it will have it locally,

But what's the best practice to send the notification to the user?

Shall I Send local notification from my iOS and Android? or use OneSignal to send the notifications?

and if I send locally then how will I be able to track or check the analysis?

Kindly advise..

Thanks,
Jassim

ERROR WITH LATEST NUGET v2.5.0.77 "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded

$
0
0

I just got latest stable 2.5.0.77107 and I can't compile anymore

[myUser]\packages\xamarin.forms\2.5.0.77107\build\netstandard1.0\Xamarin.Forms.targets(55,3): error MSB4062: The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded from the assembly [myUser]\.nuget\packages\xamarin.forms\2.5.0.77107\build\netstandard1.0\Xamarin.Forms.Build.Tasks.dll.  Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

I replaced my user path with [myUser]

it looks like this bug exists since October in the pre-release:

https://bugzilla.xamarin.com/show_bug.cgi?id=60293

second masterdetailpage is not responding

$
0
0

Hi Xamarin forum

I tried to create another masterdetailpage for the logged in members I have successfully recreate the UI for masterdetailpage but it doesnt responds when I try to tap for example the Home on its list Here is my code

<ListView x:Name="listView2"> <ListView.ItemsSource> <x:Array Type="{x:Type local:MasterPageItem}" x:Name="defaultList"> <local:MasterPageItem Title="Home Page" TargetType="{x:Type local:MainPage}" /> <local:MasterPageItem Title="Log Out" TargetType="{x:Type local:Logout}" /> </x:Array> </ListView.ItemsSource> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <Grid Padding="5,10"> <Grid.ColumnDefinitions> <ColumnDefinition Width="30"/> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Image Source="{Binding IconSource}" /> <Label Grid.Column="1" Text="{Binding Title}" TextColor="White" /> </Grid> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView>

My LoggedMenuCS.cs

`
{
public ListView ListView { get { return listView; } }

    ListView listView;

    public LoggedMenuCS ()
    {
        var masterPageItems = new List<LoggedInItem>();
        masterPageItems.Add(new LoggedInItem
        {
            Title = "Home",
            TargetType = typeof(MainPageCS)
        });
        masterPageItems.Add(new LoggedInItem
        {
            Title = "Log Out",
            TargetType = typeof(LogoutCS)
        });

        listView = new ListView
        {
            ItemsSource = masterPageItems,
            ItemTemplate = new DataTemplate(() =>
            {
                var grid = new Grid { Padding = new Thickness(5, 10) };
                grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(30) });
                grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });

                var image = new Image();
                image.SetBinding(Image.SourceProperty, "IconSource");
                var label = new Label { VerticalOptions = LayoutOptions.FillAndExpand };
                label.SetBinding(Label.TextProperty, "Title");

                grid.Children.Add(image);
                grid.Children.Add(label, 1, 0);

                return new ViewCell { View = grid };
            }),
            SeparatorVisibility = SeparatorVisibility.None
        };

    }
}

`

ListView item images misplacing and disappear sometimes while scroll up/down in Xamrin.Form

$
0
0

Hello

I have read few blogs but didn't find solution of it.

When I scroll Up/Down, some image misplace and some image disappear. I have review my code and given enough time to get rid of the problem. But unfortunately I didn't find any way to resolve this.

Can anybody please guide me? I check with iOS.

EmployeeResultsPage

<ListView x:Name="EmployeeResultsListView"
          ItemsSource="{Binding EmployeeResults}"
          RowHeight="200"
          IsPullToRefreshEnabled="true"
          RefreshCommand="{Binding RefreshDataCommand}"
          IsRefreshing="{Binding IsRefreshingData, Mode=OneWay}"
          ItemAppearing="Employee_ItemAppearing"
    <ListView.ItemTemplate>
        <DataTemplate>
            <local:EmployeeResultViewCell />
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

EmployeeResultsPage.CS

private void Employee_ItemAppearing(object sender, ItemVisibilityEventArgs e)
{
    var itemObject = e.Item as ExtendedEmployee;
    if (_viewModel.EmployeeResults.Last() == itemObject)
    {
        if (_viewModel.LoadEmployee.CanExecute(null))
        {
            _viewModel.LoadEmployee.Execute(null);
        }
    }
}

EmployeeResultViewModel

[ImplementPropertyChanged]
public class EmployeeResultsViewModel : ViewModelBase
{
    private async Task LoadEmployee()
    {
        EmployeeResults = GetDataUsingAPI(); //15 records per call
    }

    public ObservableRangeCollection<ExtendedEmployee> EmployeeResults { get; set; }

    public string EmployeePhotoUrl { get; set; }
    public string EmployeeName { get; set; }
}

EmployeeResultViewCell

<ViewCell.View>
    <Grid RowSpacing="0" ColumnSpacing="0" VerticalOptions="Center" HeightRequest="150">
        <Image x:Name="EmployeeImage" Grid.Column="0" HeightRequest="150" WidthRequest="150"
        Source="{Binding EmployeePhotoUrl}" />
        <Label Text="{Binding EmployeeName}" FontSize="18" TextColor="Grey"/>
    </Grid>
</ViewCell.View>

CS File

public partial class EmployeeResultViewCell : CustomViewCell
{
    public EmployeeResultViewCell()
    {
        InitializeComponent();
    }

    protected override void OnBindingContextChanged()
    {
        base.OnBindingContextChanged();
        var employee = (BindingContext as ExtendedEmployee);
    }
}

Custom renderer WKWebView, get/set url

$
0
0

Goodday,

I want to replace the default WebView for iOS by WKWebView because of the bad performance, i took the example form the Xamarin website (hybridwebview). This works when i set the url when the app is initialising, it renders fast. In the example there is an event handler on Uri, but then i change the value by settings it the OnElementChanged is not fired?

Can somebody give me some advice :) or am i doing something terribly wrong? (I am new to Xamarin :) so sorry for silly questions ;))

Shared part:

<br />namespace Woby
{
     public class HybridWebView : View
     {
         Action<string> action;
         public static BindableProperty UriProperty = BindableProperty.Create(
           propertyName: "Uri",
           returnType: typeof(string),
           declaringType: typeof(HybridWebView),
           defaultValue: default(string));

         public string Uri
         {
             get { return (string)GetValue(UriProperty); }
             set { SetValue(UriProperty, value); }
         }
     }
 }

Platform code (iOS):

<br />[assembly: ExportRenderer(typeof(HybridWebView), typeof(HybridWebViewRenderer))]

 namespace Woby.iOS
 {
     public class HybridWebViewRenderer : ViewRenderer<HybridWebView, WKWebView>
     {
         protected override void OnElementChanged(ElementChangedEventArgs<HybridWebView> e)
         {
             base.OnElementChanged(e);
             if (Control == null)
             {
                 var config = new WKWebViewConfiguration { };
                 var webView = new WKWebView(Frame, config);
                 SetNativeControl(webView);
             }
             if (e.OldElement != null){ }
             if (e.NewElement != null)
             {
                 if (Element.Uri != null)
                 {
                     Console.WriteLine("Changing = " + Element.Uri);
                     Control.LoadRequest(new NSUrlRequest(new NSUrl(Element.Uri)));
                 }
             }
         }
     }
 }

How can we support RTL with Xamarin.Forms embedding into Xamarin Native?

$
0
0

My Native Xamarin App supports ltr and rtl. I embedded a Forms page to my Native Project. Now how can I support rtl to Forms pages too?

Xamarin forms Swipe back to previous page

$
0
0

Hi,

is there anyway to get swipe back to previous screen feature in Xamarin.Forms.
Incase of ios, its there. But when i hide navigation bar these feature also going.

the requirement is like .

  1. Hide navigation bar
  2. Get swipe back to previous screen feature. ( at least in ios )

Please help me to resolve this

Where are the XAML designer tools?

$
0
0
Years have past ;-) not really but I think this question has been asked many Times' before.

The forms previewer crash all the time. It could be seen more of a compile:designer that breaks as soon as you start adding codebehind stuff.

We need a designer for Xaml not css? I think the web guys gonna stick to other tools anyways
The live previewer very nice idea, same thing doesn't work yet.

I just need BLEND with a Visual state manager. where is the backning from the Microsoft team that dream up stuff like the Blend tools :-)

Create separate app from the same solution

$
0
0

So now I have one shared code and 2 android project, I wish to create app for each of the android project but I could only create one where each time it compile (doesn't care which first) it will be combine in one apk only. Can anyone help?

How to switch contents of Masterdetail page on logging in

$
0
0

Hi is it possible to change the content of masterdetailpage on log in im currently using DataTemplate
<DataTemplate x:Key="DefaultMenu"> <ViewCell> <Grid Padding="5,10"> <Grid.ColumnDefinitions> <ColumnDefinition Width="30"/> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <ListView x:Name="listView"> <ListView.ItemsSource> <x:Array Type="{x:Type local:MasterPageItem}"> <local:MasterPageItem Title="Home Page" TargetType="{x:Type local:HomePage}" /> </x:Array> </ListView.ItemsSource> </ListView> </Grid> </ViewCell> </DataTemplate> <DataTemplate x:Key="LoggedMenu"> <ViewCell> <Grid Padding="5,10"> <Grid.ColumnDefinitions> <ColumnDefinition Width="30"/> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <ListView x:Name="listView"> <ListView.ItemsSource> <x:Array Type="{x:Type local:MasterPageItem}"> <local:MasterPageItem Title="Logout" TargetType="{x:Type local:LoginPage}" /> </x:Array> </ListView.ItemsSource> </ListView> </Grid> </ViewCell> </DataTemplate>

How to set control FontSize?

$
0
0

I know Lable ,Button can set the FontSize , but EntryCell ,DatePicker, Picker not that attribute. how to set for them??


Xamarin.Forms Authentication

$
0
0

I want to authenticate the Users and admin separate for my app. How can I do using blockchain? Can we use passport.js with xamarin.forms?

Difference between Navigation.PushModalAsync and new Navigation.PushModalAsync?

$
0
0

Dear Xamarin members,

I have a hard time with the Showing Pages/Navigation in Xamarin.Forms.

What is the difference between :
1) Navigation.PushModalAsync(new PDFViewer());
2) var page = new NavigationPage(new PDFViewer());
Navigation.PushModalAsync(page);

Regards,
Gert

How to apply for xamarin developer certification

$
0
0

i am from india. i want apply xamarin developer certification but cost certification is too high any other to way to apply.kindly guide me

Ho to use: await client.GetAsync("url"); method in App.cs?

$
0
0

I need to get a webservice response with HttpClient in App.cs class(i.e. when app starts). I am able to get the response in other pages but in App class it is throwing error : Object Reference is set to null.
See my sample code:

            var client = new HttpClient();         
            client.BaseAddress = new Uri(geturl);
            client.DefaultRequestHeaders.Add("headone", username);
            client.DefaultRequestHeaders.Add("headtwo", pass);

            var response = await client.GetAsync(url);
            var ResultHTML = reponse.Content.ReadAsStreamAsync().Result;

Debugger shows Error in this line : var response = await client.GetAsync(url);
This code is working file for all other pages but why it is showing error in App class.
I have tried all the possible solutions given in this link: https://forums.xamarin.com/discussion/10405/the-authentication-or-decryption-has-failed-in-the-web-request

But nothing worked for me. Please help me in resolving this error. I have to fetch response from the Httpclient if user is already logged-in otherwise go to the login page. So I have to write GetAsync() code in App class.
Please reply.
Error: System.NullReferenceException: Object reference not set to an instance of an object.

Need code sample for Xamarin.forms using entity framework core 2.0 with migration support

$
0
0

I'm trying to create new app from scratch using Visual Studio 2017 (15.5.6) & Xamarin (4.8.0.760). Through nuget I added reference of "EntityFramework Core" 2.0. I also added Sqlite related nuget packages in my .net standard projects.

I added my model classes and datacontext in .net standard project. Now I want to perform the migration and create the new database. Also, want to perform the subsequent migrations for any model related changes.

When I try to run migration using the command "dotnet ef migrations add ", get Build error.

error MSB4062: The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded from the assembly C:\Users\.nuget\packages\xamarin.forms\2.5.0.280555\build\netstandard1.0\Xamarin.Forms.Build.Tasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Build Failed.

From above log, can anybody suggest any fix in order to overcome this issue (though through visual studio when I build my code, it builds properly) and create migration?

Also, I looked for some working sample of EF Core 2.0 in Xamarin.Forms with migration but couldn't find any sample so far. All samples just shows the simple entity class which in turn create db upon run but not further migrations. This creates doubts in my mind whether migrations are supported yet or not?

Thanks,

Viewing all 91519 articles
Browse latest View live


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