10 Jun 2011

WPF XAML Data Binding Snippets

List Box with inline template

<ListBox  Grid.Row="1" Height="223" HorizontalAlignment="Left" ItemsSource="{Binding Source={StaticResource MatchBettingOtherMarketsViewSource}}" Margin="54,44,0,0"   VerticalAlignment="Top" Width="303" Grid.Column="1">
          <ListBox.ItemTemplate>
              <DataTemplate>
                  <StackPanel Orientation="Horizontal" >
                      <Label Margin="2" Content="{Binding Path=Market1.Name}" Style="{StaticResource MarketNameStyle}" HorizontalAlignment="Stretch" />
                     
                      <Label Margin="2"  Width="200" Height="20" Content="{Binding Path=SelHome.PriceForDisplay}"  Style="{StaticResource OddStyle}"/>
                      <Label Margin="2" Content="{Binding Path=SelHome.Name}" Style="{StaticResource MarketNameStyle}" HorizontalAlignment="Stretch" />
                 
                  </StackPanel>
              </DataTemplate>
          </ListBox.ItemTemplate>
      </ListBox>

No comments:

Post a Comment