I have the following code throwing exception: "The calling thread cannot access this object because a different thread owns it."
protected override void OnStateChange() ... if (State == State.SetDefaults) { ... [B]BLTrendColor = new SolidColorBrush(Color.FromRgb(0, 255, 0)); BRTrendColor = new SolidColorBrush(Color.FromRgb(255, 0, 0));[/B] } protected override void OnBarUpdate() { if ((CurrentBar % 2) == 0) [B]BarBrush = BLTrendColor;[/B] else if ((CurrentBar % 3) == 0) [B]BarBrush = BRTrendColor;[/B] } [XmlIgnore] [Display(Name = "Bull trend", GroupName = "Color")] public Brush BLTrendColor { get; set; } [XmlIgnore] [Display(Name = "Bear trend", GroupName = "Color")] public Brush BRTrendColor { get; set; }
Note that I played extensively with built in Brushes, with properties being static etc. reaching out since ran out of options that I can think of.
Thank you in advance!
Comment