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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X