Table
PortfolioGrid is a component that displays the status of portfolios and positions.
Main properties
- PortfolioGrid.Positions – the list of positions and portfolios.
- PortfolioGrid.SelectedPosition – the selected position.
- PortfolioGrid.SelectedPositions - selected positions.
Below is the code snippet with its use. The code example is taken from Samples/InteractiveBrokers/SampleIB.
<Window x:Class="Sample.PortfoliosWindow"
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.Portfolios}" Height="200" Width="470">
<xaml:PortfolioGrid x:Name="PortfolioGrid" x:FieldModifier="public" />
</Window>
private readonly Connector _connector = new Connector();
private void ConnectClick(object sender, RoutedEventArgs e)
{
.........................................................
_connector.PositionReceived += (sub, p) => _portfoliosWindow.PortfolioGrid.Positions.TryAdd(position);
.........................................................
}