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

Style the Child

$
0
0

Hello,

I have the next example:

  <StackLayout Padding="16" Spacing="16">
                                    <Label Text="{Binding Title}" FontAttributes="Bold" />
                                    <BoxView Color="Gray" HeightRequest="1" />
                                    <Label Text="{Binding SubTitle}">

</StackLayout>

Like can I do so that it does not affect padding BoxView?


xamarin Error... Different day...Another error... when does the pain stop???

$
0
0

No matter what... xamarin keep coming up with new roadblock and new error... Each day it's something new...
anyone with any ideas on what is going on fro the error below?

Please note...a week ago I was some how apply to get this application to run on the IOS simulator as one day I do hope I will play able to put this application on or dev store.. one day... but each new day brings new wacky errors... I have to ask... does xamarin work???

I know some will answer yes... but I just don't understand why when you follow the guides the thing does not work... I mean seriously,... how do you doploy your app if you can't get it to run on the sim... but a few days before... it ran on the sim?? What changed??

This app runs on the Android simulator just fine... Any help would be appreciated.Thanks!

There was an unhandled exception trying to deploy and run your application. \nSystem.Exception:
The OutputPath property is not set for project 'NameOfTheApplication.iOS.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='iPhone'. This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform.

More of this error:

t Xamarin.VisualStudio.MsBuild.MsBuildService.RunTarget(IProjectNode projectNode, String msbuildTarget, IProgressReport progress, IDictionary2 globalProperties, IDictionary2 properties, Boolean runInProc) in E:\A_work\21\s\src\Core\VisualStudio\MsBuild\MsBuildService.cs:line 248
at Xamarin.VisualStudio.MsBuild.MsBuildService.RunTarget(IProjectNode projectNode, String msbuildTarget, IDictionary2 globalProperties, IDictionary2 properties, Boolean runInProc) in E:\A_work\21\s\src\Core\VisualStudio\MsBuild\MsBuildService.cs:line 211
at Xamarin.VisualStudio.IOS.MonoTouchProjectProperties.<>c__DisplayClass31_0.<b__0>d.MoveNext() in E:\A_work\21\s\src\Core\VisualStudio.IOS\PropertyProviders\MonoTouchProjectProperties.cs:line 103
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
at Merq.AsyncManager.Run(Func`1 asyncMethod) in E:\A_work\143\s\src\Async\Merq.Async.Core\Merq.Async.Core.Portable\AsyncManager.cs:line 58
at Xamarin.VisualStudio.IOS.MonoTouchProjectProperties.GetAppBundleDir(IProgressReport progress) in E:\A_work\21\s\src\Core\VisualStudio.IOS\PropertyProviders\MonoTouchProjectProperties.cs:line 99
at Xamarin.VisualStudio.IOS.MonoTouchFlavoredProject.GetRunSessionInfo(MonoTouchDevice device) in E:\A_work\21\s\src\Core\VisualStudio.IOS\ProjectSystem\MonoTouchFlavoredProject.cs:line 1250
at Xamarin.VisualStudio.IOS.MonoTouchFlavoredProject.RunApplication(MonoTouchDevice device, IProgressReport progress) in E:\A_work\21\s\src\Core\VisualStudio.IOS\ProjectSystem\MonoTouchFlavoredProject.cs:line 1199
at Xamarin.VisualStudio.IOS.MonoTouchFlavoredProject.DebugLaunch(__VSDBGLAUNCHFLAGS grfLaunch, IProgressReport progress) in E:\A_work\21\s\src\Core\VisualStudio.IOS\ProjectSystem\MonoTouchFlavoredProject.cs:line 1066
at Xamarin.VisualStudio.IOS.MonoTouchFlavoredProject.DebugLaunch(__VSDBGLAUNCHFLAGS grfLaunch) in E:\A_work\21\s\src\Core\VisualStudio.IOS\ProjectSystem\MonoTouchFlavoredProject.cs:line 973

How can I use SetBinding to bind to a label inside a listview that's being created programatically?

$
0
0

Sorry if the question's a bit convoluted! This has me stumped at the moment: I have a ListView and I'm creating the DataTemplate programatically to be able to make it responsive. My ListView's ItemSource is a list called "Recipes" made up of "Recipe" objects.
How can I create a label in codebehind and bind its text property to, say, Recipe.Title? Here's my current code and what I'd like it to do:

                    private void GenerateTitleLabel(Grid grid)
                    {
                        Grid.SetColumn(grid, 1);
                        grid.Margin = 1;
                        grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(2, GridUnitType.Star) });
                        grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(4, GridUnitType.Star) });
                        grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(2, GridUnitType.Star) });
                        grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(2, GridUnitType.Star) });
                        Label title = new Label
                        {
                            Style = Application.Current.Resources["styleLabelTitle"] as Style,
                        };

                        //Here I'd set the binding to the Title attribute in my Recipe class
                        title.SetBinding(???);

                        Grid.SetRow(title, 1);
                    }

That's it. If anything's unclear, let me know!

X.Forms Android Button OnPress Visual Bug

$
0
0

Hey guys,

I'm really frustrated and require some help from you. I'm not really new at Xamarin, but some things won't get in my brain. Maybe I haven't understood the entire logic so far.

But, my problem is: I've been adding a Button to the content page and all were working fine. So, I had to change the background color and now it's messed up! When I click the button, it shows WHILE the press event is invoked, a small visible rectangle with the 0.25 scale of the entire button on the top left of the button.

Can someone help me? I've made a screenshot WHILE PRESSING THE BUTTON here:

Note: BEFORE changing the background color, all has been working fine. AFTER setting the background color, the color gets changed well and is correct but the PRESS/CLICK/ACTIVE state of the button shows a small - unrequired - rectangle on the top left of the button.

Thankful for every answer.

Kind regards,
Dominik G.

How to use Google Drive in Xamarin Forms?

$
0
0

Hi!
1. As the title, How to use Google Drive in Xamarin Forms?
I have found this link but it use CustomRenderer.

  1. How many way to use Google Drive in Xamarin Formns?
  2. How to use it directly in PCL (NET Standard)?

Thank you!

How to change the selection color of an item in a list view?

How to Record voice call in xamarin forms ?

$
0
0

I'm wondering if there is any way to record voice call in xamarin forms ? , I want to make my app has this permission in android and ios anyway for that ?

Object reference not set to an instance of an object when using css styling with xamarin forms

$
0
0

I tried to set style to my page using css but i got this exception

Object reference not set to an instance of an object

MainPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="XRetailMobile.Views.MainPage" 
             xmlns:local="clr-namespace:XRetailMobile.Views.ContentViews"
             NavigationPage.HasNavigationBar="False">
    <ContentPage.Resources>
        <StyleSheet Source="/Styles/style.css"/>
    </ContentPage.Resources>
    <ContentPage.Content>
        <Grid HorizontalOptions="Fill" VerticalOptions="Fill">           
            <local:ProductBackToolbar StyleClass="toolbarStyle" VerticalOptions="Start">
            </local:ProductBackToolbar>

        </Grid>
    </ContentPage.Content>

</ContentPage>

ProductBackToolbar.xaml(contentview)

<ContentView.Content>
    <StackLayout HorizontalOptions="Fill" Orientation="Horizontal">
        <Image Source="back" HeightRequest="35" VerticalOptions="Center" WidthRequest="35" HorizontalOptions="StartAndExpand"></Image>
        <Image Source="share" HeightRequest="35" VerticalOptions="Center" WidthRequest="35" HorizontalOptions="End"></Image>
        <Image Source="shoppingbag" HeightRequest="35" WidthRequest="35" VerticalOptions="Center" HorizontalOptions="End"></Image>
    </StackLayout>
</ContentView.Content>

style.css Located in Style Folder and its build action is EmbeddedResources

^contentpage {
    background-color: greenyellow;
}
.toolbarStyle {
    background-color: blue;
    margin: 20px;
    padding:20px;
}

what's the wrong ?


How to change the selection color of an item in a list view?

$
0
0

Please anyone can provide me solution for it.

Xamarin.plugin.media 4.0.1.5 when updated throws runtime exception

$
0
0

The target SDK Version is set to 28. Have updated my xamarin.plugin.media to 4.0.1.5.It throws runtime exception.

VS Community Edition 15.8 Xamarin.android - 9.0.0.17

Can anyone please advice?

Exeption error:

Unhandled Exception: Java.Lang.RuntimeException: Unable to start activity ComponentInfo{com.psav.lighthouseuat/md53bdc6881122b82bfd2b961d262dd095c.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.ContentFrameLayout.setAttachListener(android.support.v7.widget.ContentFrameLayout$OnAttachListener)' on a null object reference

Below are the files where the code is added upon updating the plugin.media to latest version.

1) AndroidManifest.xml

2) MainActivity.cs


4) Assemblyinfo.cs

5) Added new folder called xml into Resources folder and added a new XML file called file_paths.xml

6) Packages.config


audio controls on the lock screen

$
0
0

how do I show the audio controls on the lock screen and when I press the power button on ios and android, this in Xamarin Forms.

Is it possible to detect left swipe multi-touch with “two fingers” on Xamarin.Forms?

Deploying HttpClient - NameResolutionFailure - only on iOS device

$
0
0

Hi All,

I'm having an issue with httpClient, but only on my iOS device (I've not checked Android but I'm not targeting it), it works well in the emulator.

When my app loads the ViewModels do a API call to try and get data from my server and I almost immediately get a System.Net.WebException: Error: NameResolutionFailure crash. I don't get this in the iOS emulator for the same API call.

I tried calling https://jsonplaceholder.typicode.com/posts which I know works and rules out anything idiosyncratic bugs in my code but it still fails.

Is there anything special I need to do enable internet access on an iOS device? Could I have set up something wrong in my provisioning profile in the Apple Account?

Thanks in advance

NavigationPage without menu

$
0
0

Hi,

Could you suggest me why this code produces a page with menu?

public App()
{
var mainPage = new NavigationPage(new NotesListPage());
NavigationPage.SetHasNavigationBar(mainPage, false);
MainPage = mainPage;
}

Thank you in advance

TimeZone With UTC format

$
0
0

Hi,
i have to list out all the timezones like (UTC-12:00) International Date Line West......in PCL.

i can able to do with TimeZoneInfo.GetSystemTimeZones(). but this not displays UTC with name ... please help me to do this..


listview keyboard scroll on android app and xamarin.forms

$
0
0

hi

when i create new basic android app via xmarin and create listview with items in it i can automatically scroll the items via bluetooth keyboard
but when i create the same under xamarin.forms app i am not able to scroll using the bluetooth keyboard

is it a bug? i have to code it?

please advice i really stuck here

thanks.

How to detect text and search a location over mapview?

$
0
0

I added mapview using xamarin.forms.maps package. I wanted to add a searchbar field to search address and drop pin using search box.

How to add a SearchBar programmatically a search a location?

I tried the following:

var searchField = new SearchBar
{
Placeholder = "Enter search term"
};
searchField.SearchCommand = new Command(() => { if (searchField != null) { string.Format("Result: {0} is what you asked for.", searchField.Text); }
** // I don't get the text here**

Content = new StackLayout
{
Spacing = 0,
Children = {
searchField,
map,
buttons
}
};

Xaml set property conditionally

$
0
0

I have the following XAML:

<ffimg:CachedImage HeightRequest="400" WidthRequest="400" Source="{Binding ImageUrl}">
    <fffimg::CachedImage.Transformations>
        <fftransformations:CircleTransformation/>
    </ffimg::CachedImage.Transformations>
</ffimg::CachedImage>

I would like to set the <fftransformations:CircleTransformation/> only if : {Binding IsRoundImage}. Is it possible to do this directly in XAML? I have tried DataTriggers but it doesn't work.

Issue while opening Xamarin form from BroadcastReciever class

$
0
0

This is for tracking incoming and outgoing phone calls. I am pushing a Xamarin form in the application Navigation stack from BroadcastReciever class using following code:

var phoneAddPage = new SomePage();
Xamarin.Forms.Application.Current.MainPage = new NavigationPage(phoneAddPage);

The page is getting pushed properly as expected. Issue is the page is overlapped by Splash Screen when application is opened. The form is functioning properly, overlap is the only issue.

Animation on xamarin forms using Lottie dont work!

$
0
0

Hi,
anyone use the Lottie nugget to play animations on xamarin forms.
I tested a simple example that dont run, just appear on android emulator a blank window.

I install the Lottie nugets.

Here is my xaml page:

<?xml version="1.0" encoding="utf-8" ?>

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"

         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

         xmlns:forms="clr-namespace:Lottie.Forms;assembly=Lottie.Forms"

         x:Class="Example.Forms.MainPage">

    <forms:AnimationView 

            x:Name="AnimationView"

            Animation="LottieLogo1.json"

            Loop="True"

            AutoPlay="True"

            VerticalOptions="FillAndExpand"

            HorizontalOptions="FillAndExpand" />

I put the file "LottieLogo1.json" on Resources folder of the Droid Project.

Thanks

Viewing all 91519 articles
Browse latest View live


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