Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9079237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:47:35+00:00 2026-06-16T19:47:35+00:00

i am having the following code: <Window x:Class=WpfApplication1.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=MainWindow Height=350 Width=525> <Window.Resources>

  • 0

i am having the following code:

<Window x:Class="WpfApplication1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
<Window.Resources>
    <Style x:Key="{x:Type ToolTip}" TargetType="{x:Type ToolTip}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToolTip}">
                    <Border Background="Black">
                        <TextBlock  FontFamily="Tahoma" FontSize="11" Text="{TemplateBinding Content}" Foreground="WhiteSmoke" Padding="2" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</Window.Resources>
<StackPanel>
    <Label Content="Label 1" ToolTip="asd" />
    <Label Content="Label 2" ToolTip="" />
    <TextBlock Text="TextBlock 1" ToolTip="asd" />
    <TextBlock Text="TextBlock 2" ToolTip="" />
    <Button Content="Button 1" ToolTip="asd" />
    <Button Content="Button 2" ToolTip="" />
</StackPanel>

Now, as you can see by testing that when you hover over Label 2, Textblock 2, Button 2, a tooltip still shows.
I want that to be triggered that if Tooltip is empty or null then it should not show anything. I know i can simply remove that from XAML But the way i am doing here is something different.

I have tried adding a trigger to check value =”” and to null and inside trigger, setting template to null but none of them is working

If some of you experts could shed some light on it, i would be very glad

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:47:36+00:00Added an answer on June 16, 2026 at 7:47 pm

    You can consider using a IValueConverter to show/hide the tooltip border. Add this class to your project :

    class BorderVisibilitySetter : IValueConverter
    {
    
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
           //check if the control's content property is null or empty        
            if(value == null || value.ToString() == string.Empty)
                return Visibility.Collapsed;
            else
                return Visibility.Visible;
        }
    
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
    

    Then modify your xaml as :

    <src:BorderVisibilitySetter x:Key="BorderVisible" />
        <Style x:Key="{x:Type ToolTip}" TargetType="{x:Type ToolTip}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ToolTip}">
                        <Border Background="Black" Visibility="{TemplateBinding Content, Converter={StaticResource BorderVisible}}" >
                            <TextBlock  FontFamily="Tahoma" FontSize="11" Text="{TemplateBinding Content}" Foreground="WhiteSmoke" Padding="2" />
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having the following wpf code: <Window x:Class=WpfApplication5.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:c=clr-namespace:WpfApplication5 Title=Window1 Height=300 Width=300> <Window.Resources>
Having the xaml below in MainWindow.xaml: <Window x:Class=TestDependency.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=MainWindow Height=350 Width=525 DataContext={Binding
The following code is having some problem with the jQuery. <script type="text/javascript"> $(window).load(function() {
I'm trying out the following code: public partial class Test: Window { public Test(ref
I am having following code for getting image from the web: NSURL *ImageURL =
I am having following code but unable to understand as to why no match
I am having the following code: public ActionResult EditTrain(EditTraing editrain) { .... .... return
I m having the following code, however, I can see that the radio button
I am having following peice of code ,where in i am trying to serialize
I'm having problems the following code gives me no results. however if I uncomment

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.