Table of Contents

Picker

The SecurityPicker component is designed to find and select instruments. It supports both single and multiple choice. The component allows you to filter the list of instruments by their type. This component can also be used to display financial information (level1 fields), as shown in the SecurityGrid section.

GUI SecurityPicker2

SecurityPicker consists of:

  1. A text field, to enter the code (or Id) of the instrument. When you enter, the list is filtered by the entered substring.
  2. The special SecurityTypeComboBox combo box for filtering instruments by their type.
  3. The SecurityGrid table to display the list of instruments.

Main properties

Below is the code snippet with its use, taken from example Samples/InteractiveBrokers/SampleIB.

<Window x:Class="Sample.SecuritiesWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:loc="clr-namespace:StockSharp.Localization;assembly=StockSharp.Localization"
    xmlns:xaml="http://schemas.stocksharp.com/xaml"
    Title="{x:Static loc:LocalizedStrings.Securities}" Height="415" Width="1081">
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="*" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		<xaml:SecurityPicker x:Name="SecurityPicker" x:FieldModifier="public" SecuritySelected="SecurityPicker_OnSecuritySelected" ShowCommonStatColumns="True" />
	</Grid>
</Window>
	  	
private void ConnectClick(object sender, RoutedEventArgs e)
{
    ......................................
	_connector.NewSecurity += security => _securitiesWindow.SecurityPicker.Securities.Add(security);
	_securitiesWindow.SecurityPicker.MarketDataProvider = _connector;
	......................................
}
private void SecurityPicker_OnSecuritySelected(Security security)
{
	NewStopOrder.IsEnabled = NewOrder.IsEnabled =
	Level1.IsEnabled = Depth.IsEnabled = security != null;
}