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

Nested ListView in Xamarin.Forms (ListView inside another ListView)

$
0
0

I have created a nested ListView in Xamarin.
But unfortunately, the binding works only with the Parent ListView and NOT with the Child List - sub ListView.

I tried to verify if there is any error with my Binding, and my binding works well with the sub List, if i make it as parent.
Any help on this binding, or approach for nested ListView bindings in Xamarin with samples would be much helpful.


Dev express datagrid for Xamarin forms

$
0
0

Did anyone know how to use DevExpress.Mobile.Grid in xamarin forms( .net standard) project?

Listview Not binding through ViewModel

$
0
0

I have my viewmodel a below -

public class LeadershipViewModel
{
private PfsServiceArea _oldProduct;
public ObservableCollection Products { get; set; }
public LeadershipViewModel()
{
Products = new ObservableCollection();
var PFSArea = new PfsServices().GetPFSServiceArea("Leadership");
if (PFSArea.Count > 0){
foreach(PfsServiceArea pf in PFSArea){
Products.Add(pf);
}
}
}

    public void ShowOrHidePoducts(PfsServiceArea product)
    {
        if (_oldProduct == product)
        {
            // click twice on the same item will hide it
            product.ShowDescription = false;
            product.ShowDisplay = true;
            UpdateProducts(product);
        }
        else
        {
            if (_oldProduct != null)
            {
                // hide previous selected item
                product.ShowDescription = true;
                product.ShowDisplay = false;
                UpdateProducts(_oldProduct);
            }
            // show selected item
            product.ShowDescription = true;
            product.ShowDisplay = false;
            UpdateProducts(product);
        }

        _oldProduct = product;
    }

    private void UpdateProducts(PfsServiceArea product)
    {
        var index = Products.IndexOf(product);
        Products.Remove(product);
        Products.Insert(index, product);
    }

And I have binded it with listview like below -
Private LeadershipViewModel leader = new LeadershipViewModel();
sicCodeList = new CustomListview(ListViewCachingStrategy.RetainElement)
{
HorizontalOptions = LayoutOptions.StartAndExpand,
VerticalOptions = LayoutOptions.EndAndExpand,
ItemTemplate = sicDataTemplate,
SeparatorVisibility = SeparatorVisibility.None,
Margin = new Thickness(-5, 0, 0, 0),
BindingContext = leader

        };
        sicCodeList.HasUnevenRows = true;
        //sicCodeList.BindingContext = leader;
        sicCodeList.SetBinding(ListView.ItemsSourceProperty, "Products");
        sicCodeList.ItemTapped += (sender, e) => OnItemTapped(sender, e);

I can see 4 items in leader but they are not visible in the listview. Can someone tell me why is this?

Xamarin.Forms.Mac GestureRecognizer not working

$
0
0

Hello there,

I've got a StackLayout which has a GestureRecognizer attached. When I click that StacKLayout in UWP, the Recognizer gets fired, but on MacOS it doesn't. Is this a Bug or still not implemented?

SlFilename.GestureRecognizers.Add(new TapGestureRecognizer() { Command = new Command(ChooseNewFilename) });

Also I tried this with no success:

<StackLayout.GestureRecognizers> <TapGestureRecognizer Tapped="Handle_Tapped" /> </StackLayout.GestureRecognizers>

Maybe someone knows a little more about that issue.

Thanks a lot!

iPhone X SafeArea with Forms ListView

$
0
0

How do you guys handle the safe area problem for ListViews with Xamarin.Forms? Just setting the safe area as margin on the whole ListView looks ugly AF. So I search for something like a custom renderer to make the ListView as equal als possible to the UITableView in the iPhone X. My current solution bringt the ViewCells in the correct position but the Seperator is going off screen and the ShortGroup index is behind the Notch in some rotations. Beside from that, my current solution is way to much work to implement it in every project (because I use a CustomViewCell class as Workaround).

So how to implement a custom renderer for this problem? All of my current implementations seems not to work properly. And I guess waiting for Xamarin to fix this is not an option (because MasterDetail pages still not work on iOS SplitView and this was reported back in 2015 and is just ignored by Xamarin...).

Edit: The problem with the ListView in Xamarin.Forms did only occur if the ListView control is not the root of the ContentPage. In my case it is inside a Grid because I want a SearchBar too on this side. In this case the content of the ListView (and the ShortGroup index) gets cut off by the iPhone X rounded corners and the notch. It looks really ugly and I guess it is a very common way to have a SearchBar and a ListView on one side. Here is a repository of a project which has a first workaround (the ShortGroup index still has the problem there and also the separator runs outside of the visible area while it normally would stop before that): https://github.com/Sebastian1989101/OpenGeoDB-App

how to save mapbox data offline

$
0
0

I want to save mapbox data offline, how can i do this

problem with listview scrolling items overlapping with headers in xamarin forms

$
0
0

I am problem with listview items. Items are overlapping with headers.
Here is my code.

<ListView
ItemsSource="{Binding List}"

    IsGroupingEnabled="True">
        <ListView.ItemTemplate>
            <DataTemplate>

                <ViewCell>
                    <StackLayout Orientation="Horizontal" HeightRequest="80">
                       <Grid HeightRequest="80">
                             <Grid.RowDefinitions>
                                   <RowDefinition Height="*" />
                                   </Grid.RowDefinitions>
                             <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="25*" />
                                    <ColumnDefinition Width="25*" />
                                    <ColumnDefinition Width="25*" />
                                    <ColumnDefinition Width="25*" />
                              </Grid.ColumnDefinitions>
                               <Label Text="{Binding Name}" VerticalOptions="Center" Grid.Row="0" Grid.Column="0" />
                                       <ctrls:CheckBox  Grid.Row="0" Grid.Column="1" IsChecked="{Binding IsChecked1}" BorderImageSource="checkborder" CheckedBackgroundImageSource="checkcheckedbg" CheckmarkImageSource="checkcheckmark" />   
                                       <ctrls:CheckBox  Grid.Row="0" Grid.Column="2"  IsChecked="{Binding IsChecked2}" BorderImageSource="checkborder" CheckedBackgroundImageSource="checkcheckedbg" CheckmarkImageSource="checkcheckmark" />   
                                       <ctrls:CheckBox Grid.Row="0" Grid.Column="3" IsChecked="{Binding IsChecked3}" BorderImageSource="checkborder" CheckedBackgroundImageSource="checkcheckedbg" CheckmarkImageSource="checkcheckmark" />   

                          </Grid>    
                        <!--<StackLayout HorizontalOptions="FillAndExpand" Spacing="1" Orientation="Horizontal" HeightRequest="80">
                            <Label Text="{Binding Name}" FontSize="Medium" TextColor="#005569" VerticalOptions="Center" />
                            <ctrls:CheckBox VerticalOptions="Center"  IsChecked="{Binding IsChecked1}" BorderImageSource="checkborder" CheckedBackgroundImageSource="checkcheckedbg" CheckmarkImageSource="checkcheckmark" />   
                                <ctrls:CheckBox VerticalOptions="Center"  IsChecked="{Binding IsChecked2}" BorderImageSource="checkborder" CheckedBackgroundImageSource="checkcheckedbg" CheckmarkImageSource="checkcheckmark" />   
                                <ctrls:CheckBox VerticalOptions="Center"  IsChecked="{Binding IsChecked3}" BorderImageSource="checkborder" CheckedBackgroundImageSource="checkcheckedbg" CheckmarkImageSource="checkcheckmark" />   

                        </StackLayout>-->
                    </StackLayout>                        
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
        <ListView.GroupHeaderTemplate>
            <DataTemplate>
                <ViewCell>
                    <RelativeLayout HeightRequest="80"   BackgroundColor="#E2F5F9">
                        <Label Text="{Binding Title}"
                           FontSize="Large"
                           RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.1}"
                           RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0, Constant=6}"  />
                        <Image x:Name="StateImage" PropertyChanged="StateImage_PropertyChanged"
                           Source="{Binding StateIcon}" 
                           RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.8}"/>
                        <RelativeLayout.GestureRecognizers>
                            <TapGestureRecognizer Command="{Binding Source={x:Reference currentPage}, Path=BindingContext.HeaderClickCommand}"   CommandParameter="{Binding .}"/>
                        </RelativeLayout.GestureRecognizers>
                    </RelativeLayout>
                </ViewCell>
            </DataTemplate>
        </ListView.GroupHeaderTemplate>
    </ListView>

Please find the attachment for your reference

CoreMethods.PushPageModel not working

$
0
0

@MichaelRidland , after calling CoreMethods.PushPageModel nothing happens, no exception is thrown and the page I am trying to push is not displayed. Can you please demystify for me? Thanks.


ListView does not take all the space inside Grid

$
0
0

Hello folks,

I start developing in Xamarin, and I have a problem with my MasterPage, and more precisely with my ListView which doesn't take all the space provided by the Grid. Just the first element of my ListView is displayed and to see the others there is a scrollbar.

Here is the code :

    <?xml version="1.0" encoding="utf-8" ?>
    <ContentPage xmlns="xxxx://xamarin.com/schemas/2014/forms"
                 xmlns:x="xxxx://schemas.microsoft.com/winfx/2009/xaml"
                 xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
                 prism:ViewModelLocator.AutowireViewModel="True"
                 xmlns:ViewModels="clr-namespace:MyApp.ViewModels"
                 xmlns:ViewsNavigation="clr-namespace:MyApp.Views.Navigation"
                 x:Class="MyApp.Views.Navigation.MasterPage"
                 xmlns:ffSvg="clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms">

        <ContentPage.Content>
            <Grid BackgroundColor="Transparent" VerticalOptions="FillAndExpand">
                <Grid.RowDefinitions>
                    <RowDefinition Height="100" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid>
                    <Label Text="M. Tytyroot" TextColor="Black" FontSize="Large" Grid.Row="0"/>
                    <ListView ItemsSource="{Binding Functionnalities}" SeparatorVisibility="None" Grid.Row="1">
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <ViewCell>
                                    <ViewCell.View>
                                        <StackLayout Orientation="Horizontal" HorizontalOptions="Start" Margin="20,10,20,0">
                                            <ffSvg:SvgCachedImage Source="{Binding IconPath}" HeightRequest="30" WidthRequest="30" Margin="0,0,10,0"/>
                                            <Label Text="{Binding Title}"/>
                                        </StackLayout>
                                    </ViewCell.View>
                                </ViewCell>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                </Grid>
            </Grid>
        </ContentPage.Content>

    </ContentPage>

What is the problem?

Thanks in advance

Where did the packages.config in android project go ?

$
0
0

Hello guys I found out that when create a new xamarin.Forms project you get a netstandard project, which is cool, but regarding the android project I do not get packages.config file .
I believe this is causing a problem when trying to install some nuget packages specifically "Xamarin.Facebook.Android" package .

So is there an easy way to convert the project to be able to use packages.config instead of including the packages inside the proj file ?

Getting Error for Native linking failed or Error after upgrade Xamarin Studio version

$
0
0

Getting Error for Native linking failed or Error after upgrade Xamarin Studio version

Error Details Are:

MTOUCH: error MT5209: Native linking error: warning: ignoring file /Users/chetu/Desktop/Tusshar/NewPSN/PsnAmcApp/App12/App12.iOS/obj/iPhoneSimulator/Debug/mtouch-cache/libMTSCRA.a, missing required architecture x86_64 in file /Users/chetu/Desktop/Tusshar/NewPSN/PsnAmcApp/App12/App12.iOS/obj/iPhoneSimulator/Debug/mtouch-cache/libMTSCRA.a (3 slices)

MTOUCH: error MT5211: Native linking failed, undefined Objective-C class: MTSCRA. The symbol '_OBJC_CLASS_$_MTSCRA' could not be found in any of the libraries or frameworks linked with your application.

MTOUCH: error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/chetu/Desktop/Tusshar/NewPSN/PsnAmcApp/App12/App12.iOS/obj/iPhoneSimulator/Debug/Entitlements.xcent

MTOUCH: error MT5202: Native linking failed. Please review the build log.

Please find the solution for it..what can i do to fix it. it's urgent for me.

Grid layout clipped off bottom; Not clipped after phone orientation changed.

$
0
0

I have a grid layout which is clipped off at the bottom.

After rotating the phone to horizontal or vertical, the clipping is then fixed and doesn't come back, no matter what orientation the phone is.

So it looks like something is going on during the initialisation, but I can't at all see where.

Most annoying is that it was working fine before. No idea what I changed though. It's a pretty complex page.

Has anyone else encountered an issue like this?

Thanks.

How to make a navigation drawer menu and tab page in xamarin.forms

NullReferenceException when Binding to an Entry control on Android

$
0
0

Greets,

I've created a ViewModel and implemented the INotifyPropertyChanged interface. I only have one property, a string called "Name". I have the following code in the constructor of my ContentPage class:

XamlViewModel viewModel = new XamlViewModel(); this.BindingContext = viewModel; InitializeComponent(); viewModel.Name = "Hello World!";

The 'Name' property calls my OnPropertyChanged() method which in turn calls the PropertyChanged event on the interface. Inside the ContentPage element in the XAML, I have the following single line:

<Entry Text="{Binding Name, Mode=TwoWay}" />

When changing the name property as I did above, the call to PropertyChanged throws a NullReferenceException. I've verified that the ViewModel, property name and event are all non-null, so it appears to be something internal to the binding when the notification is raised.

Is there something that I am doing incorrectly?

Regards,

Joe

toolbar back button

$
0
0

I want to change the navigation of back button in toolbar. I have 3 pages main page, login page and profile page. After successful login it is navigated to profile page. Form profile page when back button is clicked it navigates back to login page, but i need to navigate to main page. Please do let me know how can I solve this.


Xamarin.Forms example code don't deploy into android device emulator

$
0
0

Hi,
I am newbie about xamarin and I need understand why the deploy process take a looong time to move my apk app to emulated device.
I am using

  • VS2017 15.6.4
  • Xamarin 4.9.0.752
  • Xamarin Designer -4.10.58
  • Xamarin.Android.SDK 8.2.0.16
  • Xamarion.iOS and Xamarin.Mac SDK 11.8.1.28
  • XamarinCRM - Android example (Xamarin Forms)

After be waiting for one hour I decided going to the option Build-> Cancel and stop the deploy: This is the output: from build window:

1>C:\Program Files (x86)\Android\android-sdk\build-tools\27.0.3\zipalign.exe 4 "C:\Users\rolando\Downloads\app-crm-master\app-crm-master\src\MobileApp\XamarinCRM.Android\obj\Debug\android\bin\com.xamarin.xamarincrm.apk" "bin\Debug\com.xamarin.xamarincrm-Signed.apk"
1>C:\Program Files (x86)\Android\android-sdk\build-tools\27.0.3\apksigner.BAT sign --ks "C:\Users\rolando\AppData\Local\Xamarin\Mono for Android\debug.keystore" --ks-pass pass:android --ks-key-alias androiddebugkey --key-pass pass:android --min-sdk-version 17 --max-sdk-version 27 bin\Debug\com.xamarin.xamarincrm-Signed.apk
1>Done building project "XamarinCRM.Android.csproj" -- FAILED.
1>
1>Deploy failed on VisualStudio_android-23_arm_phone
1>Process was cancelled
Build has been canceled.

Customize picker popup on XF?

$
0
0

Is there any way to either decrease the font size or increase the window size of the picker's popup window?

I have some long text that's cutoff when making a selection.

How can I make an overlay MasterBehavior for a page for iOS?

$
0
0

I want that the menu from iOS to look like the one on the Android...

I think I need to write this, but what there?

     public partial class MainPage : MasterDetailPage
    {
            public MainPage()
            {

                InitializeComponent();

                switch(Device.RuntimePlatform)
                {
                    case Device.iOS:
                        MasterBehavior =  ********************;
                        break;

                    case Device.Android:
                        MasterBehavior = MasterBehavior.Popover;
                        break;
                }

                InitializeAsync().ConfigureAwait(false);

            }
    }

Creating Round Buttons with centered Image and Label

$
0
0

Hey together,

i'm quite new to xamarin forms and i would like to create some buttons like in the image linked next.

us.v-cdn.net/5019960/uploads/editor/ot/ox4hgakakrig.png

I tried something ike this:

<StackLayout Orientation="Horizontal">
            <Button ContentLayout="Top,-70" 
                    VerticalOptions="EndAndExpand"
                    HorizontalOptions="CenterAndExpand" 
                    Text="Label" 
                    FontSize="20"
                    Image="ic_home_white_72dp.png" 
                    WidthRequest="120" 
                    HeightRequest="120"  
                    BorderRadius="60" 
                    BackgroundColor="#3F51B5" 
                    TextColor="#FFFFFF" />

            <Button x:Name="button_app"
                    ContentLayout="Top,-70" 
                    VerticalOptions="EndAndExpand"
                    HorizontalOptions="CenterAndExpand" 
                    Text="Apps" 
                    FontSize="20"
                    Image="ic_apps_white_72dp.png" 
                    WidthRequest="120" 
                    HeightRequest="120"  
                    BorderRadius="60" 
                    BackgroundColor="#3F51B5" 
                    TextColor="#FFFFFF" />

            <Button ContentLayout="Top,-70" 
                    VerticalOptions="EndAndExpand"
                    HorizontalOptions="CenterAndExpand" 
                    Text="Telefon" 
                    FontSize="20"
                    Image="ic_phone_white_72dp.png" 
                    WidthRequest="120" 
                    HeightRequest="120"  
                    BorderRadius="60" 
                    BackgroundColor="#3F51B5" 
                    TextColor="#FFFFFF" />
            </StackLayout>

This is the output I'm getting
us.v-cdn.net/5019960/uploads/editor/e8/l0j5sqh1lrv1.png

How could i archive that the images in the buttonsare getting centered? Maybe with a custom button?

Modal page with dismiss/close button.

$
0
0

Hello,
I would like to open a modal page that have a navigation bar with a "X" (cross) at the top left of the page to close/dismiss the page, like showed in Android documentation about bottom sheets

Do you have any idea how can I achieve that in Xamarin.Forms ?

Thanks !

Viewing all 77050 articles
Browse latest View live


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