Just Code‎ > ‎

Silverlight - MVVM Hooking up the ViewModel in the view

posted May 20, 2010, 11:35 PM by Peter Henell   [ updated May 20, 2010, 11:43 PM ]
xmlns:vm="clr-namespace:Henell.ViewModel;assembly=Henell.ViewModel"


>

<UserControl.Resources> <vm:MerchantViewModel x:Key="vmMerchants" /> </UserControl.Resources> <TextBox x:Name="FilterTextbox"
Text="{Binding FilterListValue, Source={StaticResource vmMerchants}, Mode=TwoWay}"
TextChanged="FilterTextbox_TextChanged" Width="200" > </TextBox> <Button Name="FilterButton" Command="{Binding FilterCommand, Source={StaticResource vmMerchants}}" CommandParameter="{Binding FilterListValue, Mode=OneWay, Source={StaticResource vmMerchants}}" > <Button.Content> <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <Image Source="/Application;component/Resources/Images/search.png"/> <TextBlock Margin="5,0,0,0">Sök</TextBlock> </StackPanel> </Button.Content> </Button> <!-- Delegate the entire ViewModel to the Report usercontrol --> <uc:MerchantReports DataContext="{Binding Path=., Source={StaticResource vmMerchants}}" />
Comments