IntervalSelector
Definition
IntervalSelector is as a UI element users can interact with for selecting intervals. This can be used with interval linking between windows.
Events and Properties
| Property | Description |
|---|---|
| Cleanup() | Disposes of the IntervalSelector (Note: calling the NTTabPage base.Cleanup() is sufficient to clean up this control) |
| Interval | A BarsPeriod representing the interval currently selected |
| IntervalChanged | Event handler for when the interval changed |
Examples
This example demonstrates how to use the interval selector and properly link its behavior to windows linking.
1 private IntervalSelector intervalSelector; 2 3 private DependencyObject LoadXAML() 4 { 5 // Note: pageContent (not demonstrated in this example) is the page content of the XAML 6 7 // Find the Interval selector 8 intervalSelector = LogicalTreeHelper.FindLogicalNode(pageContent, "intervalSelector") as IntervalSelector; 9 if (intervalSelector != null) 10 intervalSelector.IntervalChanged += OnIntervalChanged; 11 } 12 13 // This method is fired when our interval selector changes intervals 14 private void OnIntervalChanged(object sender, BarsPeriodEventArgs e) 15 { 16 if (e.BarsPeriod == null) 17 return; 18 } 19 20 /***IIntervalProvider** member. Required if you want to use the interval linker mechanism on this window. 21 No functionality has been linked to the interval linker in this sample.*/ 22 public BarsPeriod BarsPeriod { get; set; } 23 24 // NOTE: Don't forget to clean up resources and unsubscribe to events 25 // Called by **TabControl** when tab is being removed or window is closed 26 public override void Cleanup() 27 { 28 // Clean up our resources 29 if (intervalSelector != null) 30 intervalSelector.IntervalChanged -= OnIntervalChanged; 31 32 base.Cleanup(); 33 }
<page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:accountdata="clr-namespace:NinjaTrader.Gui.AccountData;assembly=NinjaTrader.Gui" xmlns:accountperformance="clr-namespace:NinjaTrader.Gui.AccountPerformance;assembly=NinjaTrader.Gui" xmlns:atmstrategy="clr-namespace:NinjaTrader.Gui.NinjaScript.AtmStrategy;assembly=NinjaTrader.Gui" xmlns:tools="clr-namespace:NinjaTrader.Gui.Tools;assembly=NinjaTrader.Gui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <grid> <grid.columndefinitions> <columndefinition width="Auto"></columndefinition> <columndefinition width="*"></columndefinition> </grid.columndefinitions> <tools:intervalselector grid.column="0" horizontalalignment="Left" x:name="intervalSelector"></tools:intervalselector> </grid> </page>

