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

How to highlight a chart tab?

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

    How to highlight a chart tab?

    I have multiple charts open in a window, each having it's own tab.
    I would like to change the background color of a tab or maybe the color of the font in the tab when I am in a position.

    Is there a code sample anywhere that does this?
    Or perhaps a code sample of how to get ahold of the tab of the ChartControl.Parent?

    Thanks,
    Gary

    #2
    Hello,

    Thank you for the post.

    Currently this would require to access the Tab control and modify the Style of the TabItems, unfortunately I am unaware of a complete sample for this type of change. There is one sample on the forum I had posted to demonstrate a concept but in turn it removes the X button from the tab as a side effect so this is not a good solution without first figuring out how to work around the x button being removed.

    I am not certain of a good way to do this as the internal templates delegate the style and text for the tab item based if it is selected or not or if there is one or more tabs. Changing the whole style for the tab may not be the correct solution in this case but is certainly possible.



    I can put in a feature request for this to potentially add a Property rather than trying to modify the actual style, something similar to BackBrush for example, potentially a "TabStyle" property.

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

    Comment


      #3
      Yes, please request the feature.
      It would be nice to have a simple way to access and tweak the look of the tab (color at least).

      Thanks,
      Gary

      Comment


        #4
        Need more Info...

        Could you please provide more information on how and when Ninja changes the Style of the ChartTab.

        I was able to find the windows element that owns the style I want to alter by doing this:
        Code:
        (ChartControl.ChartTab.Parent as TabItem).Style
        I was also able to change the text by doing this:
        Code:
        (ChartControl.ChartTab.Parent as TabItem).Header = "SomeText"
        I tried to change the background color of the Tab by doing this:
        Code:
        longStyle = new Style(typeof(TabItem),tabItem.Style);
        longStyle.Setters.Add(new Setter(System.Windows.Controls.TabItem.BackgroundProperty, Brushes.Green));
        (ChartControl.ChartTab.Parent as TabItem).Style = longStyle;
        This did not work as expected. The color did not change immediately. I accidentally noticed that it did change when I clicked on a different tab. Then the color went back to what it was when I clicked to my tab again.

        Ninja must have multiple styles being used such as for 'lost focus', 'mouse over', etc.
        So, I would like to know more about how to alter the style correctly so that my style will be used in all cases or how I can provide multiple styles for ninja to use.

        Thanks,
        Gary

        Comment


          #5
          Originally posted by GaryAlbers View Post
          Could you please provide more information on how and when Ninja changes the Style of the ChartTab.
          I personally played around with the .xml skins and couldn't figure this out... It looked like something defined (things that made sense) in the .xml, but it didn't work.

          It should be something simple. I also hope they can tell us.

          Comment


            #6
            Has there been any progress on this (after more than 4 years)?

            Essentially, I would like to know how to:
            • Change the Background colour of a tab, either with the tab selected or not selected
            • Similarly, change the Foreground colour of the tab title (Header text), either with the tab selected or not selected
            Any information on how this can be done? Or has the capability to do this been introduced since the last post here? (Thanks Gary for the original posting!)

            Thanks.
            Multi-Dimensional Managed Trading
            jeronymite
            NinjaTrader Ecosystem Vendor - Mizpah Software

            Comment


              #7
              Hello jeronymite,

              This would fall under general C# and would not be documented or directly supported by NinjaTrader.

              I did a quick google search and it looks like the template border needs to be set.


              I'm doing something similar to the DropMenu in the SampleWPFModifications script and you may find this helpful.
              Hello All, Moving forward this will be maintained in the help guide reference samples and no longer maintained on the forum. Creating Chart WPF (UI) Modifications from an Indicator - https://ninjatrader.com/support/help...ui)-modifi.htm (https://ninjatrader.com/support/helpGuides/nt8/creating-chart-wpf-(ui)-modifi.htm) I've
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Thanks, Chelsea. Always appreciate your comments.

                Your SampleWPFModifications example is interesting. I commend you for providing these types of sample packages -- they are always helpful in the context of customising NinjaTrader 8.

                I seem to recall that there is a location where many example code packages are listed. Could you provide that location, please? It would be great if there was continuing enhancement of such a collection and that it be well-publicised in the Help documentation, if that is not already the case. (Apologies and thanks if this is already being done.)

                Thanks.
                Last edited by jeronymite; 01-18-2021, 02:54 PM.
                Multi-Dimensional Managed Trading
                jeronymite
                NinjaTrader Ecosystem Vendor - Mizpah Software

                Comment


                  #9
                  Hello jeronymite,

                  There is not a centralized location for support team created examples. These are spread around the forum.

                  There are official reference samples, which mainly stick to NinjaTrader documented code, in the help guide.


                  I've noted your interest in a centralized location for our support team created examples.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by DJ888, 04-16-2024, 06:09 PM
                  4 responses
                  12 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Started by terofs, Today, 04:18 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post terofs
                  by terofs
                   
                  Started by nandhumca, Today, 03:41 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post nandhumca  
                  Started by The_Sec, Today, 03:37 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post The_Sec
                  by The_Sec
                   
                  Started by GwFutures1988, Today, 02:48 PM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_Clayton  
                  Working...
                  X