|
Cet article a fait l'objet d'une traduction automatique. Déplacez votre pointeur sur les phrases de l'article pour voir la version originale de ce texte. Informations supplémentaires.
|
Traduction
Source
|
RelativeSource, classe
Espace de noms : System.Windows.Data
Assembly : PresentationFramework (dans PresentationFramework.dll)
XMLNS pour XAML : http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Le type RelativeSource expose les membres suivants.
| Nom | Description | |
|---|---|---|
![]() | RelativeSource() | |
![]() | RelativeSource(RelativeSourceMode) | |
![]() | RelativeSource(RelativeSourceMode, Type, Int32) |
| Nom | Description | |
|---|---|---|
![]() | AncestorLevel | |
![]() | AncestorType | |
![]() | Mode | |
![]() ![]() | PreviousData | |
![]() ![]() | Self | |
![]() ![]() | TemplatedParent |
| Nom | Description | |
|---|---|---|
![]() | Equals(Object) | |
![]() | Finalize | |
![]() | GetHashCode | |
![]() | GetType | |
![]() | MemberwiseClone | |
![]() | ProvideValue | |
![]() | ShouldSerializeAncestorLevel | |
![]() | ShouldSerializeAncestorType | |
![]() | ToString |
| Nom | Description | |
|---|---|---|
![]() ![]() | ISupportInitialize.BeginInit | |
![]() ![]() | ISupportInitialize.EndInit |
<Style x:Key="textBoxInError" TargetType="{x:Type TextBox}"> <Style.Triggers> <Trigger Property="Validation.HasError" Value="true"> <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/> </Trigger> </Style.Triggers> </Style>
<!--ControlTemplate for NumericUpDown that inherits from Control.--> <Style TargetType="{x:Type local:NumericUpDown}"> <Setter Property="HorizontalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:NumericUpDown}"> <Grid Margin="3"> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Border BorderThickness="1" BorderBrush="Gray" Margin="2" Grid.RowSpan="2" VerticalAlignment="Center" HorizontalAlignment="Stretch"> <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value}" Width="60" TextAlignment="Right" Padding="5"/> </Border> <RepeatButton Command="{x:Static local:NumericUpDown.IncreaseCommand}" Grid.Column="1" Grid.Row="0">Up</RepeatButton> <RepeatButton Command="{x:Static local:NumericUpDown.DecreaseCommand}" Grid.Column="1" Grid.Row="1">Down</RepeatButton> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
Dim myBinding As New Binding() ' Returns the second ItemsControl encountered on the upward path ' starting at the target element of the binding myBinding.RelativeSource = New RelativeSource(RelativeSourceMode.FindAncestor, GetType(ItemsControl), 2)
Binding myBinding = new Binding(); // Returns the second ItemsControl encountered on the upward path // starting at the target element of the binding myBinding.RelativeSource = new RelativeSource( RelativeSourceMode.FindAncestor, typeof(ItemsControl), 2);
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (rôle principal du serveur non pris en charge), Windows Server 2008 R2 (rôle principal du serveur pris en charge avec SP1 ou version ultérieure ; Itanium non pris en charge)
Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.
