Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

Is possible to align image on the left in the barnavigation?

$
0
0

I did this

<ContentPage.ToolbarItems>
        <ToolbarItem Name="icoImage" Order="Primary" Icon="person.png" Priority="0" />
    </ContentPage.ToolbarItems>

i have this

see that person.png is alignment on the right and how can i do to align on the left?


Mix Xamarin.Forms pages with native screens

$
0
0

Can a Xamarin.Forms project (e.g. Xamarin.Forms Portable) be mixed with native View Controllers/Activities? How is that done?

Normally you init the Forms and load the application (e.g. AppDelegate/MainActivity). But isn't the whole project only Xamarin.Forms then? How do you navigate between pages and view controller for example?

SOAP Action parameter is missing

$
0
0

I'm trying to consume a web service that uses Soap 1.2.

Added the WSDL reference and using VS-generated proxy class:

var client = new MyApp.Droid.MyWS.AuthService();
var response = client.InitSession();

From generated Reference.cs:

[System.Web.Services.WebServiceBindingAttribute(Name="AuthService", Namespace="link-to-namespace")]
public partial class AuthService : SoapHttpClientProtocol

    public AuthService()
    {
        SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap12;
        ...
    }

    [SoapDocumentMethod("link-to-action", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Bare)]
    public SResponse InitSession(InitSessionRequest request)
    {
        ...

My request fails because the action parameter is not included in the HTTP header:

Content-Type: application/soap+xml; charset=utf-8

Required header:

Content-Type: application/soap+xml; charset=utf-8; action="link-to-action"

Meanwhile, the same code works successfully in ASP.NET Web Forms.

Is there maybe a mistake with Mono's implementation of SoapHttpClientProtocol or its parent classes?

Ask permission for receiving SMS

$
0
0

I have a Xamarin.Android project with MVVMCross.

I need to receive SMS. But at first, I should create the request for the user and show popup window for the confirmation.

So, at first, I add the permissions in AndroidManifest:

<uses-permission android:name="android.permission.RECEIVE_SMS" />

But I need to make a popup window that should be shown after user clicks "Next" button during the registration.

Can I do it without any plugins?

I tried to use two plugins:

  • PermissionsPlugin
  • ACR User Dialogs

So, I can show two examples of the code.
Here is the ViewModel.cs part that works. When the user types his number and clicks the button, the user's smartphone receives the SMS:

using MvvmCross.Core.Navigation;
using MvvmCross.Core.ViewModels;
using System.Collections.Generic;
using TMy.project.Core.Models;
using System.Windows.Input;
using My.project.Core.Services;

...

public RegistrationViewModel(IMvxNavigationService navigationService)
{
   _navigationService = navigationService;

   RegisterCommand = new MvxAsyncCommand(async () => {
        RegistrationService.SendCode(PhoneNumber);
        await _navigationService.Navigate<VerificationViewModel>();
    });
}

public IMvxAsyncCommand RegisterCommand { get; private set; }

But I need to add the popup window. So I changed this code:

using MvvmCross.Core.Navigation;
using MvvmCross.Core.ViewModels;
using System.Collections.Generic;
using My.project.Core.Models;
using System.Windows.Input;
using My.project.Core.Services;
using Plugin.Permissions;
using Plugin.Permissions.Abstractions;
using Acr.UserDialogs;

public RegistrationViewModel(IMvxNavigationService navigationService)
    {
    _navigationService = navigationService;

    RegisterCommand = new MvxAsyncCommand(async () =>

       {
           var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Sms);
           if (status != PermissionStatus.Granted)
           {
               if (await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Permission.Sms))
               {
                   var result = await UserDialogs.Instance.ConfirmAsync(new ConfirmConfig
                   {
                       Message = "Do you allow the application read your SMS?",
                       OkText = "Yes",
                       CancelText = "No"
                   });
                   if (result)
                   {
                       var results = await CrossPermissions.Current.RequestPermissionsAsync(Permission.Sms);
                   }

               }

               if (status == PermissionStatus.Granted)
               {
                   PhoneNumber = SelectedCountryCode.Name + UserNumber;
                   RegistrationService.SendCode(PhoneNumber);
                   await _navigationService.Navigate<VerificationViewModel>();
               }
           }
       });
} 

public IMvxAsyncCommand RegisterCommand { get; private set; }

The build is still successful, there are no underlines in the code, but it doesn't work.
I don't see the popup window and moreover, the phone doesn't receive the SMS! So the older code is broken.

What's wrong?
Maybe there is an easier way to show the user dialog with yes/no buttons and give the permissions?

Problem With EF Core.

$
0
0

Hi, I using ms Visual studio 2017 and Xamarin.Forms with .Net Standard Strategy, it works Well and it Deploy On My Phone(Samsung SMA7 2017) Android Version 7.0, but it Won't Run Exactly When I Add EF Core And EF Core sqlite Nugets, When I Want to Run Program On My Phone It Will Debugged And Deployed but it will Exit Debbuging Before The Page Gets Loaded

Check for Updates within App

$
0
0

I am currently converting our app from Xcode and Swift to VS and Xamarin and need the ability to check within the app for updates. Previously I used a CocoaPod called iVersion that would check our server for an update and install if a different version. Is there something within Xamarin that can do the same thing? Due to the app not being available for general use but only internal use, it is an Ad-Hoc app that will be installed from a specific URL. The app will not be available via the respective app stores.

Guidelines required on Xamarin time profiler

$
0
0

Hi, I tried Xamarin time profiler for profiling a xamarin android application. But the results seem to be weird. I profiled the following code snippet.
void TestMethod()
{
//Stopwatch stopwatch = new Stopwatch();
//stopwatch.Start();
for (int i = 0; i < 5; i++)
{
Thread.Sleep(2000);
}
//stopwatch.Stop();
//Console.WriteLine("Time for testmethod(): " + stopwatch.ElapsedMilliseconds);
}

The stopwatch.ElapsedMilliseconds outputs "10002ms" but when I check it in xamarin profiler it displays "4.90s". Why is this difference? What exactly xamarin profiler is capturing?

Instead of using Thread.Sleep, I even tried following code snippet. Still there is a huge difference between what I could see in profiler and the output from stopwatch.ElapsedMilliseconds.

void TestMethod()
    {
        //Stopwatch stopwatch = new Stopwatch();
        //stopwatch.Start();
        for (int i = 0; i < 1000000; i++)
        {
            Console.WriteLine("Test output");
        }
        //stopwatch.Stop();
        //Console.WriteLine("Time for testmethod(): " + stopwatch.ElapsedMilliseconds);
    }

Note: I'm using xamarin profiler beta version 1.6.1.483. Also tried stable version 1.6.0.27. Result was not what I expected.

Solved - Is there .NET Standard support for Xamarin Forms into VS for MAC?

$
0
0

Is there .NET Standard support for Xamarin Forms into VS for MAC?
I find PCL and Shared.


After Selecting Listview App is Crashed

$
0
0

Select Item After Adding List Item, then App is Chrashed
What can i do plz help




Code Behind
List ss;
public AddMenuPage()
{
InitializeComponent();
ss =new List() { "one", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" };
SelectionListView.ItemsSource = ss;
}

    private void Button_Clicked(object sender, EventArgs e)
    {
        ss.Add("Ten");     
        SelectionListView.ItemsSource = ss;
    }

The ComputeBundleResourceOutputPaths task was not given a value for the required parameter BundleIde

$
0
0

Sorry for my English, I know he's no good. I would like your help in solving this problem that is occurring every time I create a new project.

Here is the result: The ComputeBundleResourceOutputPaths task was not given a value for the required parameter BundleIdentifier.

Unable to open storyboard file in Visual studio 2017

$
0
0

Hi I am opening .storyboard file in Visual Studio 2017(Connected to MAC machine via notwork). Storyboard file not opening and showing message in log
The iOS designer can only open layout files in an open project, because it requires access to project's resource files. \n\n File D:\MyData\iPhoneSplashScreen\iPhoneSplashScreen\ViewController1.storyboard does not appear to be in an open project.
How can I open storyboard file
Please see attached screenshot

Problem TapGestureRecognizer in cell listView android

$
0
0

Hi,
i've a problem with android devices and tapgesture for the items inside the cells
I have a code like this:
`<ViewCell.View>

<Grid BackgroundColor="White">
    <Grid.Padding>
        <OnPlatform x:TypeArguments="Thickness" iOS="0,0,0,0" Android="0,0,0,0" WinPhone="10,5,10,5" />
    </Grid.Padding>
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="50" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="50" />
    </Grid.ColumnDefinitions>
    <Image Margin="10,0,0,0" Source="{Binding Converter={StaticResource DocumentImageConverter}}" Grid.Column="0" />
    <Grid Grid.Column="1" Padding="16,8,16,8">
        <StackLayout VerticalOptions="CenterAndExpand" HeightRequest="60">
            <Label Margin="0,0,0,0" Text="{Binding Nome}" Grid.Row="0" Style="{StaticResource TextDocumentCell}" />
            <Label Margin="0,0,0,0" Text="{Binding Converter={StaticResource DocumentDescriptionConverter}}" Grid.Row="1" Style="{StaticResource SubDocumentTextStyle}" />
        </StackLayout>
    </Grid>
    <Grid Grid.Column="2" Margin="0,2,0,2" Padding="0,5" IsVisible="{Binding Formato, Converter={StaticResource DocumentActionConverter}}">
        <Image Source="ic_more" HorizontalOptions="CenterAndExpand"></Image>
        <Grid.GestureRecognizers>
            <TapGestureRecognizer Command="{Binding Path=BindingContext.OnActionDocumentCommand, Source={x:Reference Name=Documenti}}" CommandParameter="{Binding .}" />
        </Grid.GestureRecognizers>
    </Grid>
</Grid>

</ViewCell.View>`

If i tap when the list appears nothing happens, but if i scroll the list and i tap that area the gesture will fire!
I've also try including a button transparent or using inputtrasparent="true" but no success.
Is it a bug of xamarin forms?
In iOS everything works fine
Thanks

Break on Exceptions settings?

$
0
0

Where did they go?
I can no longer find where to toggle break on exceptions on or off

Telerik UI for Xamarin ,Some Controls are not Working

$
0
0

In telerik ui for xamarin ,i have added all the binaries both in portable and android projects,I have also added the Skiasharp.views.forms nuget package,but i am not able to use some controls that requires skiasharp,other controls are working properly,when i use a skia sharp rendered control like BusyIndicator or Datagrid ,the app enters into a break mode,Please Give me a Solution ASAP,Thank You.

Xamarin Forms Telerik RadListView not poplutaing data

$
0
0

I am facing this issue , i have tried many things.

<telerikDataControls:RadListView.ItemTemplate>


<telerikListView:ListViewTemplateCell.View>

public class HomeViewModel : ViewModelBase
{

    private List<Activity> _activities;


    private INavigationService _navigationService;

    private IActivitiesService _activitiesService;



    public HomeViewModel(INavigationService navigationService, IActivitiesService activitiesService)
    {

        _navigationService = navigationService;
        _activitiesService = activitiesService;

    }



    public List<Activity> Activities
    {
        get { return _activities; }
        set
        {
            _activities = value;
            OnPropertyChanged();
        }
    }



    public override Task InitializeAsync(object navigationData)
    {

        this.Activities = _activitiesService.GetActivities();
        return base.InitializeAsync(navigationData);
    }


}

But this is working


<ListView.ItemTemplate>



</ListView.ItemTemplate>


TypeLoadException using telerik

$
0
0

Hello iam using telerik controls in a cross platform project,any telerik object i put into my xaml code i get a TypeLoadException at the 'gauge1 =' line in the MainPage.xaml.g.cs file.Is it not referencing the right libraries,i have all the telerik libraries referenced in the ios,and android projects.Were should i start?Thanks

`[global::Xamarin.Forms.Xaml.XamlFilePathAttribute("C:\Users\ty\Source\repos\App2\App2\App2\Page1.xaml")]
public partial class Page1 : global::Xamarin.Forms.ContentPage {

    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Forms.Build.Tasks.XamlG", "0.0.0.0")]
    private global::Telerik.XamarinForms.DataVisualization.Gauges.RadRadialGauge gauge1;

    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Forms.Build.Tasks.XamlG", "0.0.0.0")]
    private void InitializeComponent() {
        global::Xamarin.Forms.Xaml.Extensions.LoadFromXaml(this, typeof(Page1));
        gauge1 = global::Xamarin.Forms.NameScopeExtensions.FindByName<global::Telerik.XamarinForms.DataVisualization.Gauges.RadRadialGauge>(this, "gauge1");
    }
}`

Can we change the position of "displayactionsheet" in xamarin forms

$
0
0

It is showing in the middle of the screen.

Expandable Listview

$
0
0

there are several views in my general layout, my listview is in the middle, what properties does it need to have in order to be able to show all it's contents when I add a new data to it. tried creating it first but for some reason, the data it shows depends on its height. how can I make it that the listview automatically adjust depending on the data inside? by the way below the listview is a textview.

Load ContentView Content From Binding

$
0
0

As outlined by ClintStLaurent, Here in the 30th post;
forums.xamarin.com/discussion/85773/how-to-create-a-static-header

(Add Http: as I can't post links)

It's possible to have a persistent navigation header and only change the displayed ContentView.

I have tried to get this to work, I understand that I need to handle the binding and then on the button press change event, change the content view being displayed.

I am sadly, to date, unable to get it to work, I can post My code, I have so far, if required, but i will put a copy of ClintStLaurent code below (all credit to him)

Any help is appreciated.

ClintStLaurent Code (all credit to him, had to remove the two Http lines from the code, as i cant post links)

`<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="App1.MainPage"

         xmlns:local="clr-namespace:App1"
         x:Name="this"
         BindingContext="{x:Reference this}">

<Grid HorizontalOptions="FillAndExpand"
      VerticalOptions="FillAndExpand">
    <Grid.RowDefinitions>
        <RowDefinition Height="40" />
        <RowDefinition Height="*" />
        <RowDefinition Height="24" />
    </Grid.RowDefinitions>

    <Grid Grid.Row="0"
          HorizontalOptions="FillAndExpand"
          BackgroundColor="Maroon">
        <!--  Basic Header  -->
        <Button HorizontalOptions="Center"
                Clicked="Button_OnClicked"
                Text="Switch" />
    </Grid>

    <Grid Grid.Row="2"
          HorizontalOptions="FillAndExpand"
          BackgroundColor="Blue">
        <!--  Dummy Footer  -->
    </Grid>



    <ContentView Grid.Row="1"
                 HorizontalOptions="Center"
                 VerticalOptions="Center"
                 Content="{Binding BoundView}" />

</Grid>

`

Xamarin.Mac signal handling

$
0
0

Hi,

I'd like to manage Signals, so the application does not just crash and leave users in the dark. I've been looking at PLCrashReporter which seems to do what I'd want, with one issue. As pointed here, that prevents NullReferenceExceptions from being correctly handled (and other for what I've tested).

So I've followed the instruction and wrapped my EnableCrashReporter with Mono.Runtime.RemoveSignalHandlers and Mono.Runtime.InstallSignalHandlers. Which restore the wanted behavior (NullReferenceException now being handled). But PLCrashReporter does not appear to catch anything, at all. It's not just the signal that mono handles, it's even those that do end in a crash regardless, even if I raise a SIGSEGV in manage code myself or trigger a SIGFPE in native code.

I have to be frank and admit that I'm far from experience when it come to signal handling, so I might be missing something. But looking at this quote:

Since Mono’s signal handlers are reinstalled and not restored, Mono will now chain to the signal handlers installed by EnableCrashReporting.

I'd have though that when registering it's own signal handler, Mono would keep the previously installed one (in this case PLCrashReporter one) and call it when it sees nothing to do with the signal. Which is also what this line seems to suggest:

[...], because Mono will chain to the previous handler if it detects that a SIGSEGV occurred in native code, and the existing signal handlers when Mono installed its signal handlers would be the default signal handlers for the platform.

Any idea?

Viewing all 204402 articles
Browse latest View live


Latest Images

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