I have two buttons in Main.Xaml. I declare ToolTip for each of them. They have a very small gap which is barely visible with open eyes but still they have gap which you you can see by their Margin.
<button
="" x:name="button1" width="71" horizontalalignment="Left" margin="165,14,0,0" height="24" verticalalignment="Top" uselayoutrounding="True" renderoptions.cleartypehint="Enabled" renderoptions.bitmapscalingmode="NearestNeighbor" snapstodevicepixels="True">
<button.content>
<textblock fontsize="10" fontfamily="Segoe UI" uselayoutrounding="True" textoptions.textformattingmode="Display" margin="0,-2,0,0">
Settings
<button.tooltip>
<tooltip uselayoutrounding="True" renderoptions.cleartypehint="Enabled" renderoptions.bitmapscalingmode="NearestNeighbor" snapstodevicepixels="True" textoptions.textformattingmode="Display"
="">
<stackpanel>
<textblock fontfamily="Segoe UI" fontsize="12" textoptions.textformattingmode="Display">
Settings
`enter code here`<button
="" x:name="button2" width="71" horizontalalignment="Left" margin="237,14,0,0" height="24" verticalalignment="Top" uselayoutrounding="True" renderoptions.cleartypehint="Enabled" renderoptions.bitmapscalingmode="NearestNeighbor" snapstodevicepixels="True">
<button.content>
<textblock fontsize="10" fontfamily="Segoe UI" uselayoutrounding="True" textoptions.textformattingmode="Display" margin="0,-2,0,0">
Settings
<button.tooltip>
<tooltip uselayoutrounding="True" renderoptions.cleartypehint="Enabled" renderoptions.bitmapscalingmode="NearestNeighbor" snapstodevicepixels="True" textoptions.textformattingmode="Display"
="">
<stackpanel>
<textblock fontfamily="Segoe UI" fontsize="12" textoptions.textformattingmode="Display">
Settings
I have created two control template one is for button which is consider as "RoundCorner" and declare as StaticResource of buttons in Main.XAMl. And another is for ToolTip.
Here is the Code for RoundCorner Controltemplate(Button) --
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Foreground" Value="#bababa" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid x:Name="grid" >
<Border x:Name="border" CornerRadius="1" BorderThickness="0" >
<Border.Background>
<RadialGradientBrush GradientOrigin="0.496,1.052">
<RadialGradientBrush.RelativeTransform>
<TransformGroup>
<ScaleTransform CenterX="0.5" CenterY="0.5"
ScaleX="1.5" ScaleY="1.5"/>
<TranslateTransform X="0.02" Y="0.3"/>
</transformgroup>
</radialgradientbrush.RelativeTransform>
<GradientStop Offset="1" Color="#282828"/>
<GradientStop Offset="0.3" Color="#282828"/>
</radialgradientbrush>
</border.Background>
<ContentPresenter
HorizontalAlignment="Center"
VerticalAlignment="Center"
>
</contentpresenter>
</border>
</grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="border" Value="#202020"/>
<Setter Property="Foreground" Value="WhiteSmoke" />
</trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="border">
<Setter.Value>
<RadialGradientBrush GradientOrigin="0.496,1.052">
<RadialGradientBrush.RelativeTransform>
<TransformGroup>
<ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.5" ScaleY="1.5"/>
<TranslateTransform X="0.02" Y="0.3"/>
</transformgroup>
</radialgradientbrush.RelativeTransform>
<GradientStop Color="#161616" Offset="1"/>
<GradientStop Color="#161616" Offset="0.3"/>
</radialgradientbrush>
</setter.Value>
</setter>
</trigger>
</controltemplate.Triggers>
</controltemplate>
</setter.Value>
</setter>
Here is the Control template code for Tooltip--
<Setter Property="OverridesDefaultStyle"
Value="True" />
<Setter Property="HasDropShadow"
Value="True" />
<Setter Property="ToolTipService.Placement"
Value="MousePoint" />
<Setter Property="ToolTipService.VerticalOffset"
Value="5" />
<Setter Property="ToolTipService.HorizontalOffset"
Value="-10" />
<Setter Property="Foreground"
Value="#606060"/>
<Setter Property="ToolTipService.InitialShowDelay"
Value="1000" />
<Setter Property="ToolTipService.BetweenShowDelay"
Value="0" />
<Setter Property="ToolTipService.ShowDuration"
Value="6000" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToolTip}">
<Grid x:Name="grid" Margin="10" >
<Border x:Name="Bordermini" HorizontalAlignment="Right"
BorderThickness="0.5"
Width="{TemplateBinding Width}"
Height="15">
<Border.Background>
<LinearGradientBrush StartPoint="0,0"
EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="White"
Offset="0.0" />
<GradientStop Color="White"
Offset="1.0" />
</gradientstopcollection>
</lineargradientbrush.GradientStops>
</lineargradientbrush>
</border.Background>
<Border.BorderBrush>
<SolidColorBrush Color="Gainsboro" />
</border.BorderBrush>
<Border.Effect>
<DropShadowEffect Opacity="0.8" BlurRadius="5" Direction="-82" ShadowDepth="3.8" Color="#282828" >
</dropshadoweffect>
</border.Effect>
<ContentPresenter Margin="1.5,0"
HorizontalAlignment="Left"
VerticalAlignment="Top" />
</border>
<Border x:Name="Border" HorizontalAlignment="Right"
BorderThickness="0.5"
Width="{TemplateBinding Width}"
Height="19">
<Border.Background>
<LinearGradientBrush StartPoint="0,0"
EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#ffffff"
Offset="0.0" />
<GradientStop Color="#ffffff"
Offset="1.0" />
</gradientstopcollection>
</lineargradientbrush.GradientStops>
</lineargradientbrush>
</border.Background>
<Border.BorderBrush>
<SolidColorBrush Color="Gray" />
</border.BorderBrush>
<ContentPresenter Margin="4,0"
HorizontalAlignment="Left"
VerticalAlignment="Top" />
</border>
</grid>
<ControlTemplate.Triggers>
<Trigger Property="HasDropShadow" Value="True" >
<Setter TargetName="Border"
Property="CornerRadius"
Value="0" />
<Setter TargetName="Border"
Property="SnapsToDevicePixels"
Value="true" />
</trigger>
</controltemplate.Triggers>
</controltemplate>
</setter.Value>
</setter>
So, How I re trigger the initial delay as soon as I quickly move the mouse cursor from one button to another? Is there any need to use the "Datatrigger" or "DataBinding" to overcome this issue?
What I have tried:
I tried using various data binding with Tooltip IsOpen property but none of them are working.