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

Pass Array as parameter in constructor in xaml

$
0
0

Hi.
I'm trying to pass an Array as an argument to a constructor in xaml, like this:

I'm filling the PartNumberDataList and PartNumberDataListID - arrays with values in the xaml.cs-file.

The constructor i'm calling is in another xaml-file:

public ListViewSearching(String sqlFunction="", string EntrySearchPlaceholder="", ObservableCollection<KeyValuePair<string, string>>[] SearchList = null,
            ObservableCollection<KeyValuePair<string, string>>[] SearchIDlist = null)
        {
            InitializeComponent();
            SqlFunction = sqlFunction;
            SearchDataList = (ObservableCollection<KeyValuePair<string, string>>) SearchList[0];
            SearchDataIDlist = (ObservableCollection<KeyValuePair<string, string>>)SearchIDlist[0];  
            EntrySearch.Placeholder = EntrySearchPlaceholder;
            FillSearchList();
        }

This will not run.
If I remove the arrays (from both xaml-file and constructor), it works fine. So the problem lies in the arrays.
Does anybody know, how to fix it?

Friendly Regards
nbs


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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