Reputation: 6420
This is my Dodel
:
public string Name { get; set; }
public string Id { get; set; }
public string Age { get; set; }
public string Description { get; set; }
This is my ListView
column:
<GridViewColumn Header="Name">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock x:Name="textBlock"
Text="{Binding Description}"
ToolTip="{Binding Description}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
So in case i want to see in my ToolTip
all my properties for example:
name + "\n" + Id + "\n" + Age + + "\n" + Description
Upvotes: 0
Views: 339
Reputation: 2363
Here is what I would have done for that:
<DataTemplate>
<DataTemplate.Resources>
<ToolTip x:Key="Tip">
<TextBlock>
<Run Text="{Binding Name}"/>
<LineBreak/>
<Run Text="{Binding Age, StringFormat='Age: {0}'}"/>
</TextBlock>
</ToolTip>
</DataTemplate.Resources>
<TextBlock Text="{Binding Description}" ToolTip="{StaticResource Tip}"/>
</DataTemplate>
I used Runs
so you can Bind Name and other properties on after the other with complete customisation.
Upvotes: 1
Reputation: 126
Why not add a new string type property to your Model and combine all of them in the constructor.
If you really want to do it this way, this may help you.
Upvotes: 1