Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

My own Quantity Selector not behaving as I want

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

    My own Quantity Selector not behaving as I want

    HI
    I have a quantitySelector in the toolbar as a button.
    It works fine and I can get the value of it in my indicator.
    What I can't do is change the colour to highlight that say I have gone for more than 1 contract.
    Its not a deal breaker I am just mystified as to why I can't change properties?
    What am I missing ?

    Here is the code I am using to set the control

    Code:
                    quantitySelector = new NinjaTrader.Gui.Tools.QuantityUpDown();
                    quantitySelector.VerticalAlignment = VerticalAlignment.Center;
                    quantitySelector.Padding = new System.Windows.Thickness(3,0,3,1);
                    quantitySelector.Margin = new System.Windows.Thickness(0);
                    quantitySelector.BorderThickness = new Thickness(2,2,2,2);
    
                    chartWindow.MainMenu.Add(quantitySelector);
                     quantitySelector.Value = 1;/// sets minimum so value is not zero
                    quantitySelector.Background = Brushes.Blue;//works but can't get background to change in value_changed event
    ​
    and here is my Value_Changed Event

    Code:
                    private void QuantitySelector_ValueChanged(object sender, RoutedEventArgs e)
            {
                ChartControl.Dispatcher.InvokeAsync((Action)(() =>
    {
                myQuantity        = quantitySelector.Value;
                ForceRefresh();
                if(myQuantity > 1)
                // NinjaTrader.Gui.Tools.QuantitySelector.BackgroundProperty. = Brushes.Red;
                quantitySelector.BorderThickness = new Thickness(3,3,3,3);
                quantitySelector.BorderBrush= Brushes.Red;
    
                //quantitySelector.Background = Brushes.Red;
                }));
            }​

    #2
    Hello Mindset,

    Most of the WPF controls colors are dictated by the skin files which would overwrite your manual changes. This is also a custom control so setting the values directly on the control instead of the sub controls it uses would mean that no change is made. You can try setting the Style property to null and see if that allows for your color changes, if not that means the properties you are setting are not being used by the sub controls it contains.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    51 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X