|
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
|
RoutedPropertyChangedEventHandler<T>, délégué
Espace de noms : System.Windows
Assembly : PresentationFramework (dans PresentationFramework.dll)
public delegate void RoutedPropertyChangedEventHandler<T>( Object sender, RoutedPropertyChangedEventArgs<T> e )
Paramètres de type
- T
Type de la valeur de propriété pour laquelle les changements de valeur sont signalés.
Paramètres
- sender
- Type : System.Object
Objet auquel le gestionnaire d'événements est attaché.
- e
- Type : System.Windows.RoutedPropertyChangedEventArgs<T>
Données d'événement. Les définitions d'événement spécifiques contraignent RoutedPropertyChangedEventArgs<T> à un type, avec le paramètre de type de la contrainte correspondant à la contrainte de paramètre de type pour une implémentation de délégué.
Dim childrenCountSlider As Slider = CType(LogicalTreeHelper.FindLogicalNode(myWindow, "ChildrenCountSlider"), Slider) AddHandler childrenCountSlider.ValueChanged, AddressOf OnChildrenCountChanged
Slider childrenCountSlider = (Slider)LogicalTreeHelper.FindLogicalNode(myWindow, "ChildrenCountSlider"); childrenCountSlider.ValueChanged += new RoutedPropertyChangedEventHandler<double>(OnChildrenCountChanged);
Private Sub OnChildrenCountChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Double)) Dim childrenCount As Integer = CInt(Fix(Math.Floor(e.NewValue + 0.5))) ' Update the children count... Dim g As AutoIndexingGrid = CType(LogicalTreeHelper.FindLogicalNode(myWindow, "TargetGrid"), AutoIndexingGrid) Do While g.Children.Count < childrenCount Dim c As New Control() g.Children.Add(c) c.Style = CType(c.FindResource("ImageWithBorder"), Style) Loop Do While g.Children.Count > childrenCount g.Children.Remove(g.Children(g.Children.Count - 1)) Loop ' Update TextBlock element displaying the count... Dim t As TextBlock = CType(LogicalTreeHelper.FindLogicalNode(myWindow, "ChildrenCountDisplay"), TextBlock) t.Text = childrenCount.ToString() End Sub
private void OnChildrenCountChanged(object sender, RoutedPropertyChangedEventArgs<double> e) { int childrenCount = (int)Math.Floor(e.NewValue + 0.5); // Update the children count... AutoIndexingGrid g = (AutoIndexingGrid)LogicalTreeHelper.FindLogicalNode(myWindow, "TargetGrid"); while (g.Children.Count < childrenCount) { Control c = new Control(); g.Children.Add(c); c.Style = (Style)c.FindResource("ImageWithBorder"); } while (g.Children.Count > childrenCount) { g.Children.Remove(g.Children[g.Children.Count - 1]); } // Update TextBlock element displaying the count... TextBlock t = (TextBlock)LogicalTreeHelper.FindLogicalNode(myWindow, "ChildrenCountDisplay"); t.Text = childrenCount.ToString(); }
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.