Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Window x:Class="ViewModelSampleClient.Window1">
- <Grid>
- <Label Grid.Column="0" Grid.Row="0">First Name</Label>
- <TextBox Grid.Column="1" Grid.Row="0" x:Name="FirstName"/>
- <Label Grid.Column="2" Grid.Row="0">Last Name</Label>
- <TextBox Grid.Column="3" Grid.Row="0" x:Name="LastName"/>
- <Label Grid.Column="0" Grid.Row="1">Address</Label>
- <TextBox Grid.Column="1" Grid.Row="1" x:Name="Address"/>
- <Label Grid.Column="0" Grid.Row="2">City</Label>
- <ListBox Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="2" Width="200" HorizontalAlignment="Left" x:Name="Cities" SelectionMode="Multiple" >
- <ListBox.ItemTemplate>
- <DataTemplate>
- <StackPanel vm:ViewBinder.TemplateKey="City">
- <Label x:Name="CityName"/>
- </StackPanel>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- <Button Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="4" Height="30" Width="100" x:Name="Save" Content="Save"/>
- </Grid>
- </Window>
- public void ExplicitBindWithConventions(ContactViewModel vm)
- {
- Binder = new ViewBinder<ContactViewModel>(this, vm);
- Binder.BindValue(p => p.FirstName);
- Binder.BindValue(p => p.LastName);
- Binder.BindValue(p => p.Address);
- Binder.BindList(p=>p.Cities);
- Binder.BindAction(p => p.Save());
- var templateBinder = Binder.BindTemplate<City>("City");
- templateBinder.BindValue<Label>(p => p.CityName);
- Binder.Bind();
- }
Add Comment
Please, Sign In to add comment