Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Hide window title bar

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

    Hide window title bar


    Is there a way to hide the window title bar?

    According to the WPF docs the following should work but it does not seem to.

    Code:
    foreach (var window in NinjaTrader.Core.Globals.AllWindows)
    {[INDENT]window.Dispatcher.Invoke(new Action(() =>
    {[/INDENT][INDENT=2]if (window.Title=="Market Analyzer")
    {
    window.WindowStyle=WindowStyle.None;
    }[/INDENT][INDENT]
    }));[/INDENT]
     }

    #2
    Hello Bidder,

    NinjaTrader windows are already using WindowStyle.None as the title bar area is custom made and is not the actual Windows title bar.

    No, there are no supported methods to remove this. However, using unsupported code, you might be able dig around the visual tree and remove any rectangles, grids, etc that make up that custom title area.

    Unfortunately, this would be outside of what the NinjaTrader Support team is able to assist with.
    This thread will remain open for any community members that would like to provide unsupported code.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chelsea.

      This will do it. Tested on charts and market analyzer.

      Code:
      [FONT=Arial]public static void TitleBarToggle(string WinName)[/FONT]
      [FONT=Arial]{[/FONT][INDENT][FONT=Arial]foreach (var window in NinjaTrader.Core.Globals.AllWindows)[/FONT]
      [FONT=Arial]{[/FONT][/INDENT][INDENT=2][FONT=Arial]window.Dispatcher.Invoke(new Action(() =>[/FONT]
      [FONT=Arial]{[/FONT][/INDENT][INDENT=3][FONT=Arial]if (window.Title.Contains(WinName))[/FONT]
      [FONT=Arial]{[/FONT][/INDENT][INDENT=4][FONT=Arial]IEnumerable<System.Windows.Controls.Grid> grids=FindVisualChildren<System.Windows.Controls.Grid>(window);[/FONT]
      [FONT=Arial]foreach (System.Windows.Controls.Grid grd in grids)[/FONT]
      [FONT=Arial]{[/FONT][/INDENT][INDENT=5][FONT=Arial]if (grd.Name=="outerGrid")[/FONT]
      [FONT=Arial]{[/FONT][/INDENT][INDENT=6][FONT=Arial]int Hgt=0;[/FONT]
      [FONT=Arial]if (grd.RowDefinitions[0].ActualHeight==0) Hgt=24;[/FONT]
      [FONT=Arial]grd.RowDefinitions[0].Height=new GridLength(Hgt);
      break; [/FONT][/INDENT][INDENT=5][FONT=Arial]}[/FONT][/INDENT][INDENT=4][FONT=Arial]}[/FONT][/INDENT][INDENT=3][FONT=Arial]}[/FONT][/INDENT][INDENT=2][FONT=Arial]}));[/FONT][/INDENT][INDENT][FONT=Arial]}[/FONT][/INDENT]
       [FONT=Arial]}[/FONT]
      Code:
      public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject
      {[INDENT]if (depObj != null)
      {[/INDENT][INDENT=2]for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
      {[/INDENT][INDENT=3]DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
      if (child != null && child is T)
      {
           yield return (T)child;
      }
      
      foreach (T childOfChild in FindVisualChildren<T>(child))
      {
              yield return childOfChild;
      }[/INDENT][INDENT=2]}[/INDENT][INDENT]}[/INDENT]
       }

      Comment


        #4
        hi Bidder, Can you please in where to put this code.. I have some minimal experience with coding small indicator.

        Comment


          #5
          Hi, couple of things.
          First, this site has messed up all the code in the code box. All the text that looks like:
          CODE]{[INDENT][FONT=Arial][/CODE]
          This is not part of the code but is html formatting.

          I put the code in the "OnWindowCreated" method of an addon.
          https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?addon_development_ov erview.htm

          Comment


            #6
            Thank you for quick reply. It makes so much sense now. I will check this out.

            Comment


              #7
              Is there a way to hide the window title bar? According to the WPF docs the following should work but it does not seem to. foreach (var window in NinjaTrader.Core.Globals.AllWindows) { window.Dispatcher.Invoke(new Action(() =&gt; { if (window.Title==&quot;Market Analyzer&quot;) { window.WindowStyle=WindowStyle.None; }


              Sorry, but the link is not working anymore.... would you please paste it again?

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              91 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              48 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              31 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              34 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              69 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X