Jump to content
Software FX Community

converter for tooltip


bmw
 Share

Recommended Posts

I currently have this code for my tooltip template.  What i want to know is can i pass "DataItem.ArrivalDate" through a converter.  I want to format it with dow, arrivaldate and its currently datetime.

 <DataTemplate>   <Grid>   <Grid.RowDefinitions>   <RowDefinition Height="Auto"/>   <RowDefinition Height="12"/>   <RowDefinition Height="Auto"/>   <RowDefinition Height="Auto"/>   <RowDefinition Height="Auto"/>   <RowDefinition Height="Auto"/>   <RowDefinition Height="12"/>   </Grid.RowDefinitions>   <Grid.ColumnDefinitions>   <ColumnDefinition Width="*"/>   <ColumnDefinition Width="12"/>   <ColumnDefinition Width="Auto"/>   </Grid.ColumnDefinitions>   <TextBlock Text="{Binding Path=DataItem.ArrivalDate}"  Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Center"/>   <TextBlock Text="{g:LocalizedResource Name=LandingPageGraph_GroupAvailableTip}" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left"/>   <TextBlock Text="{Binding Path=DataItem.GroupAvailable}" Grid.Row="2" Grid.Column="2" HorizontalAlignment="Right"/>   <TextBlock Text="{g:LocalizedResource Name=LandingPageGraph_TotalSoldTip}" Grid.Row="3" Grid.Column="0" HorizontalAlignment="Left"/>   <TextBlock Text="{Binding Path=DataItem.TotalSold}" Grid.Row="3" Grid.Column="2" HorizontalAlignment="Right"/>   <TextBlock Text="{g:LocalizedResource Name=LandingPageGraph_PriorYearActualsTip}" Grid.Row="4" Grid.Column="0" HorizontalAlignment="Left"/>   <TextBlock Text="{Binding Path=DataItem.PriorYearActuals}" Grid.Row="4" Grid.Column="2" HorizontalAlignment="Right"/>   <TextBlock Text="{g:LocalizedResource Name=LandingPageGraph_ProjectedTip}" Grid.Row="5" Grid.Column="0" HorizontalAlignment="Left"/>   <TextBlock Text="{Binding Path=DataItem.Projected}" Grid.Row="5" Grid.Column="2" HorizontalAlignment="Right"/>   </Grid></DataTemplate>

 

Link to comment
Share on other sites

You can use a converter in your tooltip templates in the same way as you would use a converter in any other WPF scenario

1) Add an xml namespace to the root node (Page/Window/etc.), if the converter is in the same assembly as the executable you can omit the assembly part

2) Add the converter to a resource dictionary in your template

3) Instantiate the converter in the binding.

e.g

<

Page x:Class="Cfx80App.Pages.Animation.BarHeightPage"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation'>http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:cfx="clr-namespace:ChartFX.WPF;assembly=ChartFX.WPF"xmlns:local="clr-namespace:YourNamespaceGoesHere">
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...