ObjectDataProvider
Class MyIntIsHere Dim a As Integer Public Property myA() as Integer Get Return a End Get Set(ByVal value as String) a=value End Set End Property Public Sub New(_a as Integer) a=_a End sub End Class Class DisplayIt Private lst As New List(of MyIntIsHere) Public Sub New() End Sub Public Function ShowIt() as List(of MyIntIsHere) lst.Add(new MyIntIsHere(1)) return lst End Function End Class
<Window.Resources> <ObjectDataProvider x:key="MyProvider" ObjectType="{x:Type local:DisplayIt}" MethodName="ShowIt"/> </Window.Resources> Now i want to display it in a ListBox : <ListBox ItemsSource="{Binding Source={StaticResource MyProvider}}" and other things > <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Path=myA}"/> </DataTemplare> </ListBox.ItemTemplate> </ListBox>
MyIntIsHere
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)