I get the following binding errors in my output window.
System.Windows.Data Error: 40 : BindingExpression path error: 'ProposedStartTime' property not found on 'object' ''GanttChart' (Name='GanttChart')'. BindingExpression:Path=ProposedStartTime; DataItem='GanttChart' (Name='GanttChart'); target element is 'TextBlock' (Name='CustomMovingInfoPopup_ProposedStartTime'); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'ProposedEndTime' property not found on 'object' ''GanttChart' (Name='GanttChart')'. BindingExpression:Path=ProposedEndTime; DataItem='GanttChart' (Name='GanttChart'); target element is 'TextBlock' (Name='CustomMovingInfoPopup_ProposedEndTime'); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'ProposedDuration' property not found on 'object' ''GanttChart' (Name='GanttChart')'. BindingExpression:Path=ProposedDuration; DataItem='GanttChart' (Name='GanttChart'); target element is 'TextBlock' (Name='CustomResizeInfoPopup_ProposedDuration'); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'ProposedStart' property not found on 'object' ''GanttChart' (Name='GanttChart')'. BindingExpression:Path=ProposedStart; DataItem='GanttChart' (Name='GanttChart'); target element is 'TextBlock' (Name='CustomResizeInfoPopup_ProposedStart'); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'ProposedEnd' property not found on 'object' ''GanttChart' (Name='GanttChart')'. BindingExpression:Path=ProposedEnd; DataItem='GanttChart' (Name='GanttChart'); target element is 'TextBlock' (Name='CustomResizeInfoPopup_ProposedEnd'); target property is 'Text' (type 'String')
Both controls are created in GanttChart_TemplateApplied:
private void GanttChart_TemplateApplied(object sender, EventArgs e)
{
FlexyGanttMain.GanttChart.MovingInfoPopup = new CustomMovingInfoPopup();
FlexyGanttMain.GanttChart.ResizeInfoPopup = new CustomResizeInfoPopup();
}
They look like this:
<Popup x:Class="[...]CustomMovingInfoPopup"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:p="clr-namespace:[...]"
mc:Ignorable="d"
Placement="Relative"
>
[...]
<ContentControl Style="{StaticResource ResourceKey=ToolTipStylePopup}" MinWidth="125" Height="Auto">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Name="CustomMovingInfoPopup_Start" Text="{p:Resources Name=Start}" HorizontalAlignment="Left" FontWeight="Bold" Margin="0,0,5,0"/>
<TextBlock Name="CustomMovingInfoPopup_ProposedStartTime" Grid.Column="1" HorizontalAlignment="Right" Margin="0, 0, 0, 10" Text="{Binding ProposedStartTime, StringFormat=g}" />
<TextBlock Name="CustomMovingInfoPopup_End" Grid.Row="1" Text="{p:Resources Name=End}" HorizontalAlignment="Left" FontWeight="Bold" Margin="0,0,5,0"/>
<TextBlock Name="CustomMovingInfoPopup_ProposedEndTime" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Margin="0, 0, 0, 10" Text="{Binding ProposedEndTime, StringFormat=g}" />
</Grid>
</ContentControl>
</Popup>
However when moving a task in gantt the properties are evaluated correctly inside the popup. I guess that on startup the data context of the popup controls still might be set to GanttChart and only later is changed to FlexyTaskResizeTracker.
Could you please take a look into this, so we can avoid those binding errors?
Thanks!
Jan