2013-07-18 58 views
1

因此,我有一個DataGrid,我希望能夠使用ToolTip服務顯示鼠標結束後的數據。有人能告訴我我做錯了什麼嗎?非常感謝。WPF dataGrid工具提示服務

這是我DataGrid

<DataGrid Name="dgData" CanUserAddRows="False" 
         Style="{DynamicResource DataGridRow}" 
         AutoGenerateColumns="False" 
         CanUserReorderColumns="False" 
         EnableColumnVirtualization="True" /> 

這裏是我已經盡力了,但我的應用程序不會加載DataGrid當我添加這一點。

<Style TargetType="{x:Type DataGrid}"> 
    <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Value}" /> 
</Style> 

回答

2

請你的資源

<Style TargetType="{x:Type DataGridCell}"> 
    <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Content.Text}" /> 
</Style> 
+0

添加此我得到一個錯誤的制定者適當的時候我嘗試加載了datagird – user2292217

+0

請你指定的錯誤?它完美地爲我工作,沒有任何錯誤。 – Nitesh