我正在研究一個日曆程序,它主要由WPF DataGrid
組成。由於沒有足夠的空間來顯示一天中的所有條目(這是一個DataGridCell
),包含day shell全部條目的工具提示出現在鼠標懸停處。這到目前爲止工作與下面的代碼片段。現在(小)問題:如果一天沒有條目,則不會彈出工具提示框。用下面的代碼彈出一個空的工具提示。防止wpf數據網格空工具提示
<DataGridTemplateColumn x:Name="Entry"
IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding EntryText}"
Foreground="{Binding EntryForeground}"
FontWeight="{Binding EntryFontWeight}">
</TextBlock>
<TextBlock Text="{Binding RightAlignedText}"
Foreground="Gray"
Background="Transparent">
<TextBlock.ToolTip>
<TextBlock Text="{Binding AllEntriesText}"/>
</TextBlock.ToolTip>
</TextBlock>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
數據綁定經由
myCalDataGrid.Itemssource = _listOfDays;
在代碼所做的後面,其中,A「日」爲單個日曆行視圖模型。
感謝您的回答。我會檢查一下併發送一份報告。 – TheCalendarProgrammer
好答案,像魅力一樣工作。 – Mark