Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

WPF Zorder of a button

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    WPF Zorder of a button

    Hello,
    In a chart I add a large control and a button on top of the large control.
    When using
    Code:
    ChartControl.Children.Add( btn1 );
    System.Windows.Controls.Panel.SetZIndex( btn1, 10 );
    the button is visible.
    As UserControlCollection.Add is the recommended way to add controls to a chart, one should do
    Code:
    UserControlCollection.Add( btn1 );
    System.Windows.Controls.Panel.SetZIndex( btn1, 10 );
    But then the ZIndex seems not to be applied because the button remains hidden. So how can we set ZIndex when using UserControlCollection.Add ?
    Thanks.
    Last edited by fpa75; 03-14-2017, 03:28 AM.

    #2
    Hello,

    Thank you for the post.

    I wanted to check, Could you provide a complete example of what you are trying to achieve?

    I tried to use the full example we have in the help guide for UserControlCollection and removed the columns of the grid so the buttons are on top of each other. I can see that setting the ZOrder does effect the button and controls which are on top.

    Have you tried the full example from the UserControlCollection page at this point or are you doing something that is logically different than the example?

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Sorry, you could not understand the problem without knowing that 2 indicators are used. One add the button and another one add a large header at the top of the chart. I have solved the issue by using UserControlCollection in both indicators, which is obvious to do but I haven't though to do it. There is also some luck because the button appears on top of the header and I do not know why, but it's ok if it works.

      You may be interested to know why I had this issue : it is in link with strategies. If ChartControl.Children.Add() is used to add a control in the chart (a button for example), the button will disappear when you add or remove a strategy in the chart. Is this normal behaviour or is it a bug ? Whereas if UserControlCollection is used then the button remains in the chart.

      So UserControlCollection solve this problem. The remaining problem is when one add controls in the price scale (with System.Windows.Controls.Grid.SetColumn( myControl, 2 )). To add a WPF control in the price scale, UserControlCollections cannot be used. It seems unable to add a control in the 3rd column of the grid/chart. So one must use ChartControl.Children.Add.

      This leads to something that is missing in NT 8 from what I have learnt at the moment: the ability to work in the price scale. I do not like the standard price marker and have developed my own. Doing so I have understood that NT has these limitations :
      - because RenderTarget draws only in the chart it is not possible to use SharpDX in the price scale
      - because UserControlCollections cannot reach the price scale column, one cannot use WPF controls

      If I am wrong please correct me. If I am right I hope NT will address these limitations in a future update.

      Thanks.
      Last edited by fpa75; 03-16-2017, 03:31 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by elderan, Today, 08:03 PM
      0 responses
      2 views
      0 likes
      Last Post elderan
      by elderan
       
      Started by algospoke, Today, 06:40 PM
      0 responses
      10 views
      0 likes
      Last Post algospoke  
      Started by maybeimnotrader, Today, 05:46 PM
      0 responses
      9 views
      0 likes
      Last Post maybeimnotrader  
      Started by quantismo, Today, 05:13 PM
      0 responses
      7 views
      0 likes
      Last Post quantismo  
      Started by AttiM, 02-14-2024, 05:20 PM
      8 responses
      169 views
      0 likes
      Last Post jeronymite  
      Working...
      X