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

The 'XamarinInspectorPackage' package did not load correctly

$
0
0

Hi,

I get this message when loading Visual Studio:

The 'XamarinInspectorPackage' package did not load correctly.

>

The problem may have been caused by a configuration change or by examining the file 'C:\blah blah\ActivityLog.xml'.

>

Restarting Visual Studio could help resolve the issue.

>

Continue to show this error message?


Xamarin Forms Application issues when deploying

$
0
0

We started testing our app on android and while in general it works well we ran into an odd issue

Right after installing the APK and starting the app and then using the home button and then clicking on the app again it did things that shouldnt happen. Problem was the app is using a passcode screen on resume and so i thought it was some of my code. The problem does not happen in the simulator or running on the device in the debugger. The only time this happens is from an APK install

i removed a bunch of my code to try an track this down but so far nothing. What happens is that right after installing and launching the app the screen comes up. Hit the home button. click the app icon again, click the home button, click the app icon again and now all i get is a white screen. If i hit the home button again and the icon again and do this a few more times when i am on the white screen and use the back button it goes back one time for each use of the home button and then on the final one it crashes.

in order to hunt this issue down i created a simple app in Visual Studio. Just the default application (portable) and deployed as an APK and sure enough it is doing a similar thing

After installing and launching the main screen shows
hit home button
hit app icon again and it shows the main screen
hit home button
hit app icon again and it shows the main screen
hit home button
hit app icon again and it shows the main screen

now if you hit the back button the screen flashes and shows the main screen again (almost like navigating back but i dont have a regular contentpage as a mainpage).
the back button does this for as often as you did the home button/app icon thing above and then you go back to the phone screen

it only does all this the first time it is launched after installing.

so my questions.

1) Anyone have any idea what this could be?

2) In a case like this (only a release APK will show the issue) how can i debug a problem like this?

thanks for any help

Values are not entering to model,its displaying null in model

$
0
0

values are entering to result but I am not getting a values inside the model. please help me with a solution sir

How to access a property of a class in a DetailPage

$
0
0

Hello everybody,

I have a simple application which displays a list of "Patrimoine" objects in Page1 and a DetailPage displays the details of the selected object (title, year and location on the map).

The "Patrimoine" class also has two "Longitude" and "Latitude" properties that I would like to retrieve in the DetailPage in order to put a Pin on the map.

However, I can not retrieve Longitude and Latitude to feed the method that adds a Pin to the map.

Class Patrimoine :

    public class Patrimoine
        {
            public string Titre { get; set; }
            public string Annee { get; set; }
            public double latitude { get; set; }
            public double longitude { get; set; }
            public Position position { get; set; }
        }

Page1 :

    public Page1()
            {
                InitializeComponent();
                listePatrimoine.ItemsSource = ListePatrimoine;

                var Eglise = new Patrimoine() { Titre = "Eglise", Annee = "1980", latitude = 48.8584, longitude = 2.2945 };
                var Mairie = new Patrimoine() { Titre = "Chemin", Annee = "/", latitude = 48.8584, longitude = 2.2945 };
                ListePatrimoine.Add(Eglise);
                ListePatrimoine.Add(Mairie);
            }

            private async void listePatrimoine_ItemSelectedAsync(object sender, SelectedItemChangedEventArgs e)
            {
                if (listePatrimoine.SelectedItem != null)
                {
                    var detailpage = new DetailPage();
                    detailpage.BindingContext = e.SelectedItem as Patrimoine;
                    listePatrimoine.SelectedItem = null;
                    await Navigation.PushModalAsync(detailpage);
                }
            }

And DetailPage :

public partial class DetailPage : ContentPage
        {
            public DetailPage()
            {
                InitializeComponent();
                Patrimoine patrimoine = (Patrimoine)this.BindingContext;
                Position Xposition = new Position(patrimoine.latitude, patrimoine.longitude);
                Pin pin = new Pin
                {
                    Type = PinType.Place,
                    Position = Xposition,
                    Label = patrimoine.Titre
                };
                map.Pins.Add(pin);
            }
            private async void dismissButton_ClickedAsync(object sender, EventArgs e)
            {
                await Navigation.PopModalAsync();
            }
        }

Thank you for your help.

HeaderTempate on ListView

Binding TimePicker Time property with DateTime Now on xaml

$
0
0
 Why is the binding on xaml doesnt work below

xmlns:sys="clr-namespace:System;assembly=mscorlib"

 <TimePicker x:Name="timer" Time="{x:Static sys:DateTime.Now.TimeOfDay}"  Grid.Row="2" Grid.Column="0"/>

while if I set on code behind like this works fine

timer.Time = System.DateTime.Now.TimeOfDay;

How to add Button with Tabbed Page Header Title in Xamarin forms

$
0
0

Hi , In Xamarin forms , i am using Tabbed Page , is it Possible to Add a Button with Tabbed Page Header Title for iOS App.

OnToolbar Item Click Navigation New Content-Page Toolbar Floating Right To Left On Android

$
0
0

Hi,

I am using xamarin forms. on page i have right toolbar like this
var addFakeRequest = new ToolbarItem
{
BindingContext = BindingContext,
Text = "Add New Request",
Order = ToolbarItemOrder.Secondary,
};
addFakeRequest .BindingContext = BindingContext;
addFakeRequest .SetBinding(MenuItem.CommandProperty, FakeRequestVM.AddTaskCommandPropertyName);
ToolbarItems.Add(addFakeRequest );

and on Command Click

public async Task AddNewRequestAsync()
{

        await _navigation.PushAsync(new CreateNewFakeRequest(_navigation));

    }

Onclick on toolbar item navigating to new CreateNewFakeRequest Page toolbar is floating right to left on android !
on UWP Working Fine!
how to avoid it?


Xamarin Cross-platform PCL GetStringAsync error

$
0
0

i am currently learning how to develop cross-platform app i came across a bug , i don't know if it's bug or not but when i try to use the funciton GetStringAsync as showing in below image it cause an error anyone could help please ?

and here is the error with no exception detials

for the PCL Project i have added through nuget Microsoft.Net.Http and for android prject i have added System.Net.Http

NullReferenceException on Grid.CalculateAutoCells [Only XF iOS]

$
0
0

Hi,

I'm developing an app with Xamarin Forms from 7 months.
My app worked very well.
I have done 1 month on Android side, because I fixed some bugs and added some features.

Today I have ported these mods on iOS side and now I have a NullReferenceException on Grid, when I scroll the List View. (On Android all works perfectly)

Here's what happens:
- I open the page that contains the list
- The list is loaded and displayed correctly
- If I try to scroll through the list, appears this exception

Stack Trace:

at Xamarin.Forms.Grid.CalculateAutoCells (System.Double width, System.Double height) [0x00357] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\GridCalc.cs:144 at Xamarin.Forms.Grid.MeasureGrid (System.Double width, System.Double height, System.Boolean requestSize) [0x0000c] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\GridCalc.cs:483 at Xamarin.Forms.Grid.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x0000e] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\GridCalc.cs:17 at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x000c7] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:229 at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:194 at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:629 at Xamarin.Forms.Layout+<>c.<OnChildMeasureInvalidated>b__39_0 () [0x00080] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:332 at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/src/Foundation/NSAction.cs:163 at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/src/UIKit/UIApplication.cs:79 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/src/UIKit/UIApplication.cs:63 at MusiDownPortable.iOS.Application.Main (System.String[] args) [0x00008] in /Users/steebono/SourceTree/musidown/MusiDownPortable/MusiDownPortable/MusiDownPortable.iOS/Main.cs:17

Sometimes scroll works but when I try to reload list I have this exception:

Second StackTrace:

at Xamarin.Forms.Grid.GetLastAutoColumn (Xamarin.Forms.BindableObject child) [0x00016] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\GridCalc.cs:657 at Xamarin.Forms.Grid.ExpandLastAutoColumnIfNeeded (System.Double width, System.Boolean expandToRequest) [0x00024] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\GridCalc.cs:331 at Xamarin.Forms.Grid.MeasureGrid (System.Double width, System.Double height, System.Boolean requestSize) [0x0013a] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\GridCalc.cs:520 at Xamarin.Forms.Grid.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x0000e] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\GridCalc.cs:17 at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x000c7] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:229 at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:194 at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:629 at Xamarin.Forms.Layout+<>c.<OnChildMeasureInvalidated>b__39_0 () [0x00080] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:332 at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/Foundation/NSAction.cs:163 at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:79 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:63 at MusiDownPortable.iOS.Application.Main (System.String[] args) [0x00008] in /Users/steebono/SourceTree/musidown/MusiDownPortable/MusiDownPortable/MusiDownPortable.iOS/Main.cs:17

XAML Code:

<ListView x:Name="listView" ItemSelected="OnItemSelected" IsVisible="False" HasUnevenRows="False" RowHeight="50" IsPullToRefreshEnabled="True" Refreshing="mySongs_OnRefreshing"> <x:Arguments> <ListViewCachingStrategy>RecycleElement</ListViewCachingStrategy> </x:Arguments> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <ViewCell.ContextActions> <MenuItem Clicked="mySongDelete_OnClicked" CommandParameter="{Binding .}" Text="Delete" IsDestructive="True" /> </ViewCell.ContextActions> <Grid> <Grid.RowDefinitions> <RowDefinition Height="50" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="5" /> <ColumnDefinition Width="35" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="35" /> <ColumnDefinition Width="5" /> </Grid.ColumnDefinitions> <ff:CachedImage Source="{Binding FavoriteIcon}" CacheDuration="1" RetryCount="1" Aspect="AspectFit" HorizontalOptions="StartAndExpand" Grid.Row="0" Grid.Column="1"> <ff:CachedImage.GestureRecognizers> <TapGestureRecognizer Tapped="onClick_Favorite"/> </ff:CachedImage.GestureRecognizers> </ff:CachedImage> <Label Text="{Binding Title}" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" LineBreakMode="TailTruncation" FontSize="Medium" Grid.Row="0" Grid.Column="2" /> <ff:CachedImage Source="{Binding MenuIcon}" CacheDuration="1" RetryCount="1" Aspect="AspectFit" HorizontalOptions="EndAndExpand" Grid.Row="0" Grid.Column="3"> <ff:CachedImage.GestureRecognizers> <TapGestureRecognizer Tapped="onClick_Menu"/> </ff:CachedImage.GestureRecognizers> </ff:CachedImage> </Grid> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView>

C# Code:

Inside OnAppearing():

`

// Other code here

listView.ItemSource = _myListItems;

// Other code here

`

My List is declared as:

`

private ObservableCollection<MyItemEntry> _myListItems = new ObservableCollection<MyItemEntry>();

`

MyItemEntry object is a class derived from INotifyPropertyChanged

I have an event that load and reload the list if needed:

`

        // Other code here

        // Start async operation
                Task.Run(() =>
                {
                    // Clear List
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        if (_myListItems.Any()) _myListItems.Clear();
                    });
                    // Get refreshed list.
                    var myList = DependencyService.Get<IItemHandler>().ReadItem;

                    if (myList.Any())
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            foreach (var itemDataEntry in myList)
                            {
                var menuIcon = "Menu100.png";
                                var favoriteIcon = itemDataEntry.Favorite ? "Favfill.png" : "Fav100.png";
                                _myListItems.Add(new MyItemEntry
                                {
                                    FavoriteIcon = favoriteIcon,
                                    MenuIcon = menuIcon,
                                    Title = decSong
                                });
                            }
                            if (_mySongsItems.Any())
                            {
                                Device.BeginInvokeOnMainThread(() =>
                                {
                                    listView.IsVisible = true;
                                    loadingIndicator.IsVisible = false;
                                    loadingIndicator.IsRunning = false;
                                    layoutDataInfo.IsVisible = false;
                                    lbDataInfo.IsVisible = false;
                                });
                            }
                            else
                            {
                                Device.BeginInvokeOnMainThread(() =>
                                {
                                    listView.IsVisible = false;
                                    loadingIndicator.IsVisible = false;
                                    loadingIndicator.IsRunning = false;
                                    layoutDataInfo.IsVisible = true;
                                    imgDataInfo.IsVisible = true;
                                    lbDataInfo.IsVisible = true;
                                });
                            }
                        });
                    }
                    else
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            listView.IsVisible = false;
                            loadingIndicator.IsVisible = false;
                            loadingIndicator.IsRunning = false;
                            layoutDataInfo.IsVisible = true;
                            imgDataInfo.IsVisible = true;
                            lbDataInfo.IsVisible = true;
                        });
                    }
                });

// Other code here for update list if needed

`

This codes on Android work perfectly. On iOS this codes work perfectly but if i try to scroll the list, I have that Exception.

A important thing is that this Event do not fire when I scroll the List.
I think that my code is not the cause of this Exception, because this happend only if I scroll
If I open the page and after do nothing, all work perfectly. I do not manage in any way scrolling or similar.

I have viewed the code of Xamarin Libraries and seems That Grid.ColumnDefinitions at some point became null.

First StackTrace say:

at Xamarin.Forms.Grid.CalculateAutoCells (System.Double width, System.Double height) [0x00357] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\GridCalc.cs:144

In this line there is a for cycle:

for (var i = 0; i < _columns.Count; i++)

Second StackTrace say:

at Xamarin.Forms.Grid.CalculateAutoCells (System.Double width, System.Double height) [0x00357] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\GridCalc.cs:657

In this line there is a if with same variable of first stacktrace:
if (_columns[i].Width.IsAuto)

so I think that the null reference exception is caused by _columns var.
As you can see in my xaml code I have set ColumnDefinitions.

This error happens when the list has already been created and displayed so.. someone set this to null at some point or Layout.UpdateChildrenLayout fails to get ColumnDefinitions value?

Another observation is that I set ItemSource of listView inside OnAppearing method; when I reload page, I clear my list object and I re-insert all updated items to list. But I think that this is not a problem because my list's items derived from INotifyPropertyChanged and my list is a ObservableCollecion list.

Xamarin Mac Env: last version iOS: 10.1 Xamarin Forms: 2.3.3.168 / 2.3.3.180 (Tried both)

Sorry for my english.

Thanks,
Stefano

The root assembly conflicts with another assembly

$
0
0

Hi, after updating my Xamarin for Visual Studio it shows

Severity Code Description Project File Line Suppression State
Error The root assembly /Users/focus/Library/Caches/Xamarin/mtbs/builds/Sample.iOS/f4117d8ec82f837c5c099ce86166d4d3/bin/iPhoneSimulator/Debug/Sample.iOS.exe conflicts with another assembly (/Users/focus/Library/Caches/Xamarin/mtbs/builds/Sample.iOS/f4117d8ec82f837c5c099ce86166d4d3/bin/iPhoneSimulator/Debug/Sample.iOS.exe).

while building the ios project help me for solving this.
Thank you.

Preview: Xamarin.Forms Embedding

is it possible to desing UI in native project and the rest pf the code in PCL for xamarin.forms ?

$
0
0

I am developing for Android and IOS and i want to ask which is the best approach to design the UI? there are not a lot of libraries that support UI in PCL project, and it seems better to design the UI natively for each the android and IOS.
Would this approach effect the business logic and data that i would develop in the PCL project and when i want to communicate with the UI would that mean i should write the code twice for each UI since the ID(s) are different for the UI views ?

Targeting .NET Standard

$
0
0

I read this article a while ago:
https://blog.xamarin.com/net-standard-library-support-for-xamarin/

So, I converted all of our libraries from portable libraries to .NET Standard (1.4). I did this because the article says "This PCL now needs to be upgraded to target the .NET Standard Library, which can be found in the projects properties.".

However, I can't figure out how to build a Xamarin Forms project that targets .NET Standard. I cloned the Xamarin Forms samples, and opened up the MasterDetailPage project. I went in to the project properties and switched from portable to .NET Standard as per the instructions. Immediately, I get an error telling me that I need to opt in to NuGet 3.0 support. I'm fine with this, but how do I do it?

I found that if I remove the Xamarin Forms NuGet package, I am able to switch over to .NET Standard. However, once I have done this, I can't add the Xamarin Forms NuGet package back. It just keeps failing. Contrary to what the article says, I cannot add references to .NET Standard libraries. When I try to add a reference to existing .NET Standard libraries in my Solution, Visual Studio just gives me an error saying that the library is not compatible. Which version of .NET Standard should I be targeting for Xamarin Forms?

How do I get a .NET Standard library compiling with Xamarin Forms support?

Cross-Platform missing when adding a new item

$
0
0

I have installed Visual Studio 2017 to follow along with online training for Xamarin created in May. I have created a Xamarin Cross Platform app, Blank App with Xamarin.Forms and PCL. They then instructed us to right click on the PCL, select Add new item and then select Cross-Platform. I did not have Cross-Platform as an option. I found a post for an older version of Visual Studio where they showed how to add it manually. I did this and it created the Cross-Platform item but this only contained four options instead of the ten in the video. Has this been taken away in a newer release or do I need to do something to add all the items? Many thanks


[help] - How to add icon with badges on ToolBarItem ?

$
0
0

Hi everyone ,

I have a problem with NavigationBar, i can`t add badges BarButtomItem.
Someone has any solution for this problem ?

Thank you so much!

Let's talk performance

$
0
0

As we continue to release performance focused features and fixes, and build processes around performance, I want to have a thread dedicated to those items.

Our public roadmap itemizes the feature work we are doing and planning to do, and items related to performance are tagged. In addition to that, we are building into our CI processes ways to measure and compare performance metrics. The goal is that with specific commits and builds we can get visibility to any impact on speed and memory usage.

One of the initiatives I'm spearheading is to populate a solution with UIs that are representative of your applications. To that end, I'm asking you to consider sharing those layouts with us. Perhaps the best way to gather them would be to open a repository and have you submit pull requests. I'll get working on that next and post details here.

Fast Renderers for Android are now merged and in nightly and will be our next pre-release. I hope some of you will take some time to test them out and report back here with your findings.

Binding value to property of a custom view exception

$
0
0

Hey.

I created a custom view named PreviewImageSliderView to preview a list of sample images.
The custom view is not accessible by name, so I have to bind the value via a property, like this: <local:PreviewImageSliderView SampleImages="{Binding Images}" />
The code beneath throws this error: Can not assign property "SampleImages": Property does not exists, or is not assignable, or mismatching type between value and property

The code where it is used. The others bindings from this code work perfectly, except: SampleImages="{Binding Images}"

                                            <ListView.ItemTemplate>
                                                <DataTemplate x:Key="InterHistoryTemplate">
                                                    <ViewCell>
                                                        <StackLayout Spacing="2" Orientation="Vertical">
                                                            <StackLayout Spacing="4" Orientation="Horizontal"
                                                                HorizontalOptions="Start" HeightRequest="22"
                                                                Padding="20,0,0,0">
                                                                <Label Style="{StaticResource InterventionContentTextStyle}"
                                                                     Text="{Binding PassageHeure}" />
                                                                <Label Style="{StaticResource InterventionContentTextStyle}"
                                                                     FontSize="17" Text="{Binding Name}" />
                                                                <Label Style="{StaticResource InterventionContentTextStyle}"
                                                                     Text=" - " />
                                                                <Label Style="{StaticResource InterventionContentTextStyle}"
                                                                     Text="{Binding Profession}" />
                                                            </StackLayout>
                                                            <local:PreviewImageSliderView SampleImages="{Binding Images}" />
                                                        </StackLayout>
                                                    </ViewCell>
                                                </DataTemplate>
                                            </ListView.ItemTemplate>
                                        </ListView>

The code of the custom view:

    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.IO;
    using Xamarin.Forms;
    using System.ComponentModel;

    namespace ***
    {
        public partial class PreviewImageSliderView : ContentView
        {
            private ObservableCollection<SampleImageModel> previewImagesByte = new ObservableCollection<SampleImageModel>();

            //properties
            public static readonly BindableProperty SampleImageProperty = BindableProperty.Create(nameof(SampleImages),
                        typeof(ObservableCollection<SampleImageModel>),
                        typeof(PreviewImageSliderView),
                        null, BindingMode.OneWay,
                        propertyChanging: SampleImagesChanged);

            public ObservableCollection<SampleImageModel> SampleImages
            {
                get { return (ObservableCollection<SampleImageModel>)GetValue(SampleImageProperty); }
                set { SetValue(SampleImageProperty, value); }
            }

            public PreviewImageSliderView()
            {
                InitializeComponent();
            }

            public static void SampleImagesChanged(object bindable, object oldValue, object newValue)
            {
                PreviewImageSliderView previewer = bindable as PreviewImageSliderView;

                ObservableCollection<SampleImageModel> values = (ObservableCollection<SampleImageModel>)newValue;
                Device.BeginInvokeOnMainThread(() =>
                {
                    foreach (SampleImageModel image in values)
                    {
                        previewer.images.Children.Add(new Image
                        {
                            HeightRequest = EntractesConstants.SamplePhotoHeight,
                            Source = ImageSource.FromStream(() => { return new MemoryStream(image.SampleImageByte); }),
                        });
                    }
                });
            }
        }
    }

The model used for binding:

    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.ComponentModel;

    namespace ****
    {
        public class PersonHistoryModel : INotifyPropertyChanged
        {
            public string PassageHeure { get; set; }
            public string Name { get; set; }
            public string Profession { get; set; }
            public string NumeroConsult { get; set; }
            public ObservableCollection<SampleImageModel> images { get; set; } = new ObservableCollection<SampleImageModel>();
            public ObservableCollection<SampleImageModel> Images
            {
                get
                {
                    return images;
                }
                set
                {
                    images = value;
                    OnPropertyChanged(nameof(Images));
                }
            }
            public PersonHistoryModel(string passageHeure, string name, string profession, string numeroConsult)
            {
                PassageHeure = passageHeure;
                Name = name;
                Profession = profession;
                NumeroConsult = numeroConsult;
            }

            public event PropertyChangedEventHandler PropertyChanged;
            protected virtual void OnPropertyChanged(string propertyName)
            {
                if (PropertyChanged == null)
                    return;
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public class GroupedDayHistoryModel : ObservableCollection<PersonHistoryModel>
        {
            public string PassageDate { get; set; }
        }
    }

I tried to bind a element of type string, it is not working.
It worked when I send just a simple string, no binding.
Can someone help me, please.

Thanks in advanced.

how to trigger the back arrow button on the master header xamarin forms

$
0
0

when i clicked the back arrow it needs to navigate the another page (note: i already tried with the OnBackButtonClicked, Its an hardware supported).

How to pass value from binding in the command Parameter in a switch?

$
0
0

Please help me out.

Thank you
shreyanka

Viewing all 91519 articles
Browse latest View live


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