ItemsControl Name="ItemsList" BorderThickness="0"
ItemsSource="{Binding ElementName=ThisControl, Path=NotifyContent}"
ItemTemplate="{StaticResource ItemsTemplate}" >
<ItemsControl.ItemsPanel>
remplir une list avec un contenu extern
{Binding ElementName=ThisControl, Path=NotifyContent}
elementname=l'objet source de l'information comme le id dans html
le path=la propriete voulu
http://msdn.microsoft.com/fr-fr/library/ms752347.aspx#creating_a_binding

ItemsSource="{Binding ElementName=ThisControl, Path=NotifyContent}"
ItemTemplate="{StaticResource ItemsTemplate}" >
<ItemsControl.ItemsPanel>
remplir une list avec un contenu extern
{Binding ElementName=ThisControl, Path=NotifyContent}
elementname=l'objet source de l'information comme le id dans html
le path=la propriete voulu
http://msdn.microsoft.com/fr-fr/library/ms752347.aspx#creating_a_binding
Basic but Verbose Binding to a Control
<StackPanel>
<TextBlock Width="248" Height="24" Text="Colors:"
TextWrapping="Wrap"/>
<ListBox x:Name="lbColor" Width="248" Height="56">
<ListBoxItem Content="Blue"/>
<ListBoxItem Content="Green"/>
<ListBoxItem Content="Yellow"/>
<ListBoxItem Content="Red"/>
<ListBoxItem Content="Purple"/>
<ListBoxItem Content="Orange"/>
</ListBox>
<TextBlock Width="248" Height="24" Text="You selected color:" />
<TextBlock Width="248" Height="24">
<TextBlock.Text>
<Binding ElementName="lbColor" Path="SelectedItem.Content"/>
</TextBlock.Text>
</TextBlock>
</StackPanel>
The code listed in Figure 1 can be modified slightly to use a shorthand syntax for data binding. For example, let's replace the TextBlock's <Binding> tag with the following code snippet:
<TextBlock Width="248" Height="24"
Text="{Binding ElementName=lbColor,
Path=SelectedItem.Content}" />
Aucun commentaire:
Enregistrer un commentaire