AtmStrategySelector

View as Markdown

Definition

AtmStrategySelector is an UI element users can interact with for selecting ATM Strategies.

Events and Properties

PropertyDescription
Cleanup()Disposes of the AtmStrategySelector (Note: calling the NTTabPage base.Cleanup() is sufficient to clean up this control)
CustomPropertiesChangedEvent handler for when properties have changed on the ATM strategy
IdA string identifying the ATM Strategy selector
SelectedAtmStrategyReturns an AtmStrategy representing the selected ATM strategy
SelectionChangedEvent handler for when the selected ATM strategy has changed

Examples

This example demonstrates how to use the ATM strategy selector and properly link its behavior with the quantity up/down and TIF selectors.

Examples

1private QuantityUpDown qudSelector;
2private TifSelector tifSelector;
3private AtmStrategy.AtmStrategySelector atmStrategySelector;
4
5private DependencyObject LoadXAML()
6{
7 qudSelector = LogicalTreeHelper.FindLogicalNode(pageContent, "qudSelector") as QuantityUpDown;
8 tifSelector = LogicalTreeHelper.FindLogicalNode(pageContent, "tifSelector") as TifSelector;
9 tifSelector.SetBinding(TifSelector.AccountProperty, new Binding { Source = accountSelector, Path = new PropertyPath("SelectedAccount") });
10 tifSelector.SelectionChanged += (o, args) =>
11 {
12 if (atmStrategySelector.SelectedAtmStrategy != null)
13 atmStrategySelector.SelectedAtmStrategy.TimeInForce = tifSelector.SelectedTif;
14 };
15 atmStrategySelector = LogicalTreeHelper.FindLogicalNode(pageContent, "atmStrategySelector") as AtmStrategy.AtmStrategySelector;
16 atmStrategySelector.Id = Guid.NewGuid().ToString("N");
17 if (atmStrategySelector != null)
18 atmStrategySelector.CustomPropertiesChanged += OnAtmCustomPropertiesChanged;
19 atmStrategySelector.SetBinding(AtmStrategy.AtmStrategySelector.AccountProperty, new Binding { Source = accountSelector, Path = new PropertyPath("SelectedAccount") });
20 atmStrategySelector.SelectionChanged += (o, args) =>
21 {
22 if (atmStrategySelector.SelectedItem == null)
23 return;
24 if (args.AddedItems.Count > 0)
25 {
26 AtmStrategy selectedAtmStrategy = args.AddedItems[0] as AtmStrategy;
27 if (selectedAtmStrategy != null)
28 tifSelector.SelectedTif = selectedAtmStrategy.TimeInForce;
29 }
30 };
31}
32
33private void OnAtmCustomPropertiesChanged(object sender, NinjaScript.AtmStrategy.CustomPropertiesChangedEventArgs args)
34{
35 tifSelector.SelectedTif = args.NewTif;
36 qudSelector.Value = args.NewQuantity;
37}
38
39public override void Cleanup()
40{
41 base.Cleanup();
42}
1<atmstrategy:atmstrategyselector grid.column="2" grid.row="12" linkedquantity="{Binding ElementName=qudSelector, Path=Value, Mode=OneWay}" x:name="atmStrategySelector">
2 <atmstrategy:atmstrategyselector.margin>
3 <thickness bottom="0" left="{StaticResource MarginButtonLeft}" right="{StaticResource MarginBase}" top="{StaticResource MarginControl}"></thickness>
4 </atmstrategy:atmstrategyselector.margin>
5</atmstrategy:atmstrategyselector>