I've created a "floating" Info Box (based on the DrawingToolTile Indicator) to display information about the current state of my strategy logic. Instead of a column of buttons, it's a column of labels.
Everything about it works perfectly, EXCEPT, if I set the "Content" of the label to a string that has spaces in it, the spaces seem to be ignored, or are stripped out. For example, if I pass in "Valid Signal Detected", the label displays "ValidSignalDetected".
Here's the code that's creating the labels initially (there are two labels for each piece of data I'm displaying, one for the key (aka "title"), and one for the value).
foreach (var key in _infoBoxKeys) { Label keyLabel = new Label { Content = key, Foreground = textColor, FontFamily = fontFamily, FontSize = 12, FontWeight = FontWeights.Bold, FontStyle = FontStyles.Normal, Margin = new Thickness(3, 3, 3, 0), Padding = new Thickness(3, 3, 3, 0), BorderBrush = borderBrush, BorderThickness = rowCount == 0 ? new Thickness(0) : new Thickness(0, 1, 0, 0), }; Label valueLabel = new Label { Content = "--", Foreground = textColor, FontFamily = fontFamily, FontSize = 12, FontStyle = FontStyles.Normal, Margin = new Thickness(3), Padding = new Thickness(3), }; _infoBoxValueLabels[key] = valueLabel; contentGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }); contentGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }); Grid.SetRow(keyLabel, rowCount); Grid.SetColumn(keyLabel, 0); Grid.SetRow(valueLabel, rowCount + 1); Grid.SetColumn(valueLabel, 0); contentGrid.Children.Add(keyLabel); contentGrid.Children.Add(valueLabel); rowCount += 2; };
And when I want to change the contents of the valueLabel, I just do...
_infoBoxValueLabels[key].Content = value;
Thanks!
Comment