RadiantQ Forum
Product => WPF Gantt Package => Topic started by: Francesco Fantoni on June 11, 2020, 07:05:23 PM
-
Hi,
I need your help again, sorry :(
Consider this sample https://we.tl/t-qnggcEovZw (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
(https://i.ibb.co/x2xXXg3/1.png)
(https://i.ibb.co/Vvtk5gK/2.png)
There is maybe something wrong but I don't know what
Thanks for your support
Francesco
-
I'd like to add that I have set SyncRowBackgrounds = true
Thanks
-
Francesco,
We are looking on this, will update you soon.
Thanks,
Raja.
-
Hi Raja,
can you give me an update?
Thanks
Francesco
-
Francesco,
Please include the style for rows in the application as it was missing. We have sent the reference sample in e-mail.
Code:
<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.
-
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
-
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.
-
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
-
Francesco,
We are working on this, will update you soon.
Thanks,
Raja.
-
Francesco,
You can disable horizontal taskbar movement as shown below,
public MainPage()
{
InitializeComponent();
ShiftTracker.Global.MinDeltaYValue = -1;
ShiftTracker.Global.IncludeVerticalMovingSupport = true;
}
Thanks,
Raja.
-
Great!
Thanks
Francesco
-
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
-
Francesco,
Currently, there is no option to handle the above scenario. We will provide an option to handle it and update you.
Thanks,
Raja.
-
Francesco,
We have provided an option to prevent horizontal shifting and testing is in progress, will update you soon.
Thanks,
Raja.
-
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.
public MainPage() {
InitializeComponent();
// prevent horizontal shifting by setting true. Default is false.
ShiftTracker.Global.PreventHorizontalShifting = true;
}
Thanks,
Raja.