Tooltip not showing in Hearthstone Decktracker plugin - wpf

I am writing a plugin for Hearthstone Decktracker, and am adding a tooltip to each of the items that get generated in an ItemsControl.
If I attach the debugger to HearthstoneDeckTracker, I can see the items have a tooltip in the VisualTree, but the tooltip never shows when I mouseover the item.
If anyone were able to help with this problem, it would require that they have HDT and Hearthstone, but I feel the problem is more of a WPF issue than a DeckTracker issue.
There are instructions on creating a plugin at https://github.com/HearthSim/Hearthstone-Deck-Tracker/wiki/Creating-Plugins
To replicate this, you could use the example project provided by HDT Github at https://github.com/andburn/hdt-plugin-example.
Adding a tooltip to the DataTemplate in CurvyList.xaml should be able to show you what I am seeing.
Instead of
<DataTemplate>
<Rectangle Fill="{Binding Background}" Height="34" Width="217" />
</DataTemplate>
you would have (sorry... doing this off top of my head, so syntax may be incorrect)
<DataTemplate>
<Rectangle Fill="{Binding Background}" Height="34" Width="217" >
<Rectangle.Tooltip>
<Textblock Text="Hello World" />
</Rectangle.Tooltip>
</Rectangle>
</DataTemplate>
I have posted this same question on the official Discord channel, but I don't think it is currently being viewed, so I am going to give it a shot here.
Any help would be greatly appreciated! Thanks in advance.

cannot you just add the tooltip directly into the rectangle?
<DataTemplate>
<Rectangle Fill="{Binding Background}" ToolTip="Hello World" Height="34" Width="217" />
</DataTemplate>

Related

MahApps Metro Tile Icon not showing

Currently i am designing WPF application using MahApps.Metro style UI.
Tile control which provided by MahApps can not showing icon in center of tile
I saw example in MahApps website where it could show image as tile background, but I couldn't figure out how to show icon instead of image (icon such as IE logo, people logo, maps logo, etc)
I appreciated if someone can show me how to do this
Thank you
i figure it out
use icons.xaml as resource, and add rectangle control inside tile, here is the example on how to show character inside tile control
<Controls:Tile x:Name="mahTileExit" Background="Green" Foreground="Yellow" Title="Exit" Width="100" Height="100" TiltFactor ="4" Margin="936,404,0,0" VerticalAlignment="Top" HorizontalAlignment="Left">
<Rectangle Fill="White" Height="45" Width="45">
<Rectangle.OpacityMask>
<VisualBrush Visual="{StaticResource appbar_door_leave}" Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>
</Controls:Tile>
thank you if anyone notice about this, hope can help to contribute
You can use FontAwesome.Wpf which has more icons and requires less code.
<Controls:Tile Width="300" Height="150" Grid.Column="0" Grid.Row="1" Title="Hello!">
<Grid Width="50" Height="50">
<fa:ImageAwesome Icon="Flag" Foreground="#FFFFFF"/>
</Grid>
</Controls:Tile>
Don't forget to call the namespace
xmlns:fa="http://schemas.fontawesome.io/icons/"

Create selectable pushpin in Bing maps (XAML)

This is more of XAML question for silverlight.
<Mobile:DevicePushpinTemplateSelector
m:MapLayer.Position="{Binding Location}"
ZoomLevel="{Binding ZoomLevel, ElementName=MainMap}"
Content="{Binding}">
<Mobile:DevicePushpinTemplateSelector.DotTemplate>
<DataTemplate>
<Ellipse Width="8" Height="8" Stroke="Black" Fill="{Binding IsGPSDataRecent, Converter={StaticResource BoolToGreenRedBrushConverter}}" StrokeThickness="1">
<ToolTipService.ToolTip>
<TextBlock Text="{Binding DisplayId}" />
</ToolTipService.ToolTip>
</Ellipse>
</DataTemplate>
</Mobile:DevicePushpinTemplateSelector.DotTemplate>
<Mobile:DevicePushpinTemplateSelector.NumberedTemplate>
<DataTemplate>
<Border x:Name="border" Background="{Binding IsGPSDataRecent, Converter={StaticResource BoolToGreenRedBrushConverter}}" BorderBrush="Black" BorderThickness="2" Padding="2" Height="20" CornerRadius="8">
<TextBlock VerticalAlignment="Center" Text="{Binding DisplayId}" />
</Border>
</DataTemplate>
</Mobile:DevicePushpinTemplateSelector.NumberedTemplate>
</Mobile:DevicePushpinTemplateSelector>
On XAML above I have 2 different templates based on map zoom level. When it is zoomed out - it shows smaller ellipse, when user zooms closer - I increase size of pushpin.
2 issues:
WIth a lot of pushpins it get's really slow, I beleive it's due to template selection.
I want it to be different. I want to create "IsSelected" property so all pushpins will be the same on all zoom levels but when user clicks on pushpin - it expands in size.
I wonder how do I code "selection" part. I want only one pushpin to be selected at time. I can bind to property and make pushpin parts visible/invisible but I'm not sure how to code "selection" piece. Should it be Button?
When doing a windows phone app I had the issue of many pins causing "lag" the easiest way around that is to only show pins within a certain radius of the centre of the map and remove the others until they come into the radius.
Cheers
Mark

WP7 An Image over the full display

I am developing an application where i want to browse images like native WindowsPhone form.
I have used Pivot control. Everything works, but there is one unwanted thing. The image does not fill all display area. There is a gap on the top of page. I have set margin and padding everywhere where it is possible. And the result is still the same. :(
Here is my XAML code:
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid
x:Name="LayoutRoot"
Background="Transparent"
Margin="0">
<toolkit:PerformanceProgressBar
VerticalAlignment="Top"
HorizontalAlignment="Left"
IsIndeterminate="{Binding IsBusy}"
Visibility="{Binding IsBusy, Converter={StaticResource BoolToVisibilityConverter}}"
/>
<controls:Pivot
x:Name="PhotoPivot"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
IsHitTestVisible="True"
ItemsSource="{Binding Photos}"
Margin="0"
Padding="0"
>
<controls:Pivot.HeaderTemplate>
<DataTemplate/>
</controls:Pivot.HeaderTemplate>
<controls:Pivot.ItemTemplate>
<DataTemplate >
<controls:PivotItem
x:Name="PhotoPivotItem"
Margin="0"
>
<Image
x:Name="PhotoPicture"
Source="{Binding}"
Stretch="Uniform"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Margin="0"
/>
</controls:PivotItem>
</DataTemplate>
</controls:Pivot.ItemTemplate>
</controls:Pivot>
</Grid>
Are you talking about the system tray?
To remove the system tray use the following code:
shell:SystemTray.IsVisible="False"
Update:
I'm not real sure why that extra space is there.
I created a simplified version of your example and the only thing I could think of is to use negative margins. There is probably a better solution that I am just overlooking, but for now you can just use the following:
<controls:PivotItem x:Name="PhotoPivotItem" Margin="0,-10,0,0">
Although, from your posted image, it looks as if you have a bigger gap than I did, so you might need to decrease the margin.

ContentTemplate does not work with DXWindow?

I want to use a ContentTemplate property with my window. First I tried it with standard Window class:
<Window.ContentTemplate>
<DataTemplate>
<DockPanel LastChildFill="true">
<TextBlock DockPanel.Dock="Top">Hello world</TextBlock>
<ContentPresenter Content="{Binding}" />
</DockPanel>
</DataTemplate>
</Window.ContentTemplate>
<Button>TestButton</Button>
This works the way I want:
Now try to do the same thing with DXWindow (I'm using DevExpress 10.2.4 version):
<dx:DXWindow.ContentTemplate>
<DataTemplate>
<DockPanel LastChildFill="true">
<TextBlock DockPanel.Dock="Top">Hello world</TextBlock>
<ContentPresenter Content="{Binding}" />
</DockPanel>
</DataTemplate>
</dx:DXWindow.ContentTemplate>
<Button>TestButton</Button>
But this does not work, looks like this property is ignored
Is it possible to fix this behavior?
Thank you.
I see the problem with this xaml (it fails with error in the latest version (10.2.5)):
The DXWindow.ContentTemplate with the ContentPresenter raises exception
We will fix this issue in the future.
Could you please explain why you are using ContentTemplate and do not want to add both controls directly to DXWindow.

Double Border with a VisualBrush in WPF

I'm curious if anyone knows of a way to easily get a double border effect in WPF similar to what you see in the selected items in Windows Explorer in Windows 7.
If you look closely, you'll notice that the selected item has a dark border, a lighter, inner-border, and then a gradient background.
Currently, I'm using two borders around an object any time I want to achieve this effect. Doing it that way is ugly syntactically and really muddies my view xaml. Being a web developer at heart I'd like to separate the xaml structure from the style as much as possible. So, I've started putting this into Styles and Content Templates in order to pull it out of my view xaml.
However, I'm curious if there may be a better way to go about this.
I played around for a while using a VisualBrush as a background to try to get the effect. However, I want to be able to apply the background to elements that can be any size and the way the VisualBrush stretched the visual to fit the element background didn't work the way I wanted it to. Essentially, I'd really just like it to stretch the visual the way the WPF layout system would do it.
Any ideas would be greatly appreciated.
--
Dusty
A VisualBrush is probably not what you want to do in this scenario, as it's pretty heavy.
You can solve the problem with some Xaml without nesting borders.
For example,
<Border BorderBrush="#FF00B5C5" BorderThickness="1" CornerRadius="2" Background="White">
<Grid Background="#FF00B5C5" Margin="1">
<Rectangle Fill="#FFA2F2FE" />
<TextBlock Text="This is some text" VerticalAlignment="Center"/>
</Grid>
</Border>
You can, of course, tweak the properties to get the look you need.
EDIT: If you want to create a style, so you can reskin the look-and-feel, you can do something like this:
<Window.Resources>
<Style x:Key="BorderedTextBlock" TargetType="ContentControl">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Border BorderBrush="#FF00B5C5" BorderThickness="1" CornerRadius="2" Background="White">
<Grid Background="#FF00B5C5" Margin="1">
<Rectangle Fill="#FFA2F2FE" />
<TextBlock Text="{Binding}" VerticalAlignment="Center"/>
</Grid>
</Border>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid x:Name="LayoutRoot">
<ContentControl Style="{StaticResource BorderedTextBlock}" Content="This is some text" Width="200" Height="24"/>
</Grid>
Additionally, turn this into a custom control with all the styling and theming parameters that you need.
Hope that helps,
Sergio

Resources