ToolTipService.ToolTipClosingEvent Alan
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
ToolTipClosing Araç ipuçlarını görüntülemek için hizmeti kullanan ToolTipService nesneler tarafından kullanıma sunulan olayı tanımlar.
public: static initonly System::Windows::RoutedEvent ^ ToolTipClosingEvent;
public static readonly System.Windows.RoutedEvent ToolTipClosingEvent;
staticval mutable ToolTipClosingEvent : System.Windows.RoutedEvent
Public Shared ReadOnly ToolTipClosingEvent As RoutedEvent
Alan Değeri
Örnekler
Aşağıdaki örnekte, olay için bir olay işleyicisinin nasıl ayarlanacağı gösterilmektedir ToolTipClosing . Bu durumda, işleyicinin eklendiği yer türetilmiş bir sınıfı olduğundan FrameworkElement.ToolTipClosing olay işleyicisi Ellipseaslında için FrameworkElementolur.
ellipse2.AddHandler(ToolTipService.ToolTipOpeningEvent,
new RoutedEventHandler(whenToolTipOpens));
ellipse2.AddHandler(ToolTipService.ToolTipClosingEvent,
new RoutedEventHandler(whenToolTipCloses));
ellipse2.AddHandler(ToolTipService.ToolTipOpeningEvent, New RoutedEventHandler(AddressOf whenToolTipOpens))
ellipse2.AddHandler(ToolTipService.ToolTipClosingEvent, New RoutedEventHandler(AddressOf whenToolTipCloses))
void whenToolTipOpens(object sender, RoutedEventArgs e)
{
Ellipse ell = new Ellipse();
if (sender.GetType().FullName.Equals("System.Windows.Shapes.Ellipse"))
{
ell = (Ellipse)sender;
ell.Fill = Brushes.Blue;
}
else if (sender.GetType().FullName.Equals(
"System.Windows.Controls.ToolTip"))
{
ToolTip t = (ToolTip)sender;
Popup p = (Popup)t.Parent;
ell = (Ellipse)p.PlacementTarget;
ell.Fill = Brushes.Blue;
}
}
void whenToolTipCloses(object sender, RoutedEventArgs e)
{
Ellipse ell = new Ellipse();
if (sender.GetType().FullName.Equals(
"System.Windows.Shapes.Ellipse"))
{
ell = (Ellipse)sender;
ell.Fill = Brushes.Gray;
}
else if (sender.GetType().FullName.Equals(
"System.Windows.Controls.ToolTip"))
{
ToolTip t = (ToolTip)sender;
Popup p = (Popup)t.Parent;
ell = (Ellipse)p.PlacementTarget;
ell.Fill = Brushes.Gray;
}
}
Private Sub whenToolTipOpens(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim ell As New Ellipse()
If sender.GetType().FullName.Equals("System.Windows.Shapes.Ellipse") Then
ell = CType(sender, Ellipse)
ell.Fill = Brushes.Blue
ElseIf sender.GetType().FullName.Equals("System.Windows.Controls.ToolTip") Then
Dim t As ToolTip = CType(sender, ToolTip)
Dim p As Popup = CType(t.Parent, Popup)
ell = CType(p.PlacementTarget, Ellipse)
ell.Fill = Brushes.Blue
End If
End Sub
Private Sub whenToolTipCloses(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim ell As New Ellipse()
If sender.GetType().FullName.Equals("System.Windows.Shapes.Ellipse") Then
ell = CType(sender, Ellipse)
ell.Fill = Brushes.Gray
ElseIf sender.GetType().FullName.Equals("System.Windows.Controls.ToolTip") Then
Dim t As ToolTip = CType(sender, ToolTip)
Dim p As Popup = CType(t.Parent, Popup)
ell = CType(p.PlacementTarget, Ellipse)
ell.Fill = Brushes.Gray
End If
End Sub
Açıklamalar
Olay ToolTipClosing , bir araç ipucu kapanmadan hemen önce gerçekleşir.
Bu alan, bu hizmeti kullanan sınıflar için olayın davranışını ToolTipClosingEvent kaydeder. ve sınıfları ortak dil çalışma zamanı (CLR) erişimcileri ve aracılığıyla bu olayı uygular FrameworkElement ve FrameworkContentElementkullanıma sunarToolTipService.FrameworkElement.ToolTipClosingFrameworkContentElement.ToolTipClosing
Araç ipucunun bir ToolTip nesne olarak belirtilmesi durumunda, Closed araç ipucu kapatıldığında da olay tetiklenmiş olur.