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

Image file not found in PCL project

$
0
0

Hi,

We have a PCL project and unable to load image using image tag in XAML.

Xamarin Version: 2.5.1.527436

Image Tag <Image Source="logo.jpg" Aspect="AspectFit" MinimumHeightRequest="50"/>

The image file is added to 'Resources/Drawable/' folder as logo.jpg. The Build settings is 'AndroidResource'

The following line is found in logs.

FileImageSourceHandler: Could not find image or image file was invalid: File: logo.jpg


BindingContext not working after Xamarin update

$
0
0

It's probably my fault but I can't figure out what the problem is. I have an app with a collapsable listview and I have a button in a row which can be clicked to decollapse the row. This worked great with the same code I have now, but now it gives me an error: Xamarin.Forms.Xaml.XamlParseException Position 77:37. Can not find the object referenced by 'PredictView'

The button is in a groupheader template, the binding to other items works.

In the PredictView.xaml file:
<ContentPage.BindingContext> <local:PredictViewModel /> </ContentPage.BindingContext>

Line 77(error line) of the same file:
<Button Image="{Binding StateIcon}" CommandParameter="{Binding .}" Command="{Binding BindingContext.ExpandCommand, Source={x:Reference Name=PredictView}}" HorizontalOptions="EndAndExpand" VerticalOptions="Center" Margin="0, 0, 12, 0" Style="{StaticResource buttonTransparent}"/>

How to integrate apply pay and Google pay in Xamarin Forms

$
0
0

Is there any way to implement apply pay in xamarin forms application. I know it can be done by dependency injection but if anyone has code then please share...

Button Text Getting Cutoff in AbsoluteLayout!Help please

$
0
0

        <BoxView BackgroundColor = "#f7f7f7"
                     AbsoluteLayout.LayoutBounds="0,0,1,0.33" AbsoluteLayout.LayoutFlags="All"></BoxView>
        <StackLayout HorizontalOptions="Center" VerticalOptions="Center" AbsoluteLayout.LayoutBounds="0,0,1,0.33" AbsoluteLayout.LayoutFlags="All">
            <Label Text="$11.95"

                   TextColor = "#33353a"
                   HorizontalOptions="Center"
                   FontSize = "60"
                   FontAttributes = "Bold">

            </Label>
            <Button
                HorizontalOptions="Center"
                Text="Add $7.99 Credit"
                BackgroundColor = "#1695A3"
                BorderRadius="15"
                HeightRequest="30"
                FontSize="15"
                FontAttributes="Bold">

            </Button>


        </StackLayout>

    <StackLayout Padding="30, 10"
                 Spacing="20"
                 VerticalOptions="Center"
                 HorizontalOptions="Center"
                 AbsoluteLayout.LayoutBounds="0, 0.5, 1, 0.33"
                 AbsoluteLayout.LayoutFlags="All">
        <Label Text="Why pay for credit?" 
               TextColor="Black"
               HorizontalOptions="Center" 
               FontAttributes="Bold" 
               FontSize="15" />
        <Label HorizontalTextAlignment="Center" 
               FontSize="13">
            Because you can reach people who aren't on

SkyApp by calling mobile and landline
numbers, or spending SMS, at low-cost rates.


Can I combine the creation of an element and adding a new element together in Xamarin.Forms?

$
0
0

I have this code:

var layout = new StackLayout
{
Orientation = StackOrientation.Vertical,
Spacing = 0
};
layout.Children.Add(new HeaderTemplate
{
Header = Settings.cc.LongText().ToUpper()
});

Can these two statements be combined in some way?

I want to increase the size of my FontAwesome icons

$
0
0

I am currently testing on Android.
I want to put a FA icon in my button but when it appears it is far too small. So I try to set a FontSize style, but this does not make any difference. What am I doing wrong here?

 <?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:controls="clr-namespace:XamForms.Controls;assembly=XamForms.Controls.Calendar"
             xmlns:Control="clr-namespace:Xamstrap;assembly=Xamstrap"
             xmlns:Attached="clr-namespace:Xamstrap.AttachedProperties;assembly=Xamstrap"
             xmlns:c="clr-namespace:Sir.Mobile.CustomRenderers"
             xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
             prism:ViewModelLocator.AutowireViewModel="True"
             x:Class="Sir.Mobile.Views.InspectionDate"
             ControlTemplate="{StaticResource MainHeader}"
             Title="Inspection Date">
    <ContentPage.Resources>
        <OnPlatform x:Key="FontAwesomeString" x:TypeArguments="x:String">
            <On Platform="iOS" Value="FontAwesome" />
            <On Platform="Android" Value="FontAwesome.ttf#FontAwesome" />
            <On Platform="UWP, WinRT, WinPhone" Value="Assets/Fonts/FontAwesome.ttf#FontAwesome" />
        </OnPlatform>
        <Style x:Key="FontAwesome" TargetType="Button">
            <Setter Property="FontFamily" Value="{StaticResource FontAwesomeString}" />
            <Setter Property="FontSize" Value="50" />
        </Style>
        <!-- Can now use style sheets, see https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/styles/css/index -->
        <StyleSheet Source="/Assets/Site.css" />
    </ContentPage.Resources>
    <ContentPage.Content>
        <StackLayout Orientation="Vertical"  HorizontalOptions="StartAndExpand">
            <Label Text="{Binding HeaderTitle3}" StyleClass="headerText"  Margin="0, 0, 0, 0"></Label>
            <StackLayout Orientation="Horizontal">
                <StackLayout>
                    <controls:Calendar  SelectedDate="{Binding DateOfVisit, Mode=TwoWay}"
                                    HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand"
                                    x:Name="calendar" DateCommand="{Binding DateOfVisitCommand}" />
                </StackLayout>
                <StackLayout>
                    <Button Command="{Binding OnDateOfVisitCommand}" Style="{Binding FontAwesome}"
                        Text="&#xF060;"  Attached:ResponsiveProperty.Class="btn-sm btn-primary" ></Button>
                </StackLayout>
            </StackLayout>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

How to keep copy-paste and scroll for editor inside scrollview (Xamarin Forms for Android)?

$
0
0

Hi everyone,

I am struggling with Editor for Android, using Xamarin.Forms v3.1.0.697729. If I test with editor as single item inside a stack layout (without scrollview), it is possible to both do a copy and paste of the text, and scroll. After adding scrollview, the scroll inside editor stops working, but copy-paste still works. To fix that, I implemented a custom renderer for Android with DroidTouchListener, as suggested in topic "Editor inside Scrollview not scrolling" from this forum. Now scrolling is working, and long-press to paste is working, but not long-press to copy text. So it seems that I have to choose between having fully functional copy-paste, or to have only paste but with functional scroll.

Does anyone have a workaround for this issue?

Run App on externally installled ios simulator

$
0
0

I am doing an xamarin forms app. The inbuilt ios simulator in visual studio15.7.6 runs very slowly. The connected mac has only 4Gb Ram. Can i speed up the performance by running code on externally installed ios simulator on windows10 ? I have downloaded and installed a custom ios simulator but not showing in the connected devices list ?


Is it possible to define height and width in percentage in Xamarin forms?

$
0
0

How we can define height and width in percentage in Xamarin forms so that it can support different screens?

using scrollview with grid

$
0
0

how can use scrollview for this code?

<StackLayout>
    <RelativeLayout>
        <Grid BackgroundColor="White" RowSpacing="1" >
            <Grid.RowDefinitions>
                <RowDefinition Height="7*" />
                <RowDefinition Height="3*" />
                <RowDefinition Height="3*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="2*" />
                <ColumnDefinition Width="1*" />

            </Grid.ColumnDefinitions>

            <Grid Grid.Column="0" Grid.Row="0" RowSpacing="1"  >
                <imb:ImageButton  Source="@Resources/" />
            </Grid>
            <Grid Grid.Column="1" Grid.Row="0"  RowSpacing="1" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="2*" />
                    <RowDefinition Height="2*" />

                </Grid.RowDefinitions>
                <imb:ImageButton   Grid.Row="0" 
                   Source="@Resources/u.jpg"       />
                <imb:ImageButton  Grid.Row="1" 
                                  Source="@Resources/u.jpg" />

            </Grid>
            <Grid Grid.Row="1" Grid.Column="0" RowSpacing="1"   >
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                </Grid.RowDefinitions>

                <imb:ImageButton   BackgroundColor="Gold"  Grid.Row="0" />
                <imb:ImageButton   BackgroundColor="Gainsboro"  Grid.Row="1"  />
            </Grid>
            <Grid Grid.Row="1" Grid.Column="1" RowSpacing="1" >

                <imb:ImageButton  BackgroundColor="Aqua" />

            </Grid>
            <Grid Grid.Row="2" Grid.Column="0" RowSpacing="1" >

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="1*"/>
                </Grid.ColumnDefinitions>
                <imb:ImageButton    Grid.Column="0"  BackgroundColor="BlueViolet"  />

                <imb:ImageButton    BackgroundColor="AliceBlue"  />
            </Grid>
            <Grid Grid.Row="2" Grid.Column="1" RowSpacing="1" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="1*" />
                </Grid.RowDefinitions>
                <imb:ImageButton  BackgroundColor="Beige"  Grid.Row="0" />
                <imb:ImageButton  BackgroundColor="Bisque"  Grid.Row="1" />
            </Grid>
        </Grid>
    </RelativeLayout>

    <RelativeLayout  >
        <Grid  RowSpacing="1" >
            <Grid.RowDefinitions>
                <RowDefinition Height="1*" />
            </Grid.RowDefinitions>
            <imb:ImageButton Grid.Row="0" BackgroundColor="Orange" />
        </Grid>
    </RelativeLayout>

</StackLayout>

How to provide instruction when open the app in xamarin.forms?

$
0
0

I want to provide instruction of the user that how user can use the app.but i did not found any method for instruction.if any one have any method to define instruction when user open the app first time please suggest me for this.i found showcase in android.is there any method in Xamarin forms.

How to remove default underline from the Entry Tag ?

$
0
0

I am using the Entry tag for taking the entry from User.
so, there is a Default Underline in the Entry.

I tried Removing the Line by giving transparent color to the colorAccent in Styles.xml but, it removes the line at the time of writing.

Please help in removing the default Line from the Entry Tag.

Permission Denial: not allowed to send broadcast android.location.GPS_ENABLED_CHANGE

$
0
0

This code is not working for Turn on Location

Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE");
                intent.PutExtra("enabled", true);
                SendBroadcast(intent);

How to save and retrieve Image from Sqlite ?

$
0
0

I used this code to get Image from Gallery

but now I don't know how to save it to sqlite database and retrieve it ???
Any solution ?

How To Get Clear Key Pressed Event From Keyboard in Entry Xamarin Forms

$
0
0

i Have a Entry Control, i want to Identify When the clear(<-) button pressed,How can i identify this in viewmodel or CodeBehind


Xamarin Live Reload Previewer is not connecting.

$
0
0

Hello everyone,
I'm trying to use Xamarin Live Reload Previewer but I'm not getting any success.

Desktop:
=> I am emulating a Windows 10 through Virtual Box.
=> I disabled the real Windows firewall and the emulator.
=> Both the actual device (which I use to build) and the computer are on the same wifi. (NOTE: I ping the device through the computer and the 2 talk).

Using the address "localhost: 1883" and opening a XAML file I get the following message: "Live Reload is enabled but not listening on localhost: 1883".

Searching a little on the internet I found some people stating that putting address "broker.hivemq.com:1883" will also work, however when I use this address I get the message: "Live Reload is enabled but not connected to broker.hivemq.com : 1883 ".

I have already uninstalled and installed but nothing comes into effect.

In another VM I have done a test and it worked normal.

Can we make a cross platform app for cab application like Ola and Uber?

$
0
0

If yes, then which type of libraries we add to it?

How can I Change and navigate the source of webview control in runtime?

$
0
0

How can I Change and navigate the source of webview control in runtime?

Global Styles with ONIDIOM not working on recent updates?

$
0
0

I recently upgraded my forms version for from 2.5.91635 to XF 3.0 and the global styles which I have defined stopped working . However styles with OnPlatform are working and styles which are having OnIdiom in it , its not working. I'm currently using .NEt standard?
Any idea?

Xamarin Forms Android showing Tabbed Page inside Master Details Page is showing blank empty screen

$
0
0

In my Xamarin Forms application I am having Tabbed Page as first Detail page of Master Details Page. So, while running my Droid application it is showing empty blank screen for few seconds and after that it is showing the correct Tabbed Page. However, if I run the same project in iOS it is not showing any Empty or blank screen; Tabbed page is rendering fast.

What I have tried

If I set any other normal Content Page as first Detail page instead of Tabbed Page means that page is rendering fast in Droid

and also I have tried after updating the Xamarin.Forms from v2.5.1.444934 to v3.1.0.697729 but no luck.

So, I confirmed that the Empty or Blank screen is showing in Droid App for few seconds because of Tabbed Page. Is there any work around to resolve the problem. Thanks in advance.

Viewing all 91519 articles
Browse latest View live


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