Search code examples
silverlightgridtooltip

Silverlight tooltip words are reversed


For some reason the tooltip in silverlight is reversing the text displayed.

Here is the code

            // Create the colored rectangle
            Rectangle rect = new Rectangle();

            // Set the grid row and column
            Grid.SetRow(rect, i);
            Grid.SetColumn(rect, 0);

            // Set the rectangle into the UI
            LegendColorGrid.Children.Add(rect);

            // Create the tooltip for the item
            ToolTip tip = new ToolTip();
            tip.Content = contentList[i].UnitLabel;
            tip.Placement = System.Windows.Controls.Primitives.PlacementMode.Right;
            tip.PlacementTarget = rect;

            // Set the tooltip into the UI
            ToolTipService.SetToolTip(rect, tip);

For example the tooltip is supposed to read '< -85 °C' but the tooltip shown says 'C° 85- >'


Solution

  • So it appears to be because of a want to make a stack panel flow from right to left instead of the default value of left to right.

    I set the flowDirection on the stack panel and it was causing the flow direction of the containing tool tips to basically wack out and do some crazy ass stuff like reversing every single letter and reversing some words but not others. No freaking idea why this is happening but if i set the flow direction to LeftToRight on the grid that is directly inside each wrap panel block the contained contents starts behaving by normal rules again.