Search Results

Search found 2 results on 1 pages for 'muku'.

Page 1/1 | 1 

  • WPF Binding a textbox to a property of all items in a generic list

    - by muku
    Hello guys, What I want to do is simple. I have a generic list of objects. Let's say the object class contains a property named Height. What I want to do is bind a textbox's text in the UI with this list and when i change the value in the textbox then all objects in the list update their height value. I am new in WPF, I have studied the MVVM pattern, I can do simple data binding but i can't figure out how to do this :'( Thanks!

    Read the article

  • Bind a generic list to a listbox and also use a datatemplate

    - by muku
    Hello, I'm trying to implement something quite simple but I'm on my first steps in WPF and I'm having some problems. I have a class called Component which has a property called Vertices. Vertices is a generic List of type Point. What I want is to bind the vertices property to a listbox. This is easy by using this code in my XAML in the listbox declaration: ItemsSource="{Binding Path=Component.Vertices, Mode=OneWay, Converter={StaticResource verticesconverter},UpdateSourceTrigger=PropertyChanged}" The tricky part is when I try to create a datatemplate for the listbox. I want each row of the listbox to display a textbox with the values of the Vertex (Point.X, Point.Y) and a button to allow me to delete the item. Could you help me on the datatemplate definition. The code below doesn't work to bind the X,Y values into two separate textboxes. Could you point me on the mistake and why nothing is displayed in the textboxes? <ListBox ItemsSource="{Binding Path=Component.Vertices, Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" Margin="0,10,0,0"> <TextBox Text="{Binding X}" MinWidth="35" MaxWidth="35"/> <TextBox Text="{Binding Y}" MinWidth="35" MaxWidth="35"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> /ListBox>

    Read the article

1