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

Entity Framework App Not Launching

$
0
0

I added the binarys for entity framework into the standard master detail application but when I launch my app it just get stucks I have included a screen shot of my program to see if I have referenced everything correctly.

Please let me no if there is something I need to enable to get this working


Picker ItemsSource not binding

$
0
0

I'm attempting to bind a Picker to an ObservableCollection and nothing displays. I have set up a second property, CategoryCount, to return the count of the collection, which correctly shows 2.

    <StackLayout Spacing="20" Padding="15">
        <Label Text="Category" FontSize="Medium" />
        <Picker ItemsSource="{Binding CategoryList}"  ItemDisplayBinding="{Binding Name}" SelectedItem="{Binding Item.Category}" />
        <Label Text="Category Count"/>
        <Label Text="{Binding CategoryCount}"/>
    </StackLayout>


public class ItemDetailViewModel : BaseViewModel
 {
    public ObservableCollection<Category> CategoryList;
    public string CategoryCount
    {
        get
        {
            return CategoryList.Count.ToString();
        }
    }
    public LedgerEntry Item { get; set; }

    public ItemDetailViewModel(LedgerEntry item)
    {
        Item = item;
        CategoryList = new ObservableCollection<Category>()
        {
            new Category(){Id = 1, Name="test"},
            new Category(){Id = 2, Name = "hallo"}
        };
        OnPropertyChanged("CategoryList");
    }
}


public class Category
  {
     public int Id { get; set; }
     public string Name { get; set; }
  }

I've tried changing it to a List of strings with proper values, and could not get that working either. Any thoughts on why I'm having this issue?

How to open navigation Page in Listview local:view ?

$
0
0

<DataTemplate> <StackLayout HorizontalOptions="FillAndExpand" BackgroundColor="White"> <local:NewListView/> </StackLayout> </DataTemplate>
In NewListView.xmal.cs
<Image Grid.Column="13" Source="Reply_UnChecked.png"> <Image.GestureRecognizers> <TapGestureRecognizer Tapped="OnClickReply" NumberOfTapsRequired="1" /> </Image.GestureRecognizers> </Image>
In NewListView.cs
private void OnClickReply(object sender, EventArgs e) { var page = new ReplyPage(); Navigation.PushAsync(page); System.Diagnostics.Debug.WriteLine("Replay Page Open"); }
when i tapped OnClickReply the Debug was showed but the page did not create and open

I already tried await navigation.pushasync but also did not open new page.

I think the local:??? is in listview, so the navigation.pushasync is not work.

How can i create and open the new page when upper case?

Sample for socket application

$
0
0

I need simple sample for socket in Xamarin Forms.

Dynamically changing editor height to accommodate multiple lines of text as needed

$
0
0

I want my editor to behave like the iOS messages app: at first it's just a single line, but as you type enough to add another line, the editor expands and its Y coordinate moves up (so that it doesn't fall offscreen). I read https://forums.xamarin.com/discussion/99124/how-to-show-multiple-lines-in-an-editor and it almost works. The biggest issue I have right now though is that the vertical centering gets screwed up. Here's what happens:
1. Initial startup, editor is sized correctly for a single line
2. Type enough to form a second line. The editor does correctly increase its height, however, now the vertical centering is screwed up. Text is top aligned.
3. Keep typing enough to add a 3rd line. As expected, height correctly changes, but now the text is correctly center aligned vertically
4. Keep typing enough to add a 4th line. Vertical centering screws up as in #2. The pattern keeps repeating: we keep alternating between correctly aligned (center) and top.

Attached are images for states 1, 2, 3 for a more illustrative example.
The code is very simple (as that link shows): the custom editor just simply does InvalidateMeasure when the text changes.

Once I get past that issue, my second issue is that I don't know how to make its Y coordinate adjust upward. In my test I made a grid with 2 rows 1 column (as that link suggested sticking your custom editor in an autosizing grid row). First/top row is a box view which I set a HeightRequest to 500. Second/bottom row is the editor which I didn't set any height values for. In reality the box view will be replaced with a different view, like a list or something, but box seemed easiest to test with. Anyway, the desired behavior is the same as the iOS message app: instead of the text box height expanding downward, the Y coordinate moves up and the height expands, so that the net effect is the box just grows taller (upward) and not downward. I would be OK with either the editor expanding upward and partially obscuring the contents above it, or with the layout adjusting both items so that the height of the upper row shrinks as the height of the lower (editor containing) one expands. Either works just as well.

Add badges Count in the navigation bar using Xamarin Forms

Could not install package 'Xamarin.GooglePlayServices.Base 42.1021.1'

$
0
0

Hi Team,

I have tried to install the NuGet Packages to Xamarin.Forms PCL Project, But the reference is successfully installed in root project but not installed in Android, iOS and etc. I got the following error information. Any solution for this?

Could not install package 'Xamarin.GooglePlayServices.Base 42.1021.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

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!

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 ?


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.

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.

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);

            }
    }
Viewing all 58056 articles
Browse latest View live


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