Fix menus. Fix Parameter sorting. Fix erroneous bindings. Fix issue with display of model name not showing an underscore in the name.

Label control was interpreting it as an accelerator.  Other code cleanup.
This commit is contained in:
2025-02-22 22:24:55 -05:00
parent d60b32e51d
commit acaea61f2c
16 changed files with 170 additions and 104 deletions

View File

@@ -1140,7 +1140,9 @@ namespace TradeBlotter.ViewModels
cmParams = sessionParams.CMParams;
NVPCollection nvpCollection = sessionParams.CMParams.ToNVPCollection();
nvpDictionary = nvpCollection.ToDictionary();
nvpDictionaryKeys = new ObservableCollection<String>(nvpDictionary.Keys);
List<String> dictionaryKeys = new List<String>(nvpDictionary.Keys);
dictionaryKeys.Sort();
nvpDictionaryKeys = new ObservableCollection<String>(dictionaryKeys);
selectedParameter = nvpDictionaryKeys[0];
positions = new CMPositionModelCollection();
positions.Add(sessionParams.ActivePositions);

View File

@@ -1255,7 +1255,9 @@ namespace TradeBlotter.ViewModels
configuration=sessionParams.CMTParams;
NVPCollection nvpCollection=sessionParams.CMTParams.ToNVPCollection();
nvpDictionary=nvpCollection.ToDictionary();
nvpDictionaryKeys=new ObservableCollection<String>(nvpDictionary.Keys);
List<String> dictionaryKeys=new List<String>(nvpDictionary.Keys);
dictionaryKeys.Sort();
nvpDictionaryKeys=new ObservableCollection<String>(dictionaryKeys);
selectedParameter=nvpDictionaryKeys[0];
positions=new CMTPositionModelCollection();
positions.Add(sessionParams.ActivePositions);

View File

@@ -60,7 +60,7 @@ namespace TradeBlotter.ViewModels
// session section
private ModelStatistics modelStatistics=null;
private NVPDictionary nvpDictionary=null;
private ObservableCollection<String> nvpDictionaryKeys=null;
private ObservableCollection<String> nvpDictionaryKeys = default;
private MGSHConfiguration configuration=null;
private MGSHSessionParams sessionParams;
private String selectedParameter=null;
@@ -132,6 +132,7 @@ namespace TradeBlotter.ViewModels
StopMonitor();
base.OnDispose();
}
// ******************************************************************************************** P E R S I S T E N C E ********************************************************************************************
public override bool CanPersist()
{
@@ -233,7 +234,7 @@ namespace TradeBlotter.ViewModels
return collection;
}
}
private void OnMomentumViewModelPropertyChanged(object sender, PropertyChangedEventArgs eventArgs)
{
}
@@ -1371,7 +1372,7 @@ namespace TradeBlotter.ViewModels
sessionParams=MGSHSessionManager.RestoreSession(pathFileName);
if(null==sessionParams)
{
MessageBox.Show(String.Format("Unable to open {0}",pathFileName));
MessageBox.Show(String.Format("Unable to open {0}",pathFileName),"Error",MessageBoxButton.OK,MessageBoxImage.Exclamation ,MessageBoxResult.OK,MessageBoxOptions.DefaultDesktopOnly);
pathFileName=null;
return false;
}
@@ -1380,12 +1381,14 @@ namespace TradeBlotter.ViewModels
configuration=sessionParams.Configuration;
NVPCollection nvpCollection=sessionParams.Configuration.ToNVPCollection();
nvpDictionary=nvpCollection.ToDictionary();
nvpDictionaryKeys=new ObservableCollection<String>(nvpDictionary.Keys);
List<String> dictionaryKeys=new List<String>(nvpDictionary.Keys);
dictionaryKeys.Sort();
nvpDictionaryKeys=new ObservableCollection<String>(dictionaryKeys);
selectedParameter=nvpDictionaryKeys[0];
positions=new MGSHPositionModelCollection();
positions.Add(sessionParams.ActivePositions); // active positions will go into their assigned slot
positions.Add(sessionParams.HedgePositions, sessionParams.ActivePositions.GetMaxSlotNumber()+1); // -1 is a special slot so active hedge positions will always appear in the slot position 1 past the max
positions.Add(sessionParams.AllPositions);
//// positions.Add(sessionParams.HedgePositions, -1); // hedge positions will go into slot -1
UpdatePositionPrices(false);
UpdatePositionRSI3(true);
RunPerformance();
@@ -1393,7 +1396,7 @@ namespace TradeBlotter.ViewModels
}
catch(Exception exception)
{
MessageBox.Show(String.Format("Unable to open {0}",pathFileName));
MessageBox.Show(String.Format("Unable to open {0}",pathFileName),"Error",MessageBoxButton.OK,MessageBoxImage.Exclamation ,MessageBoxResult.OK,MessageBoxOptions.DefaultDesktopOnly);
pathFileName=null;
return false;
}

View File

@@ -57,6 +57,7 @@ namespace TradeBlotter.ViewModels
};
Dispatcher.CurrentDispatcher.BeginInvoke((Action)(() => { HeadlinesThreadProc(); }), DispatcherPriority.Normal);
}
private void DisplaySplashScreen()
{
if(System.Diagnostics.Debugger.IsAttached)return;
@@ -90,8 +91,6 @@ namespace TradeBlotter.ViewModels
{
workspaceViewModel.Dispose();
}
// PriceCache.GetInstance().Dispose();
// try{MGPriceCache.GetInstance().Dispose();}catch(Exception){;}
try{LocalPriceCache.GetInstance().Dispose();}catch(Exception){;}
try{GBPriceCache.GetInstance().Dispose();}catch(Exception){;}
try{PriceCache.GetInstance().Dispose();}catch(Exception){;}
@@ -123,7 +122,20 @@ namespace TradeBlotter.ViewModels
{
try
{
System.Windows.Controls.MenuItem menuItem=new System.Windows.Controls.MenuItem() { Header = viewModel.Title,Command = new RelayCommand(param=>{this.SetActiveWorkspace(viewModel);return;})};
System.Windows.Controls.MenuItem menuItem=new System.Windows.Controls.MenuItem()
{
Name = "MainWindowViewModelMenu",
Header = viewModel.Title,Command = new RelayCommand(param=>
{
this.SetActiveWorkspace(viewModel);
return;
}
),
HorizontalAlignment=HorizontalAlignment.Left,
VerticalAlignment=VerticalAlignment.Center,
VerticalContentAlignment=VerticalAlignment.Center,
HorizontalContentAlignment=HorizontalAlignment.Left
};
menuItem.FontWeight=FontWeights.DemiBold;
menuItem.FontStyle=FontStyles.Italic;
@@ -141,8 +153,12 @@ namespace TradeBlotter.ViewModels
multiBinding.Bindings.Add(headerBinding);
multiBinding.Converter=new NameMultiValueConverter();
BindingOperations.SetBinding(menuItem,System.Windows.Controls.MenuItem.HeaderProperty,multiBinding);
menuCollection.Add(menuItem);
if(!menuCollectionDictionary.ContainsKey(viewModel))menuCollectionDictionary.Add(viewModel,menuItem);
if(!menuCollectionDictionary.ContainsKey(viewModel))
{
menuCollectionDictionary.Add(viewModel,menuItem);
}
UIServices.SortMenuItems(menuCollection);
}
catch(Exception exception)
@@ -152,7 +168,6 @@ namespace TradeBlotter.ViewModels
finally
{
}
// base.OnPropertyChanged("MenuItems");
}
public void RemoveMenuItem(WorkspaceViewModel viewModel)
{
@@ -165,7 +180,6 @@ namespace TradeBlotter.ViewModels
// ****************************************************************************************************************************************************************
public void InstantiateWorkspace(SaveParameters saveParameters)
{
// WorkspacePersistenceHelper.Load(saveParameters, workspaces,InstantiateWorkspace);
WorkspaceViewModel workspaceViewModel=WorkspacePersistenceHelper.Load(saveParameters, workspaces, InstantiateWorkspace);
AddMenuItem(workspaceViewModel);
}
@@ -243,12 +257,20 @@ namespace TradeBlotter.ViewModels
private void OnWorkspacesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.NewItems != null && e.NewItems.Count != 0)
{
foreach (WorkspaceViewModel workspace in e.NewItems)
{
workspace.RequestClose += this.OnWorkspaceRequestClose;
}
}
if (e.OldItems != null && e.OldItems.Count != 0)
{
foreach (WorkspaceViewModel workspace in e.OldItems)
{
workspace.RequestClose -= this.OnWorkspaceRequestClose;
}
}
}
private void OnWorkspaceRequestClose(object sender, EventArgs e)
{
@@ -259,7 +281,8 @@ namespace TradeBlotter.ViewModels
RemoveMenuItem(workspace);
if(null!=workspace.Referer)this.SetActiveWorkspace(workspace.Referer);
}
// *********************************************************************************************************************************************************
// *********************************************************************************************************************************************************
private void ShowAllTrades()
{
BlotterViewModel workspace = this.Workspaces.FirstOrDefault(vm => vm is BlotterViewModel) as BlotterViewModel;
@@ -288,7 +311,6 @@ namespace TradeBlotter.ViewModels
BlotterTradeModel trade = TradeRepository.GetInstance().GetTrade(tradeId);
if(null==trade)return;
trade=trade.Clone();
// workspace = new TradeEntryViewModel(trade, TradeRepository.GetInstance(),false);
workspace=new TradeEntryViewModel(trade,TradeRepository.GetInstance());
this.Workspaces.Add(workspace);
}

View File

@@ -1132,7 +1132,9 @@ namespace TradeBlotter.ViewModels
configuration=sessionParams.Configuration;
NVPCollection nvpCollection=sessionParams.Configuration.ToNVPCollection();
nvpDictionary=nvpCollection.ToDictionary();
nvpDictionaryKeys=new ObservableCollection<String>(nvpDictionary.Keys);
List<String> dictionaryKeys=new List<String>(nvpDictionary.Keys);
dictionaryKeys.Sort();
nvpDictionaryKeys=new ObservableCollection<String>(dictionaryKeys);
selectedParameter=nvpDictionaryKeys[0];
positions=new MGPositionModelCollection();
positions.Add(sessionParams.ActivePositions);

View File

@@ -46,15 +46,23 @@ namespace TradeBlotter.ViewModels
protected ViewModelBase()
{
}
public abstract SaveParameters GetSaveParameters();
public abstract void SetSaveParameters(SaveParameters saveParameters);
public abstract bool CanPersist();
public virtual void Dispose()
{
this.OnDispose();
}
public virtual String DisplayName { get; protected set; }
public virtual String DisplayName
{
get;
protected set;
}
protected virtual void OnDispose()
{

View File

@@ -4,23 +4,30 @@ using System.Windows.Input;
using System.Linq;
using System.Text;
using TradeBlotter.Command;
using Telerik.Windows.Input.Touch;
namespace TradeBlotter.ViewModels
{
public delegate void InstantiateWorkspace(SaveParameters saveParameters);
public abstract class WorkspaceViewModel : ViewModelBase
{
// Relay Command
private RelayCommand closeCommand;
// Events
public event EventHandler RequestClose;
private InstantiateWorkspace workspaceInstantiator;
private bool canClose=true;
private bool isClosed=false;
private String title="WorkspaceViewModel";
public WorkspaceViewModel Referer{get;set;}
protected WorkspaceViewModel()
{
}
public InstantiateWorkspace WorkspaceInstantiator
{
get
@@ -32,14 +39,19 @@ namespace TradeBlotter.ViewModels
workspaceInstantiator = value;
}
}
public ICommand CloseCommand
{
get
{
if (null == closeCommand) closeCommand = new RelayCommand(param => this.OnRequestClose());
if (null == closeCommand)
{
closeCommand = new RelayCommand(param => this.OnRequestClose());
}
return closeCommand;
}
}
public bool IsClosed
{
get { return isClosed; }
@@ -52,6 +64,7 @@ namespace TradeBlotter.ViewModels
}
}
}
public bool CanClose
{
get { return canClose; }
@@ -64,6 +77,7 @@ namespace TradeBlotter.ViewModels
}
}
}
public virtual String Title
{
get
@@ -76,6 +90,15 @@ namespace TradeBlotter.ViewModels
base.OnPropertyChanged("Title");
}
}
public virtual String Header
{
get
{
return title;
}
}
private void OnRequestClose()
{
EventHandler handler = this.RequestClose;

View File

@@ -30,7 +30,8 @@
<StackPanel Orientation="Vertical" Grid.Row="2" Grid.Column="0">
<Label Content="Watch List" HorizontalAlignment="Left" ></Label>
<ComboBox ItemsSource="{Binding Path=WatchListNames, Mode=OneTime}" SelectedItem="{Binding Path=SelectedWatchList, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" ></ComboBox>
<Label Content="Symbol" HorizontalAlignment="Left" Target="{Binding ElementName=symbolLbl}" ></Label>
<!--<Label Content="Symbol" HorizontalAlignment="Left" Target="{Binding ElementName=symbolLbl}" ></Label>-->
<Label Content="Symbol" HorizontalAlignment="Left" ></Label>
<ComboBox ItemsSource="{Binding Path=Symbols, Mode=OneWay}" SelectedItem="{Binding Path=SelectedSymbol, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
@@ -38,7 +39,8 @@
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
<Label Content="Date" HorizontalAlignment="Left" Target="{Binding ElementName=ratingDateLbl}" ></Label>
<!--<Label Content="Date" HorizontalAlignment="Left" Target="{Binding ElementName=ratingDateLbl}" ></Label>-->
<Label Content="Date" HorizontalAlignment="Left" ></Label>
<ComboBox ItemsSource="{Binding Path=Dates, Mode=OneWay}" SelectedItem="{Binding Path=SelectedDate, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>

View File

@@ -34,7 +34,9 @@
<RowDefinition Height="3" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="5" FontFamily="Arial" Content="{Binding Path=Title}" HorizontalAlignment="Center" FontSize="20"></Label>
<!--<Label Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="5" FontFamily="Arial" Content="{Binding Path=Title}" HorizontalAlignment="Center" FontSize="20"></Label>-->
<TextBox Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="5" FontFamily="Arial" BorderThickness="0" IsReadOnly="true" Background="Transparent" Text="{Binding Path=Title, Mode=OneWay}" HorizontalAlignment="Center" FontSize="20"></TextBox>
<StackPanel Orientation="Vertical" Grid.Row="2" Grid.RowSpan="5" Grid.Column="0">
<Label Content="Date" HorizontalAlignment="Left" ></Label>
<telerik:RadDatePicker SelectableDateStart="{Binding Path=SelectableDateStart}" SelectableDateEnd="{Binding Path=SelectableDateEnd}" VerticalAlignment="Top" HorizontalAlignment="Left" SelectedDate="{Binding Path=SelectedDate,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
@@ -232,7 +234,7 @@
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsReadOnly="True" Header="Mkt.Value">
<telerik:GridViewDataColumn IsReadOnly="True" Header="Market Value">
<telerik:GridViewDataColumn.AggregateFunctions>
<local:CMMomentumPositionSumFunctionMarketValue />
</telerik:GridViewDataColumn.AggregateFunctions>

View File

@@ -36,7 +36,9 @@
<RowDefinition Height="3" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="5" FontFamily="Arial" Content="{Binding Path=Title}" HorizontalAlignment="Center" FontSize="20"></Label>
<!--<Label Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="5" FontFamily="Arial" Content="{Binding Path=Title}" HorizontalAlignment="Center" FontSize="20"></Label>-->
<TextBox Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="5" FontFamily="Arial" BorderThickness="0" IsReadOnly="true" Background="Transparent" Text="{Binding Path=Title, Mode=OneWay}" HorizontalAlignment="Center" FontSize="20"></TextBox>
<StackPanel Orientation="Vertical" Grid.Row="2" Grid.RowSpan="5" Grid.Column="0">
<Label Content="Date" HorizontalAlignment="Left" ></Label>
<telerik:RadDatePicker SelectableDateStart="{Binding Path=SelectableDateStart}" SelectableDateEnd="{Binding Path=SelectableDateEnd}" VerticalAlignment="Top" HorizontalAlignment="Left" SelectedDate="{Binding Path=SelectedDate,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
@@ -132,7 +134,6 @@
<d3:VerticalAxis Name="countAxis"/>
</d3:ChartPlotter.MainVerticalAxis>
<d3:LineGraph d3:NewLegend.Description="Gain/Loss" d3:Viewport2D.UsesApproximateContentBoundsComparison="False" x:Name="Data" DataSource="{Binding Path=Data}" Stroke="MidnightBlue" StrokeThickness="2"/>
<!--<d3:LineGraph x:Name="LeastSquares" d3:NewLegend.Description="{Binding Path=LeastSquaresTitle}" DataSource="{Binding LeastSquares}" Stroke="Orange" StrokeThickness="2"/>-->
<d3:CursorCoordinateGraph Name="cursorGraph" dc:CoordinateGraphBehavior.XTextMappingProperty="MM/dd/yyyy" LineStrokeThickness="1"/>
<d3:Header FontFamily="Arial" Content="{Binding Path=GraphTitle}"/>
<d3:VerticalAxisTitle FontFamily="Arial" Content="Gain/Loss"/>
@@ -327,7 +328,7 @@
</telerik:GridViewColumn.ToolTipTemplate>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=RMultipleAsString,StringFormat='{}{0:S}'}" Foreground="{Binding Path=RMultipleAsStringColor}"/>
<TextBlock Text="{Binding Path=RMultipleAsString,StringFormat='{}{0:S}'}" Foreground="{Binding Path=RMultipleColor}"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
@@ -362,7 +363,7 @@
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsReadOnly="True" Header="Mkt.Value">
<telerik:GridViewDataColumn IsReadOnly="True" Header="Market Value">
<telerik:GridViewDataColumn.AggregateFunctions>
<local:CMTTrendPositionSumFunctionMarketValue />
</telerik:GridViewDataColumn.AggregateFunctions>

View File

@@ -50,16 +50,18 @@
<StackPanel Orientation="Vertical" Grid.Row="2" Grid.Column="0">
<Label Content="Watch List" HorizontalAlignment="Left" ></Label>
<ComboBox ItemsSource="{Binding Path=WatchListNames, Mode=OneTime}" SelectedItem="{Binding Path=SelectedWatchList, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" ></ComboBox>
<Label Content="Symbol" HorizontalAlignment="Left" Target="{Binding ElementName=symbolLbl}" ></Label>
<ComboBox ItemsSource="{Binding Path=Symbols, Mode=OneWay}" SelectedItem="{Binding Path=SelectedSymbol, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
<!--<Label Content="Symbol" HorizontalAlignment="Left" Target="{Binding ElementName=symbolLbl}" ></Label>-->
<Label Content="Symbol" HorizontalAlignment="Left" ></Label>
<ComboBox ItemsSource="{Binding Path=Symbols, Mode=OneWay}" SelectedItem="{Binding Path=SelectedSymbol, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel/>
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
<Label Content="Date" HorizontalAlignment="Left" Target="{Binding ElementName=ratingDateLbl}" ></Label>
<ComboBox ItemsSource="{Binding Path=Dates, Mode=OneWay}" SelectedItem="{Binding Path=SelectedDate, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
<!--<Label Content="Date" HorizontalAlignment="Left" Target="{Binding ElementName=ratingDateLbl}" ></Label>-->
<Label Content="Date" HorizontalAlignment="Left" ></Label>
<ComboBox ItemsSource="{Binding Path=Dates, Mode=OneWay}" SelectedItem="{Binding Path=SelectedDate, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />

View File

@@ -36,10 +36,8 @@
<RowDefinition Height="3" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="5" FontFamily="Arial" Content="{Binding Path=Title}" HorizontalAlignment="Center" FontSize="20"></Label>
<TextBox Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="5" FontFamily="Arial" BorderThickness="0" IsReadOnly="true" Background="Transparent" Text="{Binding Path=Title, Mode=OneWay}" HorizontalAlignment="Center" FontSize="20"></TextBox>
<StackPanel Orientation="Vertical" Grid.Row="2" Grid.RowSpan="3" Grid.Column="0" Margin="0,4.962,0.396,-5">
<Label Content="Last Trade Date" HorizontalAlignment="Left" ></Label>
<TextBox Height="24" MinWidth="80" HorizontalAlignment="Stretch" IsReadOnly="true" Text="{Binding Path=LastTradeDate, Mode=OneWay}" />
@@ -116,11 +114,17 @@
</DataTemplate>
</telerik:GridViewColumn.ToolTipTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsReadOnly="True" Header="AnalysisDate" DataMemberBinding="{Binding Path=AnalysisDate,StringFormat='{}{0:MM/dd/yyyy}'}" />
<telerik:GridViewDataColumn IsReadOnly="True" Header="CumReturn252" DataMemberBinding="{Binding Path=CumReturn252,StringFormat='{}{0:P2}'}" />
<telerik:GridViewDataColumn IsReadOnly="True" Header="DayCount" DataMemberBinding="{Binding Path=DayCount,StringFormat='{}{0:N0}'}" />
<telerik:GridViewDataColumn IsReadOnly="True" Header="IDIndicator" DataMemberBinding="{Binding Path=IDIndicator,StringFormat='{}{0:N2}'}" />
<telerik:GridViewDataColumn IsReadOnly="True" Header="Score" DataMemberBinding="{Binding Path=Score,Converter={StaticResource DoubleFormat},ConverterParameter=2}" />
<telerik:GridViewDataColumn IsReadOnly="True" Header="PE" DataMemberBinding="{Binding Path=PE,StringFormat='{}{0:N2}'}" />
<telerik:GridViewDataColumn IsReadOnly="True" Header="Beta" DataMemberBinding="{Binding Path=Beta,StringFormat='{}{0:N2}'}" >
@@ -158,7 +162,6 @@
<d3:VerticalAxis Name="countAxis"/>
</d3:ChartPlotter.MainVerticalAxis>
<d3:LineGraph d3:NewLegend.Description="Gain/Loss" d3:Viewport2D.UsesApproximateContentBoundsComparison="False" x:Name="Data" DataSource="{Binding Path=Data}" Stroke="MidnightBlue" StrokeThickness="2"/>
<!--<d3:LineGraph x:Name="LeastSquares" d3:NewLegend.Description="{Binding Path=LeastSquaresTitle}" DataSource="{Binding LeastSquares}" Stroke="Orange" StrokeThickness="2"/>-->
<d3:CursorCoordinateGraph Name="cursorGraph" dc:CoordinateGraphBehavior.XTextMappingProperty="MM/dd/yyyy" LineStrokeThickness="1"/>
<d3:Header FontFamily="Arial" Content="{Binding Path=GraphTitle}"/>
<d3:VerticalAxisTitle FontFamily="Arial" Content="Gain/Loss"/>
@@ -171,7 +174,6 @@
<DockPanel x:Name="DockPanel2" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="3" Width="Auto" Height="Auto">
<Grid>
<Grid x:Name="PositionsView" Visibility="Visible">
<!--<Border Background="Blue"/>-->
<telerik:RadGridView SelectedItem="{Binding Path=SelectedPosition, Mode=TwoWay}" ItemContainerStyle="{StaticResource MomentumItemStyle}" AlternationCount="2" AlternateRowBackground="Bisque" ShowGroupFooters="True" ShowColumnFooters="True" ItemsSource="{Binding Path=AllPositions, ValidatesOnDataErrors=True}" AutoGenerateColumns="False" >
<telerik:RadContextMenu.ContextMenu>
<telerik:RadContextMenu x:Name="PositionGridContextMenu" StaysOpen="False" ItemsSource="{Binding PositionsMenuItems}">
@@ -248,7 +250,7 @@
<Setter Property="Text" Value="{Binding Path=RSI3,StringFormat='{}{0:N2}'}"/>
<Setter Property="Foreground" Value="{Binding Path=RSI3Color}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=RSI3}" Value="NaN" >
<DataTrigger Binding="{Binding Path=RSI3}" Value="NaN" >
<Setter Property="Text" Value="---"/>
</DataTrigger>
</Style.Triggers>
@@ -259,6 +261,59 @@
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsReadOnly="True" Header="Updated" DataMemberBinding="{Binding Path=LastUpdated,StringFormat='{}{0:MM/dd/yyyy HH:mm:ss}'}" />
<telerik:GridViewDataColumn IsReadOnly="True" Header="Exposure">
<telerik:GridViewColumn.ToolTipTemplate>
<DataTemplate >
<StackPanel Orientation="Horizontal" >
<TextBlock Background="LemonChiffon" MaxWidth="1000" TextWrapping="Wrap" Text="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type vw:MGSHMomentumView}},Path=DataContext.ToolTipExposure}"/>
</StackPanel>
</DataTemplate>
</telerik:GridViewColumn.ToolTipTemplate>
<telerik:GridViewDataColumn.AggregateFunctions>
<local:MGSHMomentumPositionSumFunctionExposure />
</telerik:GridViewDataColumn.AggregateFunctions>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=ActiveExposure,StringFormat='{}{0:C}'}" Foreground="{Binding Path=ActiveExposureColor}"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsReadOnly="True" Header="Market Value">
<telerik:GridViewDataColumn.AggregateFunctions>
<local:MGSHMomentumPositionSumFunctionMarketValue />
</telerik:GridViewDataColumn.AggregateFunctions>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=ActiveMarketValue,StringFormat='{}{0:C}'}" Foreground="{Binding Path=ActiveMarketValueColor}"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsReadOnly="True" Header="GainLoss" >
<telerik:GridViewDataColumn.AggregateFunctions>
<local:MGSHMomentumPositionSumFunctionGainLoss />
</telerik:GridViewDataColumn.AggregateFunctions>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=GainLoss,StringFormat='{}{0:C}'}" Foreground="{Binding Path=GainLossColor}"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsReadOnly="True" Header="GainLoss(%)" >
<telerik:GridViewDataColumn.AggregateFunctions>
<local:MGSHMomentumPositionSumFunctionGainLossPcnt />
</telerik:GridViewDataColumn.AggregateFunctions>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=GainLossPcnt,StringFormat='{}{0:P3}'}" Foreground="{Binding Path=GainLossPcntColor}"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsReadOnly="True" Header="Initial Stop" DataMemberBinding="{Binding Path=InitialStopLimit,StringFormat='{}{0:C}'}" >
<telerik:GridViewColumn.ToolTipTemplate>
<DataTemplate >
@@ -337,57 +392,6 @@
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsReadOnly="True" Header="Exposure">
<telerik:GridViewColumn.ToolTipTemplate>
<DataTemplate >
<StackPanel Orientation="Horizontal" >
<TextBlock Background="LemonChiffon" MaxWidth="1000" TextWrapping="Wrap" Text="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type vw:MGSHMomentumView}},Path=DataContext.ToolTipExposure}"/>
</StackPanel>
</DataTemplate>
</telerik:GridViewColumn.ToolTipTemplate>
<telerik:GridViewDataColumn.AggregateFunctions>
<local:MGSHMomentumPositionSumFunctionExposure />
</telerik:GridViewDataColumn.AggregateFunctions>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=ActiveExposure,StringFormat='{}{0:C}'}" Foreground="{Binding Path=ActiveExposureColor}"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsReadOnly="True" Header="GainLoss" >
<telerik:GridViewDataColumn.AggregateFunctions>
<local:MGSHMomentumPositionSumFunctionGainLoss />
</telerik:GridViewDataColumn.AggregateFunctions>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=GainLoss,StringFormat='{}{0:C}'}" Foreground="{Binding Path=GainLossColor}"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsReadOnly="True" Header="GainLoss(%)" >
<telerik:GridViewDataColumn.AggregateFunctions>
<local:MGSHMomentumPositionSumFunctionGainLossPcnt />
</telerik:GridViewDataColumn.AggregateFunctions>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=GainLossPcnt,StringFormat='{}{0:P3}'}" Foreground="{Binding Path=GainLossPcntColor}"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsReadOnly="True" Header="Mkt.Value">
<telerik:GridViewDataColumn.AggregateFunctions>
<local:MGSHMomentumPositionSumFunctionMarketValue />
</telerik:GridViewDataColumn.AggregateFunctions>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=ActiveMarketValue,StringFormat='{}{0:C}'}" Foreground="{Binding Path=ActiveMarketValueColor}"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsReadOnly="True" Header="Last Stop Adj." DataMemberBinding="{Binding Path=LastStopAdjustment,Converter={StaticResource DateFormat}}" >
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
@@ -412,8 +416,6 @@
<telerik:GridViewDataColumn IsReadOnly="True" Header="Score" DataMemberBinding="{Binding Path=Score,Converter={StaticResource DoubleFormat},ConverterParameter=2}" />
<telerik:GridViewDataColumn IsReadOnly="True" Header="Updated" DataMemberBinding="{Binding Path=LastUpdated,StringFormat='{}{0:MM/dd/yyyy HH:mm:ss}'}" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>

View File

@@ -33,7 +33,10 @@
<RowDefinition Height="3" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="5" FontFamily="Arial" Content="{Binding Path=Title}" HorizontalAlignment="Center" FontSize="20"></Label>
<!--<Label Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="5" FontFamily="Arial" Content="{Binding Path=Title}" HorizontalAlignment="Center" FontSize="20"></Label>-->
<TextBox Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="5" FontFamily="Arial" BorderThickness="0" IsReadOnly="true" Background="Transparent" Text="{Binding Path=Title, Mode=OneWay}" HorizontalAlignment="Center" FontSize="20"></TextBox>
<StackPanel Orientation="Vertical" Grid.Row="2" Grid.RowSpan="3" Grid.Column="0" Margin="0,4.962,0.396,-5">
<Label Content="Date" HorizontalAlignment="Left" ></Label>
<telerik:RadDatePicker SelectableDateStart="{Binding Path=SelectableDateStart}" SelectableDateEnd="{Binding Path=SelectableDateEnd}" VerticalAlignment="Top" HorizontalAlignment="Left" SelectedDate="{Binding Path=SelectedDate,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
@@ -251,7 +254,7 @@
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsReadOnly="True" Header="Mkt.Value">
<telerik:GridViewDataColumn IsReadOnly="True" Header="Market Value">
<telerik:GridViewDataColumn.AggregateFunctions>
<local:MomentumPositionSumFunctionMarketValue />
</telerik:GridViewDataColumn.AggregateFunctions>

View File

@@ -26,7 +26,8 @@
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Vertical">
<Label Content="Watch List" HorizontalAlignment="Left" ></Label>
<ComboBox ItemsSource="{Binding Path=WatchListNames, Mode=OneTime}" SelectedItem="{Binding Path=SelectedWatchList, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" ></ComboBox>
<Label Content="Symbol" HorizontalAlignment="Left" Target="{Binding ElementName=symbolLbl}" ></Label>
<!--<Label Content="Symbol" HorizontalAlignment="Left" Target="{Binding ElementName=symbolLbl}" ></Label>-->
<Label Content="Symbol" HorizontalAlignment="Left"></Label>
<ComboBox x:Name="symbolCmb" ItemsSource="{Binding Path=Symbols, Mode=OneWay}" SelectedItem="{Binding Path=SelectedSymbol, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>

View File

@@ -32,7 +32,8 @@
<Label Content="Watch List" HorizontalAlignment="Left" ></Label>
<ComboBox ItemsSource="{Binding Path=WatchListNames, Mode=OneTime}" SelectedItem="{Binding Path=SelectedWatchList, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" ></ComboBox>
<Label Content="Symbol" HorizontalAlignment="Left" Target="{Binding ElementName=symbolLbl}" ></Label>
<!--<Label Content="Symbol" HorizontalAlignment="Left" Target="{Binding ElementName=symbolLbl}" ></Label>-->
<Label Content="Symbol" HorizontalAlignment="Left" ></Label>
<ComboBox ItemsSource="{Binding Path=Symbols, Mode=OneWay}" SelectedItem="{Binding Path=SelectedSymbol, ValidatesOnDataErrors=True}" SelectedIndex="{Binding Path=SelectedSymbolIndex,Mode=TwoWay, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>

View File

@@ -30,16 +30,6 @@
<StackPanel Orientation="Vertical" Grid.Row="2" Grid.Column="0">
<Label Content="Watch List" HorizontalAlignment="Left" ></Label>
<ComboBox ItemsSource="{Binding Path=WatchListNames, Mode=OneTime}" SelectedItem="{Binding Path=SelectedWatchList, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" ></ComboBox>
<!--<Label Content="Symbol" HorizontalAlignment="Left" Target="{Binding ElementName=symbolLbl}" ></Label>
<ComboBox ItemsSource="{Binding Path=Symbols, Mode=OneWay}" SelectedItem="{Binding Path=SelectedSymbol, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel/>
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>-->
<!--<Label Content="Date" HorizontalAlignment="Left" Target="{Binding ElementName=ratingDateLbl}" ></Label>-->
<!--<ComboBox ItemsSource="{Binding Path=Dates, Mode=OneWay}" SelectedItem="{Binding Path=SelectedDate, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" ></ComboBox>-->
<Button Margin="0,2" Content="Refresh" HorizontalAlignment="Left" Command="{Binding Path=RefreshCommand}"></Button>
</StackPanel>
<DockPanel Grid.Row="2" Grid.Column="2" >