March 27, 2025, 10:46:20 PM

See more Support incidents in our old archived forum.

Author Topic: Drag Task over Working hours  (Read 5368 times)

Francesco Fantoni

  • Customers
  • Newbie
  • *
  • Posts: 25
Drag Task over Working hours
« on: June 11, 2020, 07:05:23 PM »
Hi,
I need your help again, sorry  :(
Consider this sample https://we.tl/t-qnggcEovZw (I reuse a project from the last post, sorry).

and consider the following Event handler:
 void ShiftTracker_VerticalDragOver(object sender, EventArgs e)
        {
            Point dropCueLocation = ShiftTracker.Global.GetDropCueLocationIn(this.LayoutRoot);
            this.ShowDropCueAt(dropCueLocation);

            bool canDrop = false;
            if (ShiftTracker.Global.CurrentDropRow != null)
            {
                    canDrop = true;
                System.Diagnostics.Debug.WriteLine(ShiftTracker.Global.CurrentDropRow.ToString());
            }
            else
                System.Diagnostics.Debug.WriteLine("null!");

           
            if (canDrop)
                this.ShowCanDropCue();
            else
                this.ShowNoDropCue();
        }

It seems the ShiftTracker.Global.CurrentDropRow is always null if you drag over a working hour and not null over a non-working hour

I you try to move the task in another row CurrentDropRow is not null only over nonworking hours
 


There is maybe something wrong but I don't know what
Thanks for your support
Francesco



Francesco Fantoni

  • Customers
  • Newbie
  • *
  • Posts: 25
Re: Drag Task over Working hours
« Reply #1 on: June 12, 2020, 11:01:33 AM »
I'd like to add that I have set SyncRowBackgrounds = true

Thanks

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 182
Re: Drag Task over Working hours
« Reply #2 on: June 12, 2020, 11:40:23 AM »
Francesco,

We are looking on this, will update you soon.

Thanks,
Raja.

Francesco Fantoni

  • Customers
  • Newbie
  • *
  • Posts: 25
Re: Drag Task over Working hours
« Reply #3 on: June 16, 2020, 06:09:42 PM »
Hi Raja,
can you give me an update?
Thanks
Francesco

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 182
Re: Drag Task over Working hours
« Reply #4 on: June 17, 2020, 03:56:09 PM »
Francesco,

Please include the style for rows in the application as it was missing. We have sent the reference sample in e-mail.

Code:
Code: [Select]
<Style x:Key="BaseRowStyle" TargetType="{x:Type DataGridRow}">
    <Setter Property="SnapsToDevicePixels" Value="true"/>
    <Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
    <Setter Property="ValidationErrorTemplate">
        <Setter.Value>
            <ControlTemplate>
                <TextBlock Foreground="Red" Margin="2,0,0,0" Text="!" VerticalAlignment="Center"/>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type DataGridRow}">
                <Grid>
                    <Border x:Name="DGR_Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                        <SelectiveScrollingGrid>
                            <SelectiveScrollingGrid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </SelectiveScrollingGrid.ColumnDefinitions>
                            <SelectiveScrollingGrid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </SelectiveScrollingGrid.RowDefinitions>

                            <Rectangle x:Name="BackgroundRectangle" Fill="#FFBADDE9" Grid.ColumnSpan="2" Grid.RowSpan="2" Opacity="0"/>

                            <Rectangle x:Name="BackgroundSelRectangle" IsHitTestVisible="False" Grid.Column="1" Grid.RowSpan="2" Fill="#badde9" Opacity="0"/>

                            <DataGridCellsPresenter Grid.Column="1" ItemsPanel="{TemplateBinding ItemsPanel}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            <DataGridDetailsPresenter Grid.Column="1" Grid.Row="1" SelectiveScrollingGrid.SelectiveScrollingOrientation="{Binding AreRowDetailsFrozen, ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical}, Converter={x:Static DataGrid.RowDetailsScrollingConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Visibility="{TemplateBinding DetailsVisibility}"/>
                            <DataGridRowHeader Grid.RowSpan="2" SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Row}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                            <Path x:Name="CurrentRowGlyph" IsHitTestVisible="False" Data="F1 M 511.047,352.682L 511.047,342.252L 517.145,347.467L 511.047,352.682 Z " HorizontalAlignment="Center" Height="10" Margin="8,0,8,0" Opacity="0" Grid.RowSpan="2" Stretch="Fill" VerticalAlignment="Center" Width="6">
                                <Path.Fill>
                                    <LinearGradientBrush EndPoint="0,1.75" StartPoint="0,-.15">
                                        <GradientStop Color="#FF84E3FF" Offset="0"/>
                                        <GradientStop Color="#FF6ABFD8" Offset="0.5"/>
                                        <GradientStop Color="#FF5297AB" Offset="1"/>
                                    </LinearGradientBrush>
                                </Path.Fill>
                            </Path>
                        </SelectiveScrollingGrid>
                    </Border>

                </Grid>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsSelected" Value="true">
                        <Setter Property="Opacity" TargetName="CurrentRowGlyph" Value="1"/>
                        <Trigger.EnterActions>
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation Storyboard.TargetName="BackgroundSelRectangle" Storyboard.TargetProperty="Opacity" Duration="0" To="1" />
                                </Storyboard>
                            </BeginStoryboard>
                        </Trigger.EnterActions>
                        <Trigger.ExitActions>
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation Storyboard.TargetName="BackgroundSelRectangle" Storyboard.TargetProperty="Opacity" Duration="0" To="0" />
                                </Storyboard>
                            </BeginStoryboard>
                        </Trigger.ExitActions>
                    </Trigger>
                    <Trigger Property="gantt:GanttTableBase.CombinedIsMouseOver" Value="true">
                        <Trigger.EnterActions>
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation Storyboard.TargetName="BackgroundRectangle" Storyboard.TargetProperty="Opacity" Duration="0" To=".5" />
                                </Storyboard>
                            </BeginStoryboard>
                        </Trigger.EnterActions>
                        <Trigger.ExitActions>
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation Storyboard.TargetName="BackgroundRectangle" Storyboard.TargetProperty="Opacity" Duration="0" To="0" />
                                </Storyboard>
                            </BeginStoryboard>
                        </Trigger.ExitActions>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource BaseRowStyle}">
</Style>


Thanks,
Raja.

Francesco Fantoni

  • Customers
  • Newbie
  • *
  • Posts: 25
Re: Drag Task over Working hours
« Reply #5 on: June 17, 2020, 04:14:14 PM »
Thanks Raja, it seems ok now! ;D

Another question: Is there someway to avoid side shifting? I'd like to move a Task only with VerticalDragDrop and not with side shifting. This because I don't want the Task can move wherever on the row or above another task. With VerticalDragDrop event I can deny drop on some locations.


Thanks very much
Francesco

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 182
Re: Drag Task over Working hours
« Reply #6 on: June 18, 2020, 09:53:55 AM »
Francesco,

Horizontal movement of tasks should be restricted, only vertical movement should be allowed. Is this what you are looking for? Please clarify.

Thanks,
Raja.

Francesco Fantoni

  • Customers
  • Newbie
  • *
  • Posts: 25
Re: Drag Task over Working hours
« Reply #7 on: June 19, 2020, 07:14:00 AM »
Hi,
to be honest, I'd like horizontal movement to act as vertical movement with moving popup and DragOver and DragDrop event.
One possible solution, I think, would be to restrict horizontal movement and use only vertical movement for all moving actions (this is the reason for the question but I welcome every suggestion).

I hope I explained myself
Thanks
Francesco

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 182
Re: Drag Task over Working hours
« Reply #8 on: June 19, 2020, 03:56:07 PM »
Francesco,

We are working on this, will update you soon.

Thanks,
Raja.

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 182
Re: Drag Task over Working hours
« Reply #9 on: June 22, 2020, 02:07:34 PM »
Francesco,

You can disable horizontal taskbar movement as shown below,

Code: [Select]
public MainPage()
{
    InitializeComponent();

    ShiftTracker.Global.MinDeltaYValue = -1;
    ShiftTracker.Global.IncludeVerticalMovingSupport = true;
}

Thanks,
Raja.

Francesco Fantoni

  • Customers
  • Newbie
  • *
  • Posts: 25
Re: Drag Task over Working hours
« Reply #10 on: June 22, 2020, 04:33:46 PM »
Great!
Thanks
Francesco

Francesco Fantoni

  • Customers
  • Newbie
  • *
  • Posts: 25
Re: Drag Task over Working hours
« Reply #11 on: June 23, 2020, 11:15:07 AM »
Hi Raja,
unfortunately your solution is good but I found a problem:
if in the ShiftTracker_BeginVerticalDrag event I cancel the Drag operation (with args.Cancel=true) it starts again the Horizontal Tracking.
Then I tried to call the ShiftTracker.Global.EndTracking in the BeginVerticalDrag or in the VerticalDragOver event handler but an System.NullReferenceException occours (the exception is not catched in the VS)

Have you any suggests?
Thanks
Francesco

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 182
Re: Drag Task over Working hours
« Reply #12 on: June 23, 2020, 02:23:32 PM »
Francesco,

Currently, there is no option to handle the above scenario. We will provide an option to handle it and update you.

Thanks,
Raja.

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 182
Re: Drag Task over Working hours
« Reply #13 on: July 04, 2020, 03:56:25 PM »
Francesco,

We have provided an option to prevent horizontal shifting and testing is in progress, will update you soon.

Thanks,
Raja.

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 182
Re: Drag Task over Working hours
« Reply #14 on: July 09, 2020, 03:49:29 PM »
Francesco,

We have introduced new PreventHorizontalShifting option to prevent horizontal movement of taskbars. We have sent the latest assembly(v9.0.45.11) from our support mail, make sure to get it.

Code: [Select]
public MainPage() {
InitializeComponent();

// prevent horizontal shifting by setting true. Default is false.
ShiftTracker.Global.PreventHorizontalShifting = true;
}

Thanks,
Raja.