Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Diagram Node Zindex
posted

I am currently creating a diagram with a custom display template inside of a node. I have added a context menu to allow the user to bring a node forward. Upon this selecting this option I set the zindex of the nod and the content with-in to the highest of all of the other nodes in the diagram. However when I move the node around it is still under other items in the control.

If I remove the custom control from the node it works as expected, which is confusing to me. Is there any standard way for adjusting the zorder of a node?

	<ig:NodeDefinition TargetType="{x:Type vm:FunctionTuneItemViewModel}">
					<ig:NodeDefinition.NodeStyle>
						<Style BasedOn="{StaticResource BaseDiagramElement}" TargetType="ig:DiagramNode">
							<Setter Property="DisplayTemplate">
								<Setter.Value>
									<DataTemplate>
										<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
											<functionView:FunctionView  Loaded="CalibrationItem_Loaded"></functionView:FunctionView>
										</ScrollViewer>
									</DataTemplate>
								</Setter.Value>
							</Setter>
						</Style>
					</ig:NodeDefinition.NodeStyle>
				</ig:NodeDefinition>

private void MenuItem_Click(object sender, RoutedEventArgs e)
		{
			var maxZindex = Diagram.Items.ToList().Max(di => di.ZIndex);
					
			(((ContextMenu)(sender as MenuItem).Parent).PlacementTarget as DiagramItem).ZIndex = maxZindex + 1;
		}
		
		private void CalibrationItem_Loaded(object sender, RoutedEventArgs e)
		{
			var frameworkElement = (sender as FrameworkElement);
			var diagramItem = Diagram.GetDiagramItemFromDataItem(frameworkElement.DataContext);

			diagramItem.Height = frameworkElement.ActualHeight + 5;
			diagramItem.Width = frameworkElement.ActualWidth + 5;

			diagramItem.SizeChanged += (s, e1) =>
			{
				HandleNodeMovement(diagramItem,new Point(diagramItem.Bounds.X,diagramItem.Bounds.Y));
			};

			diagramItem.LayoutUpdated += (s, e2) =>
			{
				Panel.SetZIndex(frameworkElement, diagramItem.ZIndex);
			};

			frameworkElement.LayoutUpdated += (s1, e3) =>
			{
				Debug.WriteLine($"Calibration Item zindex {Panel.GetZIndex(frameworkElement)}");
			};

			handlingItemDropped = false;
		}
		
	I

Parents
No Data
Reply
  • 34430
    Offline posted

    Hello Josh,

    I have been investigating into this behavior you are referring to, and I have reproduced it. It appears that the actual ZIndex property on the diagram items is not behaving correctly. As such, I would recommend that you use the attached Canvas.SetZIndex method, as this appears to be working better than the actual ZIndex property on my end.

    This is unexpected behavior, and as such, I have asked our engineering staff to examine it a bit further. To ensure this receives attention I have logged it in our internal tracking systems with a development ID of 248306 and have created you a private support case, CAS-190174-X9B9X2 that I will be linking to this issue so you can be notified of a fix or other resolution. You can access this support case here: https://www.infragistics.com/my-account/support-activity.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Software Developer

Children
No Data