Hi, I'm trying to hide docking indicators when it is not possible to dock on a certain side. I started by copying the docking indicators as illustrated in the example "Customizing the DockIndicators" in the feature browser, so the code below closely resembles that. I already partly succeeded, but the center docking indicator is behaving strangely however. It is still showing the docking indicator untill at the moment the mouse enters the symbol, then it disappears. The following piece of code is not working as expected (I left out unimportant pieces):
<!-- Left Indicator --><igWindows:CardPanel x:Name="PART_DockLeft" ...> <Grid x:Name="leftIndicatorIcon" IsEnabled="{TemplateBinding CanDockLeft}" ...> <Ellipse x:Name="leftIndicatorBorder" ... /> <Viewbox ...> <Path x:Name="glyphLeft" ... /> </Viewbox> <Grid.Style> <Style TargetType="Grid"> <Style.Triggers> <DataTrigger Binding="{Binding Path=CanDockLeft, RelativeSource={RelativeSource Mode=TemplatedParent}}" Value="False"> <Setter Property="Visibility" Value="Collapsed"/> </DataTrigger> </Style.Triggers> </Style> </Grid.Style> </Grid></igWindows:CardPanel>
So basically I only added the style trigger. I also tried setting the Visibility property directly using a binding and a value converter, but that resulted in the same effect.
HI,
You are very welcome. I’m sure that I have given you the best advice that I can. Andrew is the developer who responded to my question. You may have seen many of his other posts.
Please let me know if you have further questions on this topic.
Hi Marianne,
I will certainly try this approach and investigate it further, but knowing that it is a "hack" approach with possible unwanted behavior it is probably not going to be implemented in the final solution. The program is intended for our customers after all so it should work without any problems, if it were for internal staff it wouldn't matter that much.
In any case, thanks for helping me out here. I also appreciate that you posted a feature request and I hope that it will be implemented so that I can come up with a clean approach to this problem.
Kind regards,
Stefan
Hi,
I submitted my sample to development and asked their assistance as to the best way to approach your request. I had the intention of creating another resource, similar to our CanDocInds, that would contain a boolean to which we could bind the AllowDockingInTabGroup of all of the ContentPanes. Then I added a PaneDragOver event for the DockManager. I was working on the idea that we could identify the FloatPaneAction in the PageDragOver event and perhaps identify the pane that is being dragged over before the dockingIndicators were created.
private void myDM_PaneDragOver(object sender, Infragistics.Windows.DockManager.Events.PaneDragOverEventArgs e)
{
if (e.DragAction is Infragistics.Windows.DockManager.Dragging.MoveWindowAction)
Infragistics.Windows.DockManager.Dragging.MoveWindowAction mwa = e.DragAction as Infragistics.Windows.DockManager.Dragging.MoveWindowAction;
//HitTestResult result = VisualTreeHelper.HitTest(DCH, mwa.NewLocation);
}
Our development staff provided the following information.
The PaneDragOver event is raised as the mouse is moved but after we have established the drop point which involves checking which element we are over and hit testing the docking indicators. It sounds like you want something that is raised before the docking indicators are shown and we hit test against them. I could be mistaken but the only way that would happen is if we add something – whether that is an event to determine the docking indicator states before we show the indicator or something else.
As a result of this comment I have submitted a feature request for you directly to our Product Management team concerning the ability to know when the dockingIndicators are about to be shown. Our product team chooses new feature requests for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products so as trends appear in requested features, we can plan accordingly.
Our philosophy is to enhance our toolset based on customer feedback. If your features are chosen for development you will be notified at that time. Your reference number is FR14112.
Development continues with these suggestions:
It may be possible for you to do something hackish like define an attached property that binds to the ToolWindow’s Owner property and then write some logic to initialize the CanDockInTabGroup of the panes being dragged. However there are potential issues – the drag may be cancelled and so you may not get the dragended and therefore may not be able to revert the CanDockInTabGroup back to the original/desired state, you would need to interpret what will happen based on the owner, etc.
If you want to try going down this road you would define an attached property like the following:
public static class DockingIndicatorTargetHelper
#region DockingIndicatorTarget
/// <summary>
/// Identifies the DockingIndicatorTarget attached dependency property
/// </summary>
/// <seealso cref="GetDockingIndicatorTarget"/>
/// <seealso cref="SetDockingIndicatorTarget"/>
public static readonly DependencyProperty DockingIndicatorTargetProperty = DependencyProperty.RegisterAttached("DockingIndicatorTarget",
typeof(object), typeof(DockingIndicatorTargetHelper),
new PropertyMetadata(null, new PropertyChangedCallback(OnDockingIndicatorTargetChanged))
);
private static void OnDockingIndicatorTargetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
/// Gets the value of the attached DockingIndicatorTarget DependencyProperty.
/// <param name="d">The object whose value is to be returned</param>
/// <seealso cref="DockingIndicatorTargetProperty"/>
public static object GetDockingIndicatorTarget(DependencyObject d)
return (object)d.GetValue(DockingIndicatorTargetHelper.DockingIndicatorTargetProperty);
/// Sets the value of the attached DockingIndicatorTarget DependencyProperty.
/// <param name="d">The object whose value is to be modified</param>
/// <param name="value">The new value</param>
public static void SetDockingIndicatorTarget(DependencyObject d, object value)
d.SetValue(DockingIndicatorTargetHelper.DockingIndicatorTargetProperty, value);
#endregion //DockingIndicatorTarget
Then add a Setter to the DockingIndicator style:
<Style TargetType="{x:Type igDock:DockingIndicator}">
<Setter Property="local:DockingIndicatorTargetHelper.DockingIndicatorTarget" Value="{Binding Path=(igWindows:ToolWindow.ToolWindow).Owner, RelativeSource={RelativeSource Self}}" />
Since you are using a custom DockingIndicator we are simply using hittesting against the element to determine which indicator the mouse is over, if you hid or otherwise rendered particular indicators as not hittestable then we wouldn’t try to use that as a drop point.
So if you just want to know if the docking indicator is being shown for the DocumentContentHost then maybe you can do something like the following:
SetTargetIsDocumentHost(d, e.NewValue != null && XamDockManager.GetPaneLocation(e.NewValue as DependencyObject) == PaneLocation.Document);
#region TargetIsDocumentHost
/// Identifies the TargetIsDocumentHost attached dependency property
/// <seealso cref="GetTargetIsDocumentHost"/>
/// <seealso cref="SetTargetIsDocumentHost"/>
public static readonly DependencyProperty TargetIsDocumentHostProperty = DependencyProperty.RegisterAttached("TargetIsDocumentHost",
typeof(bool), typeof(DockingIndicatorTargetHelper),
new PropertyMetadata(false)
/// Gets the value of the attached TargetIsDocumentHost DependencyProperty.
/// <seealso cref="TargetIsDocumentHostProperty"/>
public static bool GetTargetIsDocumentHost(DependencyObject d)
return (bool)d.GetValue(DockingIndicatorTargetHelper.TargetIsDocumentHostProperty);
/// Sets the value of the attached TargetIsDocumentHost DependencyProperty.
public static void SetTargetIsDocumentHost(DependencyObject d, bool value)
d.SetValue(DockingIndicatorTargetHelper.TargetIsDocumentHostProperty, value);
#endregion //TargetIsDocumentHost
Where the attached TargetIsDocumentHost would be true/false on the DockingIndicator based on the Owner that the indicator is associated with.
Please let me know if you have questions.
I've been working thru a possible solution but I wanted to contact development concerning your questions. I'll update you shortly.
Sorry, it's still not working as it's supposed to... Although it is getting closer!
All panes should be able to be tabbed in the blue window, so I set AllowDockingInTabGroup to True for the 3 panes. This has the side effect that panes can now also be tabbed within the panes themselves, meaning you can also tab red with green inside a dockable floating pane. This should not be possible, there should be only one tabbing area on the entire form (the blue area).
Is it perhaps possible to react to the dragging events? There has to be some kind of event, the same one that moves the docking indicators when entering another area. If I could react to that event and set the AllowXXX properties at that moment, I believe this problem could be solved.