Error Help
-
Hi All, I'm just adding in ToolTips to a chart I'm building in WPF. The TargetType is set to {x:Type ToolTip} and the style definition is placed in the section of the XAML. Running the application and navigating to the screen with the chart in works ok (no compile error) but the tooltip is not styled as per the definition. Going into Blend and looking at the UserContol is ok but when I click on the [Edit Resource] button for [System.Windows.Controls.ToolTip] resource I get the following error: 'ToolTip' cannot have a logical or visual parent. Any ideas would be great.
Jammer Going where everyone here has gone before! :) My Blog
-
Hi All, I'm just adding in ToolTips to a chart I'm building in WPF. The TargetType is set to {x:Type ToolTip} and the style definition is placed in the section of the XAML. Running the application and navigating to the screen with the chart in works ok (no compile error) but the tooltip is not styled as per the definition. Going into Blend and looking at the UserContol is ok but when I click on the [Edit Resource] button for [System.Windows.Controls.ToolTip] resource I get the following error: 'ToolTip' cannot have a logical or visual parent. Any ideas would be great.
Jammer Going where everyone here has gone before! :) My Blog
Can you post the XAML?
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
Can you post the XAML?
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
Hi Karl, <Setter Property="Background" Value="#FF0000" /> <Setter Property="FontFamily" Value="Segoe UI" /> <Setter Property="FontSize" Value="12" /> <Setter Property="FontWeight" Value="Normal" /> <Setter Property="Foreground" Value="#FFFFFF" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ToolTip}"> <Border CornerRadius="4" Background="Transparent"> <ContentPresenter Margin="6,4,6,4" /> </Border> </ControlTemplate> </Setter.Value> </Setter>
-
Hi Karl, <Setter Property="Background" Value="#FF0000" /> <Setter Property="FontFamily" Value="Segoe UI" /> <Setter Property="FontSize" Value="12" /> <Setter Property="FontWeight" Value="Normal" /> <Setter Property="Foreground" Value="#FFFFFF" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ToolTip}"> <Border CornerRadius="4" Background="Transparent"> <ContentPresenter Margin="6,4,6,4" /> </Border> </ControlTemplate> </Setter.Value> </Setter>
Jammer, Take a close look at the colors. I added the alpha channel to each of your hex colors. The Background of the Border was Transparent, I made it Black and the ToolTip now shows up. Not sure why Blend blows up. I'm using Blend 2.5, got the same thing. I would send your example to the Blend team. The below template works fine and shows the tooltip at run-time.
<UserControl.Resources> <!-- ToolTip Style --> <Style TargetType="{x:Type ToolTip}"> <Setter Property="Background" Value="#FF000000" /> <Setter Property="FontFamily" Value="Segoe UI" /> <Setter Property="FontSize" Value="12" /> <Setter Property="FontWeight" Value="Normal" /> <Setter Property="Foreground" Value="#FFFFFFFF" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ToolTip}"> <Border CornerRadius="4" Background="#FF000000" > <ContentPresenter /> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </UserControl.Resources>
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
Jammer, Take a close look at the colors. I added the alpha channel to each of your hex colors. The Background of the Border was Transparent, I made it Black and the ToolTip now shows up. Not sure why Blend blows up. I'm using Blend 2.5, got the same thing. I would send your example to the Blend team. The below template works fine and shows the tooltip at run-time.
<UserControl.Resources> <!-- ToolTip Style --> <Style TargetType="{x:Type ToolTip}"> <Setter Property="Background" Value="#FF000000" /> <Setter Property="FontFamily" Value="Segoe UI" /> <Setter Property="FontSize" Value="12" /> <Setter Property="FontWeight" Value="Normal" /> <Setter Property="Foreground" Value="#FFFFFFFF" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ToolTip}"> <Border CornerRadius="4" Background="#FF000000" > <ContentPresenter /> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </UserControl.Resources>
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
Ahhh, ok. I've just amended my code to reflect the changes you detail and my ToolTip still isn't applying the styling. My tooltip was always showing up just not with the style template applied to the tooltip. This is really frustrating at the moment. Thanks for the tips ... will keep on trying to get this working. I'm kida running out of time trying to get a simple tooltip running properly! feck! :)
Jammer Going where everyone here has gone before! :) My Blog
-
Jammer, Take a close look at the colors. I added the alpha channel to each of your hex colors. The Background of the Border was Transparent, I made it Black and the ToolTip now shows up. Not sure why Blend blows up. I'm using Blend 2.5, got the same thing. I would send your example to the Blend team. The below template works fine and shows the tooltip at run-time.
<UserControl.Resources> <!-- ToolTip Style --> <Style TargetType="{x:Type ToolTip}"> <Setter Property="Background" Value="#FF000000" /> <Setter Property="FontFamily" Value="Segoe UI" /> <Setter Property="FontSize" Value="12" /> <Setter Property="FontWeight" Value="Normal" /> <Setter Property="Foreground" Value="#FFFFFFFF" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ToolTip}"> <Border CornerRadius="4" Background="#FF000000" > <ContentPresenter /> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </UserControl.Resources>
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
I'm thinking that the error blend is throwing is the reason why this style doesn't get applied at run-time ... I've also tried moving this ToolTip definition into my applications main dictionary xaml file and its still ignored ...
Jammer Going where everyone here has gone before! :) My Blog
-
Jammer, Take a close look at the colors. I added the alpha channel to each of your hex colors. The Background of the Border was Transparent, I made it Black and the ToolTip now shows up. Not sure why Blend blows up. I'm using Blend 2.5, got the same thing. I would send your example to the Blend team. The below template works fine and shows the tooltip at run-time.
<UserControl.Resources> <!-- ToolTip Style --> <Style TargetType="{x:Type ToolTip}"> <Setter Property="Background" Value="#FF000000" /> <Setter Property="FontFamily" Value="Segoe UI" /> <Setter Property="FontSize" Value="12" /> <Setter Property="FontWeight" Value="Normal" /> <Setter Property="Foreground" Value="#FFFFFFFF" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ToolTip}"> <Border CornerRadius="4" Background="#FF000000" > <ContentPresenter /> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </UserControl.Resources>
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
Hi Karl, Any ideas on this? All I can get my tooltip to do is this: http://www.jammer.biz/images/wpf/tooltip.png[^] Its just completely ignoring the style. From looking at examples on the web I'm doing *exactly* the same thing (but in a usercontrol) and its failing to style ... I just can't work this out at all. Could it be a settings conflict in the xaml? Maybe something in my dictionary is conflicting? Would that be highlighted at compile time?
Jammer Going where everyone here has gone before! :) My Blog
-
Hi Karl, Any ideas on this? All I can get my tooltip to do is this: http://www.jammer.biz/images/wpf/tooltip.png[^] Its just completely ignoring the style. From looking at examples on the web I'm doing *exactly* the same thing (but in a usercontrol) and its failing to style ... I just can't work this out at all. Could it be a settings conflict in the xaml? Maybe something in my dictionary is conflicting? Would that be highlighted at compile time?
Jammer Going where everyone here has gone before! :) My Blog
Just not sure. That tooltip I sent worked fine in a quick application I did. Is the Infragistics control styling the ToolTip? Break out Mole or Snoop and see if they have styled the ToolTip. If they style the ToolTip, it will override your styling. You can also post on Infragistics Support forum and see what they say.
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
Just not sure. That tooltip I sent worked fine in a quick application I did. Is the Infragistics control styling the ToolTip? Break out Mole or Snoop and see if they have styled the ToolTip. If they style the ToolTip, it will override your styling. You can also post on Infragistics Support forum and see what they say.
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
Indeed ... the style code works as designed. I added it into the default dictionary for the application and its styling every other tooltip in the interface as expected. And some of those are in other usercontrols so that's not the issue. I'm going to delve in with mole tomorrow and investigate some more. I have a priority support contract with Infragistics and I've emailed them to query this as well. The Infragistics stuff is really great. Odd little problem I have here I think!
Jammer Going where everyone here has gone before! :) My Blog
-
Just not sure. That tooltip I sent worked fine in a quick application I did. Is the Infragistics control styling the ToolTip? Break out Mole or Snoop and see if they have styled the ToolTip. If they style the ToolTip, it will override your styling. You can also post on Infragistics Support forum and see what they say.
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.