Don't just take my word for it. Let's create a project that demonstrates how tool tips don't work, then look at the "solution"
.
Create a new WPF Application project and call it XamDataGridTooltip.
Don't forget to add the references to Infragistics to your project.
The XAML looks like this. Notice I'm not even trying to bind the tool tip. I'll take anything at this point!
<Window x:Class="XamDataGridTooltip.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:XamDataGridTooltip"
xmlns:igDP="http://infragistics.com/DataPresenter"
mc:Ignorable="d" Title="MainWindow" Height="350" Width="525"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
<igDP:XamDataGrid Theme="LunaSilver" DataSource="{Binding SomeText}" GroupByAreaLocation="None" VerticalAlignment="Stretch">
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings SelectionTypeRecord="Single" AutoGenerateFields="False"/>
</igDP:XamDataGrid.FieldLayoutSettings>
<igDP:XamDataGrid.FieldSettings>
<igDP:FieldSettings AllowSummaries="False" SummaryUIType="SingleSelect" LabelTextAlignment="Center" AllowEdit="false" />
</igDP:XamDataGrid.FieldSettings>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout Description="SomeText" Key="SomeText">
<igDP:FieldLayout.Fields>
<igDP:TextField Label="SomeText" Name="Text" ToolTip="Some Text" ToolTipService.ShowOnDisabled="True">
</igDP:FieldLayout.Fields>
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
</Window>
using System;
using System.Collections.Generic;
using System.Windows;
namespace XamDataGridTooltip
{
public partial class MainWindow : Window
{
public class cText
{
public cText(String Text)
{
this.Text = Text;
}
private String _Text;
public String Text
{
get { return _Text; }
set { _Text = value; }
}
}
public List<cText> SomeText
{
get { return new List<cText> { new cText("Some
text"), new cText("Some
more text") }; }
}
public MainWindow()
{
InitializeComponent();
}
}
}
No tool tip :-( |
<igDP:TextField Label="SomeText" Name="Text">
<igDP:TextField.Settings>
<igDP:FieldSettings>
<igDP:FieldSettings.CellValuePresenterStyle>
<Style TargetType="igDP:CellValuePresenter">
<Setter Property="ToolTip" Value="{Binding DataItem.Text}"/>
</Style>
</igDP:FieldSettings.CellValuePresenterStyle>
</igDP:FieldSettings>
</igDP:TextField.Settings>
</igDP:TextField>
Tool tip :-) |
No comments:
Post a Comment