bmw Posted August 4, 2008 Report Share Posted August 4, 2008 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> Quote Link to comment Share on other sites More sharing options...
JuanC Posted August 6, 2008 Report Share Posted August 6, 2008 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"> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.