<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Add On > NinjaTrader Controls >


Previous page Return to chapter overview Next page


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


Disposes of the IntervalSelector (Note: calling the NTTabPage base.Cleanup() is sufficient to clean up this control)


A BarsPeriod representing the interval currently selected


Event handler for when the interval changed




This example demonstrates how to use the interval selector and properly link its behavior to windows linking.



private IntervalSelector   intervalSelector;        


private DependencyObject LoadXAML()


    // Note: pageContent (not demonstrated in this example) is the page content of the XAML


    // Find the Interval selector

    intervalSelector = LogicalTreeHelper.FindLogicalNode(pageContent, "intervalSelector") as IntervalSelector;

    if (intervalSelector != null)

         intervalSelector.IntervalChanged += OnIntervalChanged;




// This method is fired when our interval selector changes intervals

private void OnIntervalChanged(object sender, BarsPeriodEventArgs e)


    if (e.BarsPeriod == null)




/* IIntervalProvider member. Required if you want to use the interval linker mechanism on this window.

No functionality has been linked to the interval linker in this sample. */

public BarsPeriod BarsPeriod { get; set; }


// NOTE: Don't forget to clean up resources and unsubscribe to events

// Called by TabControl when tab is being removed or window is closed

public override void Cleanup()


    // Clean up our resources

    if (intervalSelector != null)

         intervalSelector.IntervalChanged -= OnIntervalChanged;







<Page        xmlns=""









         <ColumnDefinition Width="Auto"/>

         <ColumnDefinition Width="*"/>



    <Tools:IntervalSelector x:Name="intervalSelector" Grid.Column="0" HorizontalAlignment="Left"/>