Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

333
Views
How to bind the values of the itemsource (array of strings) to a label in a ListView

I have an array of strings, that I have set as the item source of a ListView. The ListView now has the same amount of rows as the array has elements. However I don't know what to set the binding as. I know for a Dictionary I set 'Value' which works fine.

string[] array = {"1","2","3"};
MyListView.ItemsSource = array;

XAML

<ListView x:Name="MyListView">
    <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <Label Text="{Binding Value, StringFormat='The value : {0:N}'}" />
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

If you want to bind directly to the value of the object itself, use the "." syntax for the path

<Label Text="{Binding .}" />
over 4 years ago · Santiago Trujillo Report

0

To bind directly to the object you should use:

<Label Text="{Binding}" />

This is shorthand for:

<Label Text="{Binding Path=.}" />
over 4 years ago · Santiago Trujillo Report

0

In (MVVM/Code-Behind/C#), I had a similar problem with an array of strings and resolved it with the following code.

someLabel.SetBinding(Label.TextProperty, new Binding("."));

I hope this helps someone =)

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!