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

How to send data to Web API server and test it through Postman

$
0
0

Hi, I'm having a little trouble trying to send 2 variables to the server and read them
I'm still new to Xamarin so I don't know what to do exactly to make this happen
in the Web API I have this class :

public class ImageMV
{
    public string Name { get; set; }
    public HttpPostedFileBase File { get; set; }
}

and in my Xamarin app I have 2 variables :

ImageName -> contains the file path to the image
byteFile -> byte[] variable of the image

I want to send these two variable to this Url : " myUrl/api/ged/UploadFile"

I believe it will work with HttpClient but I don't know how to apply it to this case

Thank you kindly in advance


How to style images

$
0
0

Good day everyone , how do i style my images on my application to make them circular using c# not XAML

XamSvg: How do I specify SVG files in local storage to be loaded to the view?

$
0
0

Hi, I'm struggling to understand how to load SVGs into the XamSvg.XamForms.SvgImage view, whenever I attempt to load an SVG I get the image displayed "SVG not found", however I am not sure where XamSvg is looking for files. I have added the lines

            XamSvg.Setup.InitSvgLib();
            XamSvg.Shared.Config.ResourceAssembly = typeof(App).GetTypeInfo().Assembly;

to the App.xaml.cs file and put images in an images folder in the same location as App.fs then initialise a view:

let svgV = XamSvg.XamForms.SvgImage(WidthRequest = 500.) 
svgV.Svg <-  "res:images.1"

Problem with messagingCenter

$
0
0

Hello,
I've a problem using messages to drive the navigation from an async call.
I try to explain better. My problem is really simple: I've a login page. In this page I subscribe to navigate when a certain message is received:

MessagingCenter.Subscribe<ViewModelBase,string>(this, HelperClass.LOGIN_SUCCESSFULL, (sender, username) =>
            {
                ServiceLocator.Current.GetInstance<INavigationService>().NavigateTo(ViewModelLocator.CouponsPageKey, username);
            });

Then, in its viewmodel, when a user press the login button, a relaycommand is triggered to make an async call to a WCF, in this way:

 public RelayCommand LoginCommand
        {
            get
            {
                return _loginCommand
                       ?? (_loginCommand = new RelayCommand(
                           () =>
                           {
                               Loading = true;
                               HelperClass.ClientWS.LoginAsync(Username, Password);
                           }));
            }
        }

When this service has replied the handler is triggered

    void ClientWS_LoginCompleted(object sender, ValidazioneUtenteCompletedEventArgs e)
    {
        var _res = e.Result;

                if (_res)
                {
                    MessagingCenter.Send<ViewModelBase, string>(this, HelperClass.LOGIN_SUCCESSFULL, Username);
        }
    }

I can see that the message is correctly received because with the debugger the navigateTo is executed.

What's the strange?
Is that in this way I can't see my app navigate to the new page, while if inside of my LoginCommand instead to call the

HelperClass.ClientWS.LoginAsync(Username, Password);

I directly send the message the navigation occurs correctly.
What's wrong?

Thank you

Xamarin.Forms Editing photo before saving it

$
0
0

I started using MediaPlugin to make photo in my app and it's working perfectly (making photo, saving into gallery and then showing me it). But can i somehow edit it (draw on it like on canvas) before saving it to gallery ?

Unexpected fail for task "javac"

$
0
0

I have this message and the message say that i can have folder or file name long too big, but i have no folder or file name. See below the complete message:

Falha inesperada da tarefa "Javac". System.IO.PathTooLongException: O
caminho especificado, o nome do arquivo ou ambos são muito longos. O
nome de arquivo totalmente qualificado deve ter menos de 260
caracteres e o nome do diretório menos de 248 caracteres. em
System.IO.LongPathHelper.Normalize(String path, UInt32 maxPathLength,
Boolean checkInvalidCharacters, Boolean expandShortPaths) em
System.IO.Path.NewNormalizePath(String path, Int32 maxPathLength,
Boolean expandShortPaths) em System.IO.Path.NormalizePath(String
path, Boolean fullCheck, Int32 maxPathLength, Boolean
expandShortPaths) em System.IO.Path.GetFullPathInternal(String
path) em System.IO.FileInfo.Init(String fileName, Boolean
checkHost) em System.IO.FileInfo..ctor(String fileName) em
Xamarin.Android.Tasks.ZipArchiveEx.AddFiles(String folder, String
folderInArchive) em
Xamarin.Android.Tasks.ZipArchiveEx.AddDirectory(String folder, String
folderInArchive) em Xamarin.Android.Tasks.Javac.Execute() em
Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
em
Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()

It was workin. I made an update on my Visual Studio and now i cannot work fine my app.

What am i doing wrong and how can i solve this?

iOS - Button command are not fired when the keyboard of an entry/editor is open

$
0
0

Hi,
I have a contentpage with a scrollview that display an entry and a button. When I finish to write in the entry, I want to click on the button that will fire a command.
In Android, this works.
In iOS, the button is pressed (because the color is changed) but the only event that happens is the keyboard closure. I have to click a new time to send my command. The command could be fired with the return key on the keyboard but I want to keep the button.
I put my entry and my button in a stacklayout and all is working fine in iOS.
I tested several things like putting my entry and my button in a contentview in the scrollview or testing renderers but nothing. I have the same behavior with an editor.

So, why I have this behavior and how I get ride off, please?
Thanks a lot for your help!

Anaïs

Anyone know how to change placeholder text color with Xamarin Forms?

$
0
0

Does anyone know how to change placeholder text color with Xamarin Forms? I assume i'm going to have to build a custom renderer, but I haven't built one yet and wasn't sure if anyone know a good way to handle this.


how to get attachment form device in xamarin froms

$
0
0

how to get attachment form device in xamarin froms.

Toolbar items placement

$
0
0

Hello

I have some "how to do" interrogations about toolbars in my cross platform app (ios and android)

  • How to place the title at center? In Android it's on left and not displayed at all in ios
  • I already have a settings icon, but if i manage to center the title i would like to display another icon on the left of the toolbar (at same place as usual hamburger menus)

Is there a way to manage it in portable code, or i have to deal with each OS separately?

Thanks

How to Change Image Resolution,width,height in Xamrin.Forms?

$
0
0

in my project i need compress image size is possible to do in Xamarin.Forms ?

iOS 11 Accelerometer not working

$
0
0

Hi,

I'm trying to retrieve accelerometer information from a Xamarin Forms app.
It works great on iOS 10 but not on iOS 11.

Do you know if there is any issue or something different between them?

regards

Code behind for merged ResourceDictionary

$
0
0

I have a project (project 1) that defines a ResourceDictionary (it's a net standard 1.4 project).
I then have a project (project 2) that merges and adds to that ResourceDictionary.

In xaml, everything is fine. I can reference any resource simply using

{StaticResource resourceName}

and it doesn't matter which assembly it is in.

However one of my views in Project 2 is being built using code and I reference the resource with

(Color)Application.Current.Resources["resourceName"];

This works if the resource is defined in Project 2, but not if it is defined in Project 1.

Any ideas?

Fire base notification

$
0
0

Hi,

I need to implement fire base notification for xamarin forms .
Can you please send me any example code or any step by step information.

Thanks

JSON vs Database

$
0
0

hi,
Newbie here. I need to access some static data. For example, basic information about all the hospitals in the country or in a state.
I'm wondering, should I create a JSON file with all those info and add it as an embeded-resource and deserialize it during app start; or should I have a database in my server and get the info by calling API?
What would be the right approach?

I tried with the 1st approach (ie. embeded JSON file) with very small data set deserilized asynchronously ; not seems like its little slow to start up. But once its running no problem.

Any advice would be much appreciated.


On Property Change, Can't Hide or Display Grid/Label

$
0
0

I am not new to Xamarin Forms, but kind of failed to understand why the does not hide when some properties change.

My Grid:
<Grid Grid.Row="0" BackgroundColor="Red" IsVisible="{Binding IsNetworkError}" x:Name="GridA"> </Grid>

It's C# code; ...xaml.cs;

[XamlCompilation(XamlCompilationOptions.Compile)] public partial class NetworkErrorBottom { protected ViewModel net = new ViewModel(); public NetworkErrorBottom () { InitializeComponent (); GridNetworkError.IsVisible = net.IsNetworkError; } }

I have another file in ViewModel which controls the change;

public class BaseViewModel : INotifyPropertyChanged{ private bool _isNetworkError; public bool IsNetworkError { get { return _isNetworkError; } set { _isNetworkError = value; OnPropertyChanged(); } } }

Network.xaml file, which holds the GridA gets embedded into the main page, and IsVisible = False by default. I want to display GridA only if no network by setting IsReloadPreviousPage = true

Network check is done from another class

public void NetworkCheck(){ if(!Connected){ ViewModel.IsNetworkError = true; } }

Please note: GridA get displayed/hidden if IsReloadPreviousPage is hard coded inside the ViewModel.

Where I am I getting it wrong? Any Idea guys?

Thanks.

Can't see ALL the Labels inside the ViewCell

$
0
0

Hi guys,
Newbee here. I've a List view which contains 3 Labels and 1 button. After rendering, I see only the 1st Label; rest of the objects are not there.
Here is my XAML:

`
<ListView.ItemTemplate>


                                    <StackLayout VerticalOptions="FillAndExpand" 
                                                 HorizontalOptions="FillAndExpand" Orientation="Vertical">
                                        <Label Text="{Binding ContactName}" 
                                                                    Font="Bold,20"
                                                                    VerticalOptions="StartAndExpand" 
                                                                    HorizontalOptions="StartAndExpand" />
                                        <Label Text= "{Binding PhoneNumber}"
                                                                   FontAttributes="Italic"
                                                                   VerticalOptions="StartAndExpand" 
                                                                   HorizontalOptions="StartAndExpand" />
                                        <Label Text= "{Binding OpenUntil}"
                                                                   FontAttributes="Italic"
                                                                   VerticalOptions="StartAndExpand" 
                                                                   HorizontalOptions="StartAndExpand" />
                                        <Button BackgroundColor="Green" Text="Call" Clicked="OnCallClicked"
                                                                VerticalOptions="End" HorizontalOptions="End"/>
                                    </StackLayout>
                            </StackLayout>
                         </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>`

Any advice would be much appreciated.

How to implement Outlook style swipe gestures (left or right to archive or delete) in Xamarin Forms?

$
0
0

I have come to know that there is no inbuilt implementations for that. But are there any such functionalities in Native UWP that we can integrate in Xamarin Forms somehow?

How to fetch Copyright and Version Number?

$
0
0

I have an application to show App details(Version,Build and copyright info)-
so how to get Copyright Information,Version Number and Build number in code.

    public string GetVersion()
            {
                var context = Forms.Context;
                return context.PackageManager.GetPackageInfo(context.PackageName, 0).VersionName;
            }

using this code I found the version number,but how to get build number and copyright info?

List again starting from top when load more items in UWP

$
0
0

Dears,

In my xamarin forms project, I am listing 20 items initially on my ui. After reaching the bottom the next 20 items are loading. This will continue whenever reaching the bottom of the list.

My problem is on UWP; In UWP when reaching the bottom of the list the entire list gets refreshed and again starting from the top. No issues for the same feature in android project.

Is there any solution for this issue?
Thanks in advance :)

Viewing all 58056 articles
Browse latest View live


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