本文整理汇总了VB.NET中System.Windows.Controls.SelectionChangedEventArgs.InvokeEventHandler方法的典型用法代码示例。如果您正苦于以下问题:VB.NET SelectionChangedEventArgs.InvokeEventHandler方法的具体用法?VB.NET SelectionChangedEventArgs.InvokeEventHandler怎么用?VB.NET SelectionChangedEventArgs.InvokeEventHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.SelectionChangedEventArgs
的用法示例。
在下文中一共展示了SelectionChangedEventArgs.InvokeEventHandler方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: BrushConverter
Private Sub myListBox_SelectionChanged(ByVal sender As Object, ByVal args As SelectionChangedEventArgs)
Dim converter As BrushConverter = New BrushConverter()
Dim color As String
' Show Rectangles that are the selected colors.
For Each color In args.AddedItems
If GetRectangle(color) Is Nothing Then
Dim aRect As Rectangle = New Rectangle()
aRect.Fill = CType(converter.ConvertFrom(color), Brush)
aRect.Tag = color
rectanglesPanel.Children.Add(aRect)
End If
Next
' Remove the Rectangles that are the unselected colors.
For Each color In args.RemovedItems
Dim removedItem As FrameworkElement = GetRectangle(color)
If Not removedItem Is Nothing Then
rectanglesPanel.Children.Remove(removedItem)
End If
Next
End Sub
Private Function GetRectangle(ByVal color As String) As FrameworkElement
Dim rect As FrameworkElement
For Each rect In rectanglesPanel.Children
If rect.Tag.ToString() = color Then
Return rect
End If
Next
Return Nothing
End Function
开发者ID:VB.NET开发者,项目名称:System.Windows.Controls,代码行数:39,代码来源:SelectionChangedEventArgs.InvokeEventHandler