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

The Microsoft Xamarin Support Team is Here to Help

$
0
0

Please feel free to post your questions or start discussions here on the forums (see these posting guidelines). The Microsoft Xamarin support team is monitoring the Forums as time permits, focusing on the Xamarin Platform.

If you want one on one support via email (business hours only) or need to provide private code or other sensitive info, then please submit a support request to the Xamarin support team at this link.


How to display an Admob interstitial, after a page has loaded in Xamarin Forms?

$
0
0

The interstitial works fine when displayed through a button press. I have tried OnAppearing, but it runs before the page is loaded on Android. It seems no matter what I do, even with delayed calls, the page display overrides the ad.

Json configuration file

$
0
0

Hey guys, I'm trying to add to my project a config.json file. I am following the steps indicated in the documentation article about this. https://xamarinhelp.com/configuration-files-xamarin-forms/

The very last step is to load the configuration files with this function:

public static async Task<IConfiguration> Build(IFileStorage fileStorage)
{ 
    var platformFile = await fileStorage.ReadAsString("platform.json");

    var platform = JsonConvert.DeserializeObject<Platform>(platformFile);

    var configurationFile = await fileStorage.ReadAsString("config.json");

    var configuration = JsonConvert.DeserializeObject<Definition.Configuration>(configurationFile);

    configuration.Platform = platform;

    return configuration;
}

But I can't make it work, as this line:

            var configuration = JsonConvert.DeserializeObject<Definition.Configuration>(configurationFile);

Is giving me an error on the word "Definition" saying that it cannot find the type or namespace "Definition" within my project. I have tried all I could (which is not much as I'm pretty new to this) and can't seem to make it work.

Anybody knows what I might be missing? As I followed each step of the article.

Content switcher

$
0
0

How to add indicators(buttons or dots) for carousel page.

How to Store Lists in Xamarin Forms Settings Plugin

$
0
0

Hi, can anyone please help me for how to Store Lists in Xamarin Forms Settings Plugin.

I need to pass database data to listview

$
0
0

In my View Model

      public ObservableCollection<AddExpenses> _expenses;

public ObservableCollection<AddExpenses> Expenses
{
    get
    {
        if (_expenses == null)
        {
            _expenses = new ObserrvableCollection<AddExpenses>();
        }
        return _expenses;
    }
 }
  public ICommand click { get; set; }

   public TransactionViewModel(Register_person logindata)
{
    click = new Command(add)

}

    private void add()
    {

    var database = new Database();
    var expenses = database.GetFinalExpense(10);

    foreach (var expense in expenses)
    {
        Expenses.Add(expense);
    }
}
}

In my database.cs

    public AddExpenses[] GetFinalExpense(int numberOfExpenses)
 {
    return Conn.Table<AddExpenses>()
               .OrderByDescending(expenses => expenses.Id)
               .Take(numberOfExpenses)

               .ToArray();


}

I used this code to add these last ten record to my list view using this code. when I called the GetFinalExpense(10) it takes all last 10 records.but when I execute the add function it only shows the two data one is type is DateTime and other is Double. my other two data are in string format. Data binding and XAML part has no issue as far as I know(not Entirely sure)

here my XAML

<ListView ItemsSource="{Binding Expenses}" VerticalOptions="FillAndExpand" >

    <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <StackLayout Orientation="Vertical">
                    <StackLayout Orientation="Horizontal">
                    <Label Text="{Binding Catagoryview}"/>
                        <Label Text="{Binding Date}"/>
                    <Label Text="{Binding Expense}"/>
                    <Label Text="{Binding username}"/>
                    </StackLayout>
                </StackLayout>
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

I need to show all this in list view. Also, I need another favour my DateTime type give me both Date and Time I only need the Date.but it not the main issue is the listview

Xamarin. forms 3.5 upgrade XamlGTask issue

$
0
0

I have upgraded Xamarin.forms to 3.5 and i am getting the below 2 errors

  • The "XamlFiles" parameter is not supported by the "XamlGTask" task. Verify the parameter exists on the task, and it is a settable public instance property.
  • The "XamlGTask" task could not be initialized with its input parameters.

So to resolve this issue temporarily I have to unload the solution and cleaned the bin, obj files and reloading the files, then building it again. But this is happening whenever i do small changes in XAML or view model. Is there any way to resolve this issue permanently?

How to enable Auto start in a device programmatically using xamarin forms?

$
0
0

I want to enable the auto start option in the phone for receiving push notification in the app killed state.How can I implement this functionality from my project.I am using FCM push notification service.

Please help me


XLabs.Forms.iOS - Controls - CheckBox: Image not show

$
0
0

Hi, I have this problem on my iphone 7 I'm using xlabs, can anyone tell me if this has already been resolved?

Multi-line Label with tail truncation

$
0
0

Is a Label in XF configurable to support multi-line (wraps) and tail truncation at the same time? In iOS, I can do this by specifying the number of lines on a UILabel and specifying tail truncation. If not, I can also go the custom renderer route.

How to change the background color of a stacklayout based on color choose from a picker?

$
0
0

I have a stacklayout. And I have a picker which contains different color names. If I choose Red, means, It should display stacklayout in red background .....Any Suggestion please...........

Responsive UI xamarin

$
0
0

Hi Here my code, How can I do tot fit with all screen size
<ScrollView> <StackLayout Orientation="Vertical" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"> <Grid HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand" x:Name="currentJob" > <Grid.RowDefinitions> <RowDefinition Height="7*" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="5*" /> <ColumnDefinition Width="5*" /> </Grid.ColumnDefinitions> <maps:Map VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="SkyBlue" Grid.Row="0" Grid.ColumnSpan="2" x:Name="MyMap" IsShowingUser="False" MapType="Street" /> <Label Text="From Address:" Grid.Row="1" Grid.Column="0" /> <Label x:Name="FromPremise" Grid.Row="1" Grid.Column="1" /> <Label Text="To Address:" Grid.Row="2" Grid.Column="0" /> <Label x:Name="ToPremise" Grid.Row="2" Grid.Column="1" /> <Label Text="Vehicle Number:" Grid.Row="3" Grid.Column="0" /> <Label x:Name="VehicleNo" Grid.Row="3" Grid.Column="1" /> <Label Text="Start Date :" Grid.Row="4" Grid.Column="0" /> <Label x:Name="StartDate" Grid.Row="4" Grid.Column="1" /> <Label Text="ContainerNumber:" Grid.Row="5" Grid.Column="0" /> <Label x:Name="ContainerNumber" Grid.Row="5" Grid.Column="1" /> <Label Text="Trailer Number:" Grid.Row="6" Grid.Column="0"></Label> <Label x:Name="TrailerNumber" Grid.Row="6" Grid.Column="1"></Label> <Button Grid.Row="7" Grid.Column="0" x:Name="cancelJob" Text="Cancel" VerticalOptions="StartAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="DimGray" TextColor="White" HeightRequest="50" Clicked="CancelJob"> </Button> <Button Grid.Row="7" Grid.Column="1" x:Name="finishJob" Text="Finish" VerticalOptions="EndAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="Orange" TextColor="White" HeightRequest="50" Clicked="FinisiedJob"> </Button> <Button Grid.Row="8" Grid.ColumnSpan="2" x:Name="UpdateDetail" Text="Update Details" VerticalOptions="End" BackgroundColor="DeepSkyBlue" TextColor="White" HeightRequest="53" Clicked="UpdateDetails"> </Button> </Grid> <StackLayout Orientation="Vertical" x:Name="noCurrentJob" VerticalOptions="StartAndExpand" HorizontalOptions="Start"> <Label Text="No current job!Start a job from MyJobList" TextColor="Blue"></Label> </StackLayout> </StackLayout> </ScrollView>

How to create a item tapped event in a (observable collection) list view????

$
0
0

I have a ListView where each Listitem has a image

I have used TapGesturesRecognizers on a image and binded _DelegateCommands for these TapGestureRecognizers However these DelegateCommands do not get called.

This is my xaml code

<ListView.ItemTemplate>



<StackLayout.GestureRecognizers>

</StackLayout.GestureRecognizers>

                    </StackLayout>
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

this is view modal

public ObservableCollection ListItems {get;set;} = new ObservableCollection();
public ICommand TapCommand { get; set; }
TapCommand = new Command(OnImgTapped);

private void OnImgTapped(object obj)
{
var senderName = obj as string;
if (senderName == null)
return;
}

Webview with HtmlWebViewSource from remote site

$
0
0

I want to cache a webpage so i can check its content before displaying it. I don't want to make two calls and i don't want to do it the other way round.

So, I get the html from a remote site, store it in a string, and use it to build a HtmlWebViewSource. I set the Source of a Webview to that and the page sort of loads. The HTML content is there but with no formatting or images. I guess it is looking locally for the files on the site. I set the BaseUrl to the domain of the site and it still doesn't work. Any ideas?

Listview Item background colour change when long press for Android.

$
0
0

I am trying to change the background color of list item when long-press of it, but existing color coding is not allowing.
I added styles in Android everything is working if I remove my default background, but default background color should be there as per UX.
Here is my code,

<DataTemplate x:Key="ResourceDataTemplate">
        <ViewCell BindingContextChanged="Resource_BindingContextChanged">
            <StackLayout Spacing="0" BackgroundColor="#fffff">
                <Grid.RowDefinitions>

                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <StackLayout BackgroundColor="{Binding BgColor}" Style="{StaticResource GeneralPaddingStackLayoutStyle}" Orientation="Vertical" Spacing="0">
                    <Label Text="{Binding LinkName}" Style="{StaticResource titleLabel}" LineBreakMode="TailTruncation">
                        <Label.GestureRecognizers>
                            <TapGestureRecognizer Tapped="Label_Tapped" CommandParameter="{Binding .}" />
                        </Label.GestureRecognizers>
                    </Label>
                    <customRenderPage:TwoLineLabel Text="{Binding Description}" Style="{StaticResource subTitleLabel}" Margin="{StaticResource defaultTopPaddingforTitle}" />
                </StackLayout>
                <usercontrols:SeparatorGrid Grid.Row="1" />
            </StackLayout>
        </ViewCell>
    </DataTemplate>`

If I remove background color from this line "<StackLayout Spacing="0" BackgroundColor="#fffff">", it's working fine. Otherwise white color overriding the highlighted color, how to overcome this.
Thanks in advance.


Online database on Xamarin.Forms

$
0
0

Hi all, new to Xamarin.Forms love it so far. So I have an app that has a login page, so one table with users and I will have another table with I think 4 strings with various lengths. I need an online database because my project will have an wpf part for PC so I can use the database on PC and on my phone. I saw that a lot of people suggested firebase and I like the idea to use the database offline as they said: "The Firebase Realtime Database can be accessed directly from a mobile device or web browser; there’s no need for an application server. Security and data validation are available through the Firebase Realtime Database Security Rules, expression-based rules that are executed when data is read or written. ". I am open to suggestions. And I need a bit of help with the nuget packages because there are some nugets, like Xamarin.Firebase.Database.Connection, but I don`t know which one to use. Thank you! :smile:

How to add Strike out to the label

$
0
0

I have list view in that I declared label which is binding from SQLITE database . So if user wants to strike out a particular label than how to implement it.
Any suggestions??

How to upload and retrieve image using sqlite databse

$
0
0

My question is in Xamarin.Forms using the SQLite database can upload an image and retrieve it to the same place(like a profile picture).

I look through google but I couldn't find anything like this is this possible to do in xamarin.Forms using SQLite local database

How I can do , When I will click navigation back button ,from every page it will go to home page

integrate an image editor

$
0
0

Hi,

I want to integrate an image editor (similar to adobe creative SDK or Img.ly SDK) into xamarin.forms app, can anyone please suggest me a cross platform image editor?

Viewing all 89864 articles
Browse latest View live


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