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

Wrap into frame

$
0
0

I would want to wrap this into something like this

There is code of the side. How it should be done ?

<?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:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="DLZOBY.View.VsetkyDlhy"
             xmlns:viewmodel="clr-namespace:DLZOBY.ViewModel"
             x:Name="DLHY_ADMIN_VIEW"
             xmlns:model="clr-namespace:DLZOBY.Model"
             BackgroundColor="{DynamicResource PageBackgroundColor}">
    <ContentPage.BindingContext>
        <viewmodel:VsetkyDlhy_viewModel/>
    </ContentPage.BindingContext>
    <ContentPage.ToolbarItems>
        <ToolbarItem Text="VYMAŽ" Command="{Binding VymažCommand}" />
        <ToolbarItem Text="Nastavenia" Command="{Binding NastaveniaCommand}" Order="Secondary"/>
    </ContentPage.ToolbarItems>
    <StackLayout>
        <ActivityIndicator IsVisible="{Binding IsBusy}" IsRunning="{Binding IsBusy}" Color="Blue"/>
        <SearchBar Text="{Binding HladanyText}" TextColor="{DynamicResource PrimaryTextColor}" CancelButtonColor="{DynamicResource PrimaryTextColor}" PlaceholderColor="{DynamicResource PrimaryTextColor}" BackgroundColor="{DynamicResource SearchBackground}"/>
        <CollectionView     IsGrouped="True"
                                ItemsSource="{Binding DLHY_VYPIS}"
                                SelectionMode="Multiple"
                                SelectionChanged="CollectionView_SelectionChanged">
            <CollectionView.GroupHeaderTemplate>
                <DataTemplate>
                    <Label FontAttributes="Bold" Text="{Binding VyslednaSuma}" TextColor="{DynamicResource RedText}" />
                </DataTemplate>
            </CollectionView.GroupHeaderTemplate>
            <CollectionView.Header>
                <Grid RowSpacing="10" ColumnSpacing="10" VerticalOptions="FillAndExpand" HorizontalOptions="Center">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="55"/>
                        <ColumnDefinition Width="55"/>
                        <ColumnDefinition Width="45"/>
                        <ColumnDefinition Width="75"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <Label Grid.Row="0" Grid.Column="0" Text="KTO" FontAttributes="Bold" TextColor="{DynamicResource PrimaryTextColor}" />
                    <Label Grid.Row="0" Grid.Column="1" Text="KOMU" FontAttributes="Bold" TextColor="{DynamicResource PrimaryTextColor}"/>
                    <Label Grid.Row="0" Grid.Column="2" Text="KOĽKO" FontAttributes="Bold" TextColor="{DynamicResource PrimaryTextColor}"/>
                    <Label Grid.Row="0" Grid.Column="3" Text="KEDY" FontAttributes="Bold" TextColor="{DynamicResource PrimaryTextColor}"/>
                    <Label Grid.Row="0" Grid.Column="4" Text="POPIS" FontAttributes="Bold" TextColor="{DynamicResource PrimaryTextColor}"/>
                </Grid>
            </CollectionView.Header>
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <Grid RowSpacing="10" ColumnSpacing="10">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="55"/>
                            <ColumnDefinition Width="55"/>
                            <ColumnDefinition Width="45"/>
                            <ColumnDefinition Width="75"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <!--<Label Grid.Row="1" Grid.Column="0" Text="KTO" FontAttributes="Bold"/>
                            <Label Grid.Row="1" Grid.Column="1" Text="KOMU" FontAttributes="Bold"/>
                            <Label Grid.Row="1" Grid.Column="2" Text="KOĽKO" FontAttributes="Bold"/>
                            <Label Grid.Row="1" Grid.Column="3" Text="KEDY" FontAttributes="Bold"/>
                            <Label Grid.Row="1" Grid.Column="4" Text="POPIS" FontAttributes="Bold"/>-->
                        <Label Grid.Row="0" Grid.Column="0" Text="{Binding KTO}" Margin="0" TextColor="{DynamicResource PrimaryTextColor}" BackgroundColor="{DynamicResource PageBackgroundColor}"/>
                        <Label Grid.Row="0" Grid.Column="1" Text="{Binding KOMU}" Margin="0" TextColor="{DynamicResource PrimaryTextColor}" BackgroundColor="{DynamicResource PageBackgroundColor}"/>
                        <Label Grid.Row="0" Grid.Column="2" Text="{Binding KOĽKO,StringFormat='{0:N}€'}" Margin="0" TextColor="{DynamicResource PrimaryTextColor}" BackgroundColor="{DynamicResource PageBackgroundColor}"/>
                        <Label Grid.Row="0" Grid.Column="3" Text="{Binding KEDY}" Margin="0" TextColor="{DynamicResource PrimaryTextColor}" BackgroundColor="{DynamicResource PageBackgroundColor}"/>
                        <Label Grid.Row="0" Grid.Column="4" Text="{Binding Popis}" Margin="0" TextColor="{DynamicResource PrimaryTextColor}" BackgroundColor="{DynamicResource PageBackgroundColor}"/>
                    </Grid>
                </DataTemplate>
            </CollectionView.ItemTemplate>
        </CollectionView>
    </StackLayout>
</ContentPage>

What is the best aproach for detecting changes in a mysql database?

$
0
0

Hi, I need to now when there is an update in a database on a server and update my SQLite database on xamarin forms,
Can I do it with triggers on the database or maybe with a script and for send push notifications, or should I make request from the app to detect updates and then make request to get the data.

Entry Placeholder with mandatory sign "*"

$
0
0

Hi,

Is it possible to have Entry filed with Mandatory sign in Red

If yes then how to do it.?

How to select collectionview's items in code level ?

$
0
0

Is there any way to select items of collection view programmatically.?

Xamarin Forms: Showing a white blank screen instead of MasterDetail page in iPad

$
0
0

In my app home page is showing after login. The home page is the child of the master-detail page and these things are working fine on android, ios phone, and ios simulators. But when trying to log in on the iPad device a blank white screen is showing instead of the home page.

Adding iPhone Home Screenshot and iPad Home Screenshot. I have debugged a lot on this but didn't get the cause behind this.

Project type: PCL

XF version: 3.4.0.1009999

I have uploaded a sample project here.

Using Embedded Images via binding

$
0
0

Hi,

I'm new to Xamarin Forms only started a couple of weeks ago coming from a WPF / MVVM background. I have a MasterDetailPage all working without icons so I am trying to 'bind' embedded images.

So in my MenuView XAML page, I have the following:-

  <ListView x:Name="lvMenu" VerticalOptions="FillAndExpand" SeparatorVisibility="None" ItemsSource="{Binding Menu}">
    <ListView.ItemTemplate>
      <DataTemplate>
        <ImageCell Text="{Binding Title}" ImageSource="{Binding IconSource}" />
      </DataTemplate>
    </ListView.ItemTemplate>
  </ListView>

The Menu is just a list of MenuItems that have TargetType, Title and IconSource properties. My IconSource contains the filename of the image, ie: cog.png

The following works and does show the image (albeit the same image for all the menu options):

<ImageCell Text="{Binding Title}" ImageSource="{local:ImageResource Touchretail.Trims.Mobile.Images.cog.png}" />

So I'm pretty sure it is achievable. What I would like to do is just replace the cog.png part with the TargetType from the Menu object. Effectively - I'm trying to get to:

<ImageCell Text="{Binding Title}" ImageSource="{local:ImageResource Touchretail.Trims.Mobile.Images.{Binding IconSource}}" /> 

but obviously this would not work.... How can I achieve the desired result?

How can I add Image container

$
0
0

Hi xamarin forum can some body help me on how to add an Image container during click of a button?

Thanks

Animations not working on Android Device

$
0
0

Hi Everyone,

I'm currently trying to get some animations to work with my Xamarin.Forms app- when I develop locally using the Emulator the animations look fine (albeit slow because its emulate), however when I deploy it to an actual android device the animations dont run. It essentially looks like it just skips over the entire animation and shows the end state.
In my specific case I am using a Swipe Card Layout (Syncfusion controls) - when I swipe the card, I want the swiped card to animate flipping over. While I realize the question might better be suited towards that vendor, it appears to me the animation problem would be outside the realm of their controls.

The code in question is just this:

            var currentChild = this.SwipeCardLayout.Children[SwipeCardLayout.VisibleCardIndex];
             await currentChild.RotateYTo(180, 1000, Easing.Linear);

The current child is just a view, so from my understanding this should work (again, this works fine on the emulator, just on the device it doesnt).

The device I am testing with is identified as OnePlus A6003 Android 10.0 - API 29

Any guidance in the right direction would be greatly appreciated.

--Chris


Best practice for handling push notifications on a single device with potentially multiple logins

$
0
0

I've been reading on how to properly implement push notifications into an app I'm developing and I pretty much have it working successfully. The code registers the device with azure notification hub and successfully sends a notification based on the specified tag that I provide.

My question is what is the best approach for handling the device registration with potentially multiple users that would in turn mean multiple tags? I read that you shouldn't de-register the device once it's registered so that's where I kind of got lost.

I probably don't have the complete understanding of the device registration / assigning a tag either. My understanding is that you register said device with a token that looks to be randomly generated and then you associate a tag with that token (i.e. the device). Should you just add multiple tags (users) to the same token and then just pass the tag around the code so the notification gets sent to the correct tag? Can you just randomly add another tag to an already registered device to handle another person logging in and using the app?

Picker loading AFTER opening page 2nd time

$
0
0

I give up after trying to solve the issue for hours.

I have a picker on a page with binding from a viewmodel. However, the picker doesn't show anything untill I navigate away from the page and navigate back to the page(opening it the 2nd time) for some reason. Attaching a breakpoint and following the properties, the ItemsSource does indeed get populated before the process of showing the page for the first time ends(till I can no longer press f11). The API is also retrieving the data properly.

Here's the code:

    <?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="MobileApp.Views.ItemTestPage">

        <ContentPage.Content>
            <StackLayout>
                <Label Text="Items"
                    VerticalOptions="CenterAndExpand" 
                    HorizontalOptions="CenterAndExpand" />
                <Picker ItemsSource="{Binding TestList}"  ItemDisplayBinding="{Binding Name}"></Picker>
            </StackLayout>
        </ContentPage.Content>

    </ContentPage>

    public partial class ItemTestPage : ContentPage
    {
        private TestViewModel model;
        public ItemTestPage()
        {
            InitializeComponent();
            BindingContext = model = new TestViewModel();
        }

        protected override async void OnAppearing()
        {
            base.OnAppearing();
            await model.Init();
        }

    }


     public class TestViewModel : BaseViewModel
        {
            private readonly APIService _service = new APIService("Test");

            public TestViewModel()
            {
                InitCommand = new Command(async () => await Init());
            }
            public ObservableCollection<TestItem> TestList { get; set; } = new ObservableCollection<TestItem>();

            public ICommand InitCommand { get; set; }

            public async Task Init()
            {

                TestList.Add(new TestItem
                {
                    name = "test1",
                    Id = 1
                });

                TestList.Add(new TestItem
                {
                    name = "test2",
                    Id = 2
                });

                TestList.Add(new TestItem
                {
                    name = "test3",
                    Id = 3
                });
            }
      }

How to build my own signin?

$
0
0

Hi,

I have different apps and I want to have a single signin for all just like the Windows Account signin when you sign with any app but I don't want to use a Webview

What are the other options to do it and just include the sign in modules in any app?

Thanks,
Jassim

How to deal with System.TypeLoadException in the app.xaml.cs in xamarin.forms?

$
0
0

Sorry to bother you, but I've come across a error in my code I don't how to deal with.

Whenever I try to run my app, I get faced with this:

System.TypeLoadException: 'Could not resolve type with token 01000019 from typeref (expected class 'Xamarin.Forms.Xaml.Diagnostics.VisualDiagnostics' in assembly 'Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null')'

It states it occurs when the InitializeComponent(); is called in the constructor of App.xaml.cs.

Constructor in question:

public App()
    {
        //Line throwing the error
        InitializeComponent();

        MainPage = new NavigationPage(new Login.LogonFinal()); 
    }

App.xaml.cs

using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace NEA_I_MDL
{
    public partial class App : Application
    {

        static Databases.AccountDatabaseController AccountDatabaseVar;

        public App()
        {
            //Line throwing the error
            InitializeComponent();

            MainPage = new NavigationPage(new Login.LogonFinal()); //Defines what page the app opens on when starting
        }

        protected override void OnStart()
        {
            // Handle when your app starts
        }

        protected override void OnSleep()
        {
            // Handle when your app sleeps
        }

        protected override void OnResume()
        {
            // Handle when your app resumes
        }

        public static Databases.AccountDatabaseController AccountDatabaseFunc
        {

            get
            {

                if(AccountDatabaseVar == null)
                {
                    AccountDatabaseVar = new Databases.AccountDatabaseController();
                }

                return AccountDatabaseVar;

            }

        }

    }
}

Thank you for reading, any tips/assistance will be a huge help for my ineptly written code.

How can I read a RFID card in my Xamarin.Forms Application?

$
0
0

Hi guys, how can I read a RFID card in my Xamarin.Form Application?
In the end, I want to read this card over an android tablet.
Thanks.

Xamarin forms scrollview can't scroll

$
0
0


        <BoxView BackgroundColor="White" 
                   Opacity="0.6"
                   HeightRequest="500"
                   WidthRequest="550"
                 AbsoluteLayout.LayoutBounds="0.5,0.099,550,400"
                 AbsoluteLayout.LayoutFlags="PositionProportional"/>





        <ImageButton
            Source="button.png"
             BackgroundColor="Transparent"
            AbsoluteLayout.LayoutBounds="0.5,0.68,290,290"
            AbsoluteLayout.LayoutFlags="PositionProportional"
            />
        <Label
Text="-Superior Standart Room"
            TextColor="Black"
            FontSize="Medium"
              AbsoluteLayout.LayoutBounds="-0.63,0.69,450,250"
            AbsoluteLayout.LayoutFlags="PositionProportional"/>

        <Label
Text="Minimum capacity 2 pax, maximum capacity 3+1 pax."                
            FontSize="Body"
            AbsoluteLayout.LayoutBounds="-0.63,0.75,450,250"
            AbsoluteLayout.LayoutFlags="PositionProportional"/>
        <Label
            Text="64 m², decorated with modern design."
            FontSize="Body"
              AbsoluteLayout.LayoutBounds="-0.64,0.80,450,250"
            AbsoluteLayout.LayoutFlags="PositionProportional"     />
        <Label
            Text="Sea, side-sea and land view."
            FontSize="Body"
              AbsoluteLayout.LayoutBounds="-0.65,0.85,450,250"
            AbsoluteLayout.LayoutFlags="PositionProportional"     />




        <Image
            Source="superiorstandart.png"
            AbsoluteLayout.LayoutBounds="0.5,0.1,330,300"
            AbsoluteLayout.LayoutFlags="PositionProportional"
            />
<BoxView BackgroundColor="Black" 
                   Opacity="0.6"
                   HeightRequest="500"
                   WidthRequest="550"
                 AbsoluteLayout.LayoutBounds="0.5,1.90,550,400"
                 AbsoluteLayout.LayoutFlags="PositionProportional"/>
        <Image
            Source="superiorstandart.png"
            AbsoluteLayout.LayoutBounds="0.5,1.5,330,300"
            AbsoluteLayout.LayoutFlags="PositionProportional"/>

        <Label
Text="-Handicap Room"
            TextColor="Black"
            FontSize="Medium"
              AbsoluteLayout.LayoutBounds="-0.63,1.7,450,250"
            AbsoluteLayout.LayoutFlags="PositionProportional"/>





</AbsoluteLayout>

</ScrollView>

So why i cant scroll

How can I display a push notification when my app is closed?

$
0
0

Hello,
i want to show a push notification when my app is closed.
Best way for me is a background service with one periodically method.
Actullay it must work like WhatsApp


Showing a website using Webview

$
0
0

Hi Everyone!

I want to put my website completely in the application. My goal is to show the site as a mobile app using vebview.
I will create a new project for this. I would like to take advantage of your experience. Even if it's a simple project, I would like to hear your advice on this issue.

Thanks in advance!

Call Navigation.PushAsync from ViewModel

$
0
0

Hello,

I want to push a new page from a viewModel.

Can I call this method from outside the page?

Thanks in advance.
Mostafa

How To Quit The App From Code

$
0
0

Hi,
i have a DisplayAlert(); that gets me 2 answers, either try again or Exit the App

        var IsRtryAgain= await DisplayAlert("Alert", NoInternetMsg, "Retry","Exit");

        if (IsRtryAgain)
        {
            LoadFeeds();
        }
        else
        {
            (((Parent as TabbedPage).Parent as NavigationPage).Parent as App).Quit();

        }

the Quit(); Method i got it from here
And Surprise Surprise, It Does Not Work
I made sure that its navigating to that method with some break points and nesting this method into another method then calling it instead
but Nope.
it reaches the code, "Executes it" and boom Boom! Nothing happens...
is this thing broken or am i using it wrong ?

SideNote: My app is currently Android only (in case you wondered).

Strange permission issue when submitting an app to the App Store

$
0
0

I have created an app using XF and when submitting it to the App Store, I received an email that reads:

Missing Purpose String in Info.plist File - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSContactsUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data will be required to include a purpose string.If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).

Missing Purpose String in Info.plist File - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSCalendarsUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data will be required to include a purpose string.If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).

Missing Purpose String in Info.plist File - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSPhotoLibraryUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data will be required to include a purpose string.If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).

Missing Purpose String in Info.plist File - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSMicrophoneUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data will be required to include a purpose string.If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).

Missing Purpose String in Info.plist File - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSAppleMusicUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data will be required to include a purpose string.If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).

Missing Purpose String in Info.plist File - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSSiriUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data will be required to include a purpose string.If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).

Best regards,

The App Store Team

But I am not using any of those permissions at all!

Is there any way to add padding on top of MasterDetailPage Navigationbar?

$
0
0

I want to add 25 top padding to the MasterDetailPage above the navigation bar, but cant seem to find a way. Is there a way? I can do it on other pages just fine. Thanks

I want it to look like this^

Viewing all 77050 articles
Browse latest View live