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 NullPointStrategies, Today, 05:17 AM
    0 responses
    50 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    126 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X