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

When I add a second activity for android target, it has not TitleBar

$
0
0

Hey,

Because I want to create a native Android Preference screen in my xamarin forms app, I added a second Activity:

    [Activity(Label = "Unicat OM Settings", Icon = "@drawable/icon", Theme = "@style/MainTheme", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class SettingsActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        protected override void OnCreate(Bundle bundle)
        {
            RequestWindowFeature(WindowFeatures.ActionBar);
            this.Title = "Title";
            base.OnCreate(bundle);

            // Display the fragment as the main content.
            PrefsFragment prefsFragment = new PrefsFragment();
            this.FragmentManager.BeginTransaction().Replace(global::Android.Resource.Id.Content, prefsFragment).Commit();
        }
    }

The theme @style/MainTheme is set to:

 <style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
...

Unfortunately, the activity does not have a Titlebar. As you can see in the code, I tried to add the Titlebar via RequestWindowFeature, but no luck.

How can I add the titlebar?

I just realize, I kind of double post with here: https://forums.xamarin.com/discussion/106180/adding-a-actionbar-to-a-preferenceactivity#latest
Sorry for that.


Xamarin.Forms Label won't word wrap inside a Grid

$
0
0

I define a Grid like this:

var easyGrid = new Grid();
easyGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
easyGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });

I then populate the Grid with text and bullets (emulating a bulleted list) like so:

for (int i = 0; i < bullets.Length; i++) {
    easyGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });

    var label = new Label { Text = "•" };
    label.SetValue(Grid.RowProperty, i);
    easyGrid.Children.Add(label);

    var text = new Label { Text = bullets[i] };
    text.SetValue(Grid.RowProperty, i);
    text.SetValue(Grid.ColumnProperty, 1);
    easyGrid.Children.Add(text);
}

But on iOS the Label controls don't word wrap as they do outside a Grid layout control. Is this a bug with Xamarin.Forms on iOS? Otherwise how do I get them to word-wrap?

NullReferenceException on InitializeComponents - What did I do wrong?

$
0
0

Hello,

I've encountered an error when loading a new ContentPage. When the app reaches InitializeComponents() I'm thrown with System.NullReferenceException. (both on iOS and Android)

Can someone please explain what I did wrong here?

Here's the code and stack trace: (I used PasteBin because they're long)
SettingsPage.xaml
SettingsPage.xaml.cs
Stack Trace

Thanks in advance for any help!

Can I embed a NavigationPage into a place holder?

$
0
0

This is currently my main page which is a tabbed page like instagram.

public partial class MainPage : ContentPage
{

    void Home(object sender, System.EventArgs e)
    {
        var page = new Feed();
        PlaceHolder.Content = page.Content;
    }
    void Schedule(object sender, System.EventArgs e)
    {
        var page = new Schedule();
        PlaceHolder.Content = page.Content;
    }
    void Messages(object sender, System.EventArgs e)
    {
        var page = new Messages();
        PlaceHolder.Content = page.Content;
    }
    void Departments(object sender, System.EventArgs e)
    {
        var page = new Departments();
        PlaceHolder.Content = page.Content;
    }
    void More(object sender, System.EventArgs e)
    {
        var page = new Options();
        PlaceHolder.Content = page.Content;

}

Each button displays the content of the newly instantiated class.

My problem is that I am unable to Navigate within the newly instantiated class.
I initially believe that I would need to put a wrap the placeholder content within a NavigationPage in order to use navigation functions

Here is my departments class which shows up if I click on the departments tab...

namespace ProvigramAlpha
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class Departments : ContentPage
{

// HERE IS WHERE I ATTEMPT TO NAVIGATE TO A NEW PAGE.
private async void DepartmentSelected(object sender, SelectedItemChangedEventArgs e)
{
var dpt = e.SelectedItem as Department;
await Navigation.PushAsync(new DepartmentDetailPage(dpt));
}

    public Departments()
    {
        InitializeComponent();
        dptsListView.ItemsSource = new List<Department>
        {


            new Department { Text = "Branch Sales & Operations"},
            new Department { Text = "Call Center"},
            new Department { Text = "Call Services"},
            new Department { Text = "Call Center"},
            new Department { Text = "Card Services"},
            new Department { Text = "Consumer Lending"},
            new Department { Text = "Information Technology"},
            new Department { Text = "Investment & Insurance"},
            new Department { Text = "Marketing"},
            new Department { Text = "Project Management Office"},
            new Department { Text = "Risk Management"},
            new Department { Text = "Service Quality & Training"}
        };



    }
}

}

Is there any way I can make this work without using a "Tabbed Page"? All suggestions are appreciated! Thank you!

Unable to set ICommand properties in my view model

$
0
0

I am developing a simple Xamarin.Forms app using a MVVM approach with VS 2017. Everything works as expected in UWP but my Android project does not execute the lines of code that get/set ICommand properties at all. I can set a breakpoint on the line that sets the property value, as well as the line before and the line after. I break on both lines before and after, but not on the line that sets the property.

Here is my view model code:

public LoginPageViewModel(INavigation navigation) : base() 
{
        Navigation = navigation;
        LoginButtonClicked = new Command(Login, () => true);
        PasswordHintButtonClicked = new Command(PasswordHint, () => true);
}

And my XAML.cs:

btnLogin.SetBinding(Button.CommandProperty,  nameof(vm.LoginButtonClicked), BindingMode.OneWay);
btnPasswordHint.SetBinding(Button.CommandProperty, nameof(vm.PasswordHintButtonClicked), BindingMode.OneWay);

As I said, I can break on setting the Navigation property but not the command properties. If I move Navigation = navigation to the last line of the constructor I still break on it.

I've also tried:

private ICommand _loginButtonClicked; public ICommand LoginButtonClicked { get { return _loginButtonClicked ?? (_loginButtonClicked = new Command(Login, () => true)); } }

This should be pretty straightforward. Maybe I made a mistake configuring the Android emulator? I've been beating my head against this for a few days now, if anyone has seen something like this before I'd appreciate a nudge in the right direction.

Thanks!

Connect SQLserver to Xamarin forms

$
0
0

Im new to Xamarin and i want to make an application for ios and android using forms, but i want to connect the input datas into SQL server and by researching a little i found out that you can use Web services more exactly REST services to make the connection. My question is is there a easier way and if not how do i implement REST services into xamarin forms?

CarouselView not functional on ios.

$
0
0

Hello world,

I try to implement a CarouselView with the nuget packahe Xamarin.Forms.CarouselView (2.3.0-pre2). The carousel is fully functionnal on Android But on my iOS project it doesn't work. Nothing appears on the screen. I don't understand why. If some one have an idea ?

My package is already install everywhere.

Heres my Xaml Code:

        <CarouselControl:CarouselView x:Name="CarousselPictures" ItemsSource="{Binding ListOfPictures}" Position="{Binding Position, Mode=TwoWay}" BackgroundColor="Aqua">
            <CarouselControl:CarouselView.ItemTemplate>
                <DataTemplate>
                    <Image Source="{Binding PicUri}" Aspect="AspectFit" HorizontalOptions="FillAndExpand"/>
                </DataTemplate>
            </CarouselControl:CarouselView.ItemTemplate>
        </CarouselControl:CarouselView>

Why CarouselView cannot work on IOS.

$
0
0

I am using xamarin.forms, and the code works on android but cant work on ios.


WKWebView caching not working

$
0
0

Hi there,

I’m building a Xamarin Forms project whose main component is a WebView.
I have built it such that on iOS7 a UIWebView is used, and on iOS8 a WKWebView is used.

Basically I want a cache for the WebViews to persist between runs of the application.

iOS7
Using iOS7’s UIWebView I managed to figure it out using the code below:

NSUrlCache.SharedCache = new NSUrlCache(50 * 1024 * 1024, 200 * 1024 * 1024, "cache");
NSUrlCache.SharedCache.Init();

Now unfortunately I didn’t find any documentation explaining how it works, so this was very trial and error.
So I’m not sure on recommended sizes for the cache size in memory or on disk… any guidance would be very much appreciated!

iOS8
On iOS 8 though, this solution just does not work.
I haven’t been able to find any data on the Xamarin Forums (or anywhere else, including the apple forums) explaining how to do this, so perhaps it could be a limitation of the WKWebView? Or my google-fu is lacking?

Any information on how to set up the cache would be much appreciated!

NSUrlRequestCachePolicy
Also of interest, the caching policy on a Load request doesn’t seem to have much of an effect on either the UIWebView or the WKWebView.
For example, the code below does not ignore local cache and request a fresh copy from the server.
Is this a known issue, or am I perhaps not using it correctly?

webView.LoadRequest(new NSUrlRequest(new NSUrl(url), NSUrlRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, 15));

Thanks in advance,
Basil

SkiaSharp SKCanvasView loading inconsistancies in Android emulators

$
0
0

Hello,

Strange error happening with SkiaSharp SKCanvasView on Android device emulators.

SKCanvasView implemeted in a contentView like this:

<StackLayout Orientation="Vertical" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" BackgroundColor="#414141" >
                            <skia:SKCanvasView x:Name="canvasView" Grid.Column="0" Grid.Row="0" PaintSurface="OnCanvasViewPaintSurface" Touch="OnCanvasTouch" EnableTouchEvents="True" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" BackgroundColor="#414141" />
</StackLayout>

When the contentView loads, I use a pre-defined _resourceId which is simply a string pointing at an embeddedResource image in the shared project.
The base image is 600px x 300px

            Assembly assembly = GetType().GetTypeInfo().Assembly;

            using (Stream stream = assembly.GetManifestResourceStream(_resourceID))
            using (SKManagedStream skStream = new SKManagedStream(stream))
            {
                _resourceBitmap = SKBitmap.Decode(skStream);
            }

After the constructor completes, the OnCanvasViewPaintSurface() method fires to draw the image onto the canvas.
Note the _resourceBitmap now used to fill the SKCanvasView control...

    void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEventArgs args)
    {
        SKImageInfo info = args.Info;
        SKSurface surface = args.Surface;
        SKCanvas canvas = surface.Canvas;

        canvas.Clear();

        try
        {
            //base control size
            var baseFrame = SKRect.Create(0, 0, info.Width, info.Height);
            var imageSize = new SKSize(_resourceBitmap.Width, _resourceBitmap.Height);
            var aspect = baseFrame.AspectFit(imageSize);

            var pictureFrame = SKRect.Create(0, 0, aspect.Width, aspect.Height);

            //expand control to the available area
            canvasView.WidthRequest = pictureFrame.Width;
            canvasView.HeightRequest = pictureFrame.Height;

            var paint = new SKPaint { FilterQuality = SKFilterQuality.High };
            paint.IsAntialias = true;
            paint.IsStroke = true;

            //load the base image
            canvas.DrawBitmap(_resourceBitmap, pictureFrame, paint);

        }
        catch (Exception ex)
        {
            string s = ex.Message;
        }

    }

As already stated, _resourceBitmap is 600px x 300px.
The SKImageInfo info object shows an initial size of 40x40.

The SKRect pictureFrame used to transform the image when loaded in the DrawBitmap() method, is scaled using the aspect object. This enlarges as does the info object as the method is called each time, thus the image is animated as it opens and is displayed. Finally, the image is actually enlarged and displayed filling the space available to it. In the Nexus5x case, final dimensions are 1200x600.

Here's the issue - if I run this in a Nexus5x emulator using API 26 Android 8.0, the OnCanvasViewPaintSurface() is called 5 times as the SKCanvasView animates up to full view. No problems, works as expected.

If I run this in a 7" Tablet or 10" Tablet emulator also running API 26 Android 8.0, the OnCanvasViewPaintSurface() is only called twice and the base image is never displayed at it's full size and certainly never fills the space available.

No idea why this is happening. Same code, same OS version, different emulators, different display results.

Any ideas?

Questions:
How can I turn OFF animation on the SKCanvasView? it ALWAYS animates on opening.
I want it to load to max available size/space and only call the OnCanvasViewPaintSurface() once and not twice or five times... OR call/invoke the OnCanvasViewPaintSurface() method as many time as needed as long as it displays the image in full.

How can I determine the max size the SKCanvasView can expand to PRIOR to loading any image? This will vary from device to device obviously.

Any advice or insights would be welcome!

Thank you.

How to create an accordion in Xamarin.Forms ListView

$
0
0

How can I create an accordion in a ListView with data binding? I am creating this app with Xamarin.Forms.

This is what I have so far:

            <ListView x:Name="List" HasUnevenRows="True" >
              <ListView.ItemTemplate>
                <DataTemplate>
                  <ViewCell>
                    <ViewCell.View>
                      <Grid Padding="10,10,10,10">
                        <Grid.RowDefinitions>
                          <RowDefinition Height="Auto"></RowDefinition>
                          <RowDefinition Height="Auto"></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                          <ColumnDefinition Width="*" />
                          <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Label Text="ABC:-" FontSize="20" TextColor="Black" Grid.Column="0" Grid.Row ="0"/>
                        <Label Text="{Binding ABC}" FontSize="20" TextColor="Black" Grid.Column="1" Grid.Row ="0" HorizontalOptions="EndAndExpand" VerticalOptions="FillAndExpand"/>
                        <Label Text="XYZ:-" FontSize="20" TextColor="Black" Grid.Column="0" Grid.Row ="1"/>
                        <Label Text="{Binding XYZ}" FontSize="20" TextColor="Black" Grid.Column="1" Grid.Row ="1" HorizontalOptions="EndAndExpand" VerticalOptions="FillAndExpand"/>
                       </Grid>
                    </ViewCell.View>
                  </ViewCell>
                </DataTemplate>
              </ListView.ItemTemplate>
            </ListView>

PanGestureRecognizer stealing input in ListView

$
0
0

Hi.

I have a listview consisting of several seperate ContentView. Each ContentView has an attached PanGestureRecognizer to detect for any swiping left of right.

This works great until the number of rows exceeds the height of the listview container, meaning the listview should start allowing the rows to be scrolled vertically.

The PanGestureRecognizer steals the input rendering the listview vertical scroll useless. In an ideal world I would be able to tell my PanGestureRecognizer that I only want to capture horizontal scrolling, which would propagate the vertical input to the ListView, but I appreciate this probably isn't possible. Looking for a valid workaround, anyone any suggestions?

Webview custom renderer gives blank screen in android and ios

$
0
0

Hi, I am trying to load a content page that contains a webview, but when i run the app in xamarin live player i only get blank screen.
I have followed a tutorial for creating a custom renderer.
How can i troubleshoot this?

App.xaml.cs:

`using System;

using Xamarin.Forms;

namespace WebViewRenderer
{
public partial class App : Application
{

    public App()
    {
        InitializeComponent();
        MainPage = new NavigationPage(new HomePage());
    }
}

}
`
HomePage.xaml.cs:

`using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace WebViewRenderer
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class HomePage : ContentPage
{
public HomePage ()
{

        //InitializeComponent();

    }
}

}`

HomePage.xaml:

    <StackLayout>
        <WebView Source="https://google.com" HeightRequest="300" WidthRequest="250" />
    </StackLayout>        

If i uncomment the InitializeComponent(); in HomePage.xaml.cs then the app crashes in xamarin live player on both android and ios.
Any suggestions?

MasterDetailPage in xamarin.forms .Net

$
0
0

So PCL is no longer an option to choose when utilizing xamarin.forms. I'm now making use of .Net xamarin.forms. I've been trying to do a side menu but the method which worked in PCL doesnt work in .NET . Upon adding the MasterDetailPage and changing it the page I want it set doesn't work either. Any help on how to accomplish this will be appreciated. Below is my code:

SideMenuPagexaml.cs
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class SideMenuPagexaml : MasterDetailPage
{
public SideMenuPagexaml()
{
InitializeComponent();
MasterPage.ListView.ItemSelected += ListView_ItemSelected;
}

        private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var item = e.SelectedItem as SideMenuPagexamlMenuItem;
            if (item == null)
                return;

            var page = (Page)Activator.CreateInstance(typeof(Profile));
            page.Title = item.Title;

            Detail = new NavigationPage(page);
            IsPresented = false;

            MasterPage.ListView.SelectedItem = null;
        }
    }

How to increase height of Progress bar custom renderer

$
0
0

Hi Guys ,
I have Created the ProgressBar Custom Renderer to show download progress and its working fine
functionally but I dont want to compromise with height of progress I used method bellow in iOS renderer which allowing me to increase height of progress bar but while the progress of progress bar increase at that time its taking by default height of progress bar .

Only first time its increasing height after progress height just GONE!
public override void LayoutSubviews()
{
base.LayoutSubviews();

        var X = 1.0f;
        var Y = 10.0f; // This changes the height

        CGAffineTransform transform = CGAffineTransform.MakeScale(X, Y);
        this.Transform = transform;
    }

Please help me ASAP I need it :)


DataTemplateSelector ListView Xamarin Forms Setup

$
0
0

https://burkharts.net/apps/blog/advanced-listview-bindings/

https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/templates/data-templates/selector

Used the previous two links as a guide.

Am trying to set up list view using a DataTemplateSelector purely in XAML (apart from the DataTemplateSelector code).
However, I am receiving the following exception with no additional information:
Fixed: Value cannot be null Parameter Name: source

Posted my code below. I have removed parts that aren't relative to the list view in an attempt to make it easier to read. Something of note, it works when I don't use the DataTemplateSelector. In the code below, in the section label Main List View, you'll see I have my DataTemplateSelector version of the list view commented out.

For this reason I know my viewcell level bindings are working correctly so I have omitted my viewcell level view and viewModel.

Main List ViewModel below

` public class AboutViewModel : BaseViewModel
{
public ImageSource ProfileImage { get; set;}
public ObservableCollection PostViewModelList { get; set; }
public AboutViewModel()
{
Title = "Profile";
ProfileImage = UriImageSource.FromUri(new Uri("https://nxtathlete-dev.s3-us-west-2.amazonaws.com/users/avatars/000/000/015/medium/download.jpg?1522613035"));
MoreCommand = new Command(() => Device.OpenUri(new Uri("https://xamarin.com/platform")));

        ListAllPostsCommand = new Command(async () => await ListLatestPosts());
        ListVideosCommand = new Command(async () => await ListLatestPosts());
        ListStatsCommand = new Command(async () => await ListLatestPosts());

        PostViewModelList = new ObservableCollection<PostViewModel>
        {
            new PostViewModel(null, ProfileImage),
            new PostViewModel(null, ProfileImage),
            new PostViewModel(null, ProfileImage),
            new PostViewModel(null, ProfileImage)
        };
    }`

Main List VIEW

`<ContentPage.BindingContext>
    <vm:AboutViewModel />
</ContentPage.BindingContext>


<!--<ContentPage.Resources>
    <ResourceDictionary>
        <DataTemplate x:Key="videoPostTemplate">
            <local:PostViewCell BindingContext = "{Binding}" />
        </DataTemplate>
        <DataTemplate x:Key="statsPostTemplate">
            <local:PostViewCell BindingContext = "{Binding}" />
        </DataTemplate>
        <local:PostTemplateSelector x:Key="postTemplateSelector" 
            VideoPostTemplate="{StaticResource videoPostTemplate}"
            StatsPostTemplate="{StaticResource statsPostTemplate}" />
    </ResourceDictionary>
</ContentPage.Resources>-->


            <StackLayout HorizontalOptions="CenterAndExpand" VerticalOptions="Center">
                <ListView ItemsSource="{Binding PostViewModelList}" HasUnevenRows="True" SeparatorColor="White">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <local:PostViewCell BindingContext = "{Binding}" />
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>

            </StackLayout>`

Data Template selector

`namespace myApp.Views
{
class PostTemplateSelector : DataTemplateSelector
{
public DataTemplate VideoPostTemplate { get; set; }
public DataTemplate StatsPostTemplate { get; set; }

    protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
    {
        var postViewModel = item as ViewModels.PostViewModel;
        return (postViewModel).Type == "video" ? VideoPostTemplate : StatsPostTemplate;
    }

}

}`

In ListView Control, Is there a way to change the color of ContextActions MenuItem(On iOS)

$
0
0

I have added 3 MenuItem to ListView.ViewCell.ContextActions.
How to set different Background colors for each MenuItem.
Is it a limitation of Forms or Should be implemented natively.

Help with new deployment issue for my Forms app - INSTALL_FAILED_DEXOPT - from xamarin studio

$
0
0

Deployment failed because of an internal error: Failure [INSTALL_FAILED_DEXOPT]

Deployment failed. Internal error.

Haven't tried iOS in a while but this is targetting android, with a xamarin forms project in Xamarin Studio updated today. I have tried XAP Emulator, and real device, both seem to do the same thing.

How to manage(hide) Back Button and Master Page in navigation while Deeplinking?

$
0
0

On HomePage of Button Update Profile, it redirects and working fine. But when I try to go to Update Profile page from any other place like DeepLink, it shows Back Button with a word Master Page. Can anybody please suggest me what I am missing here?

HomePage(Master)

<?xml version="1.0" encoding="UTF-8"?>
<local:MasterDetailPageWithLifecycle xmlns="http://xamarin.com/schemas/2014/forms" 
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
         xmlns:local="clr-namespace:MyProject;assembly=MyProject"
         x:Class="MyProject.HomePage"
         OnAppearingCommand="{Binding OnAppearingCommand}"
         Title="Master Page">
    <MasterDetailPage.Master>
        <ContentPage Title="Home page" Icon="hamburger.png">
            <ContentPage.Resources>
                <ResourceDictionary>
                    <local:MenuItemDataTemplateSelector x:Key="menuItemDataTemplateSelector" HighlitedTemplate="{StaticResource highlitedTemplate}"
                                                        NormalTemplate="{StaticResource normalTemplate}" />
                </ResourceDictionary>
            </ContentPage.Resources>
            <StackLayout BackgroundColor="{DynamicResource d8Purple}" VerticalOptions="FillAndExpand" Padding="0, 48, 0, 0">
                <StackLayout Padding="0, 40, 0, 0" Spacing="0">
                    <ListView x:Name="listView" Margin="0,9,0,0" VerticalOptions="FillAndExpand" SeparatorVisibility="None"
                              ItemSelected="OnItemSelected" ItemTemplate="{StaticResource menuItemDataTemplateSelector}" />
                    </StackLayout>
                </StackLayout>
            </StackLayout>
        </ContentPage>
    </MasterDetailPage.Master>
</local:MasterDetailPageWithLifecycle>

HomePage.cs

public HomePage()
{
    InitializeComponent();
    BindingContext =_vm = App.Locator.Home;
    NavigationPage.SetHasNavigationBar(this, false);
    _masterPageItems = new List<MasterPageItem>();
    _masterPageItems.Add(new MasterPageItem
    {
        Title = "Update Profile",
        TargetType = nameof(EditProfilePage)
    });

    listView.ItemsSource = _masterPageItems;
}

public void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
{
    var item = e.SelectedItem as MasterPageItem;
    if (item != null)
    {
        var name = item.TargetType;
        if (name == "EditProfilePage")
        {
            Detail = new MyProjectNavigationPage(new EditProfilePage());
            listView.SelectedItem = null;
            IsPresented = false;
        }
    }
}

public class MyProjectNavigationPage : NavigationPage
{
    public MyProjectNavigationPage(Page root) : base(root)
    {
        if (Device.OS == TargetPlatform.iOS)
        {
            BarTextColor = Colors.d8Grey;
            BarBackgroundColor = Color.White;
            Title = root.Title;
        }
    }
}

EditProfile XAML

<?xml version="1.0" encoding="UTF-8"?>
<local:ContentPageWithCustomBackButton
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:MyProject;assembly=MyProject"
    x:Class="MyProject.EditProfilePage"
    OnAppearingCommand="{Binding OnAppearingCommand}"
    Title="Update Profile">
  <ContentPage.Content>
    <Grid RowSpacing="0">
      //Design content
    </Grid>
  </ContentPage.Content>
</local:ContentPageWithCustomBackButton>

EditProfile CS

public EditProfilePage()
{
    InitializeComponent();
    BindingContext=_editProfileViewModel = App.Locator.EditProfile;
    _editProfileViewModel.PropertyChanged += ViewModel_PropertyChanged;
}

EditProfileDeeplink

public override void Navigate(string uri)
{
    _navigationService.NavigateTo(nameof(EditProfilePage));
}

how to consume rest api service in xamarin forms? i have one POST url how to consume it??

$
0
0

how to do post service request??

Viewing all 58056 articles
Browse latest View live


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