Share via


ToolTip.Placement Properti

Definisi

Mendapatkan atau mengatur bagaimana TipsAlat diposisikan dalam kaitannya dengan elemen target penempatan.

public:
 property PlacementMode Placement { PlacementMode get(); void set(PlacementMode value); };
PlacementMode Placement();

void Placement(PlacementMode value);
public PlacementMode Placement { get; set; }
var placementMode = toolTip.placement;
toolTip.placement = placementMode;
Public Property Placement As PlacementMode
<ToolTip Placement="placementModeMemberName"/>

Nilai Properti

Salah satu nilai PlacementMode .

Contoh

Contoh kode berikut menunjukkan mode penempatan untuk TipsAlat.

<StackPanel Margin="120" >
    <TextBlock Text="ToolTip Control"/>
    <TextBlock Text="Hover over an item to see its ToolTip: " Margin="0,10"/>
    <ListBox Width="100" HorizontalAlignment="Left">
        <ListBoxItem Content="Left" 
            ToolTipService.ToolTip="ToolTip to the left." 
            ToolTipService.Placement="Left" />
        <ListBoxItem Content="Right" 
            ToolTipService.ToolTip="ToolTip to the right." 
            ToolTipService.Placement="Right" />
        <ListBoxItem Content="Top" 
            ToolTipService.ToolTip="ToolTip at the top." 
            ToolTipService.Placement="Top" />
        <ListBoxItem Content="Bottom" 
            ToolTipService.ToolTip="ToolTip at the bottom." 
            ToolTipService.Placement="Bottom"/>
        <ListBoxItem Content="Mouse" 
            ToolTipService.ToolTip="ToolTip based on the cursor position." 
            ToolTipService.Placement="Mouse"/>
    </ListBox>
</StackPanel>

Keterangan

Jika tidak ada PlacementTarget eksplisit, target penempatan untuk TipsAlat adalah elemen yang menentukan TipsAlat sebagai nilai untuk nilai properti terlampir TooltipService.ToolTip-nya , dan nilai Penempatan apa pun berlaku untuk target tersebut.

Placement dan PlacementTarget biasanya dibiarkan sebagai default. Skenario untuk menentukan salah satu atau kedua properti ini adalah jika Anda mencoba menghindari kasus di mana tipsalat mengaburkan konten yang dirujuknya saat tipsalat ditampilkan.

Berlaku untuk

Lihat juga