Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the equivalent of DataSource for a WPF ListBox?

I'm trying to set a Listbox from a txt file. I read the file and populate a list, then I want to display it in the listbox, but I have no Datasource option available (only DataContext and DataContextChanged).

My Listbox is declared in XAML :

    <ListBox Name="ScriptList"  
        Grid.Row="0"
        Grid.Column="1"
        TextBlock.FontSize="12"
        Margin="2" />

Any idea why ?

Also, is it the right way to proceed (read file ->

like image 709
ack__ Avatar asked Jan 20 '23 00:01

ack__


1 Answers

i've used ItemsSource and it works.

like image 138
ack__ Avatar answered Feb 04 '23 03:02

ack__