Silverlight tooltip words are reversed - silverlight

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- >'

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.

Related

Programmatically add only a top border to an existing Rectangle in WPF

I am pretty sure this cannot be done, but I hope I am wrong :)
A set of rectangles exist in a wpf application that I have access to modifying via a plugin. I cannot modify any of the existing rectangles, but can get a reference to them using FindName.
Once I have the rectangle that I want to modify, I am attempting to add a border (to only the top), by using this code
Rectangle selected = Core.Overlay.FindName("Rect" + rectIndex) as Rectangle
selected.Stroke = Brushes.Red;
selected.StrokeThickness = 3;
this of course adds a border to all 4 sides.
Is there any way to only add a top border to the existing rectangle in code? I cannot add the rectangle to a border I create dynamically, so I am looking for another option.

Silverlight: Scroll issue with RichTextBox Selection property

I have a Grid in silverlight having a lot of different controls.
In the last row of Grid, I have a RichTextBox.
To write something in RichTextBox, first we have to scroll down to that because controls are too much.
Each time we open that Grid, all the controls are initiated with some initial data.
Now there is a problem with this line
this.rtb.Selection.Text = "Initial Text";
What this line do is, it set text into RichTextBox control and also set focus on it, as a result my scroll bar move to the bottom, which is very annoying.
I want this text assigned to it but scroller should stay at top.
Try this:
// create a paragraph
Paragraph prgParagraph = new Paragraph();
// create some text, and add it to the paragraph
Run rnMyText = new Run();
rnMyText.Text = "This is some example text with a ";
prgParagraph.Inlines.Add(rnMyText);
// add the paragraph to the RTB
rbtMyRichTextBox.Blocks.Add(prgParagraph);

Can't get flow layout panel to disappear when empty

I have a custom Windows Forms (a class which extends System.Windows.Forms). Its layout is as follows:
FLP: Flow Layout Panel. Flow directions is specified in the name.
PB: Picture Box
RTB: RichTextBox
b: Button
Onto the problem: it is possible for the FLP at the bottom to be empty (no buttons). When that happens, I'd like it to shrink to zero height, and let the FLP above, and the RTB, grow and fill that space. This is because all that empty space looks ugly when there are no buttons.
I configured the lower flp with AutoSize = True and AutoSize = GrowAndShrink. Then, for the upper flp, I set AutoSize = True, AutoSizeMode = GrowOnly and Dock = Fill. But when I create a form with no buttons, the space is still there. If I draw the control borders, where the lower flp should be, I see a little square dot.
Where am I going wrong?
UPDATE: I'm willing to redo the layout in a more convenient way, or even redo the whole form using WPF.
I doesn't look like you need the Top-Down FlowLayoutPanel.
Try taking your Right-Left FlowLayoutPanel and Dock it to the bottom. Then take your Left-Right FlowLayoutPanel and Dock Fill it in the remaining area.
Where your button panel has no visible buttons, then you can just hide the panel and the Filled panel will take up that remaining space.
If you remove FLP_top_down, change flp_left_to_right to be .Dock = DockStyle.Fill and change flp_left_to_right to be .Dock = DockStyle.Bottom, you should get what you are after.

Make WinForms control appear on top of all other controls

I have a WinForm, in which I am hiding all borders and the Control Box. Inside the WinForm I have a RECT() (not a WinForms control) the RECT fills the entire WinForm.
I am trying to add a Label to the WinForm, but I want the label to appear on top of the RECT. The Label appears on the WinForm, but never on top of the RECT. I've tried using the following:
/*App Runs - Label does not show up*/
_label.Text = "This is the label";
_label.BackColor = Color.Cornsilk;
_form.Controls.Add(_label);
_form.Controls.SetChildIndex(_label, 0);
/*App Does Not Run*/
_label.Text = "This is the label";
_label.BackColor = Color.Cornsilk;
_form.Controls.SetChildIndex(_label, 0); //trying to set the index before I add the label to the form
_form.Controls.Add(_label);
/*App Runs - Label does not show up*/
_label.Text = "This is the label";
_label.BackColor = Color.Cornsilk;
_label.BringToFront();
_form.Controls.Add(_label);
/*App Runs - Label does not show up*/
_label.Text = "This is the label";
_label.BackColor = Color.Cornsilk;
_form.Controls.Add(_label);
_label.BringToFront();
As you can see, I've tried a lot of different stuff and nothing is working. I have also tried adding the label after the RECT has been added, to no avail. I am having a similar issue with adding a Background Image (though not the question being asked here). Does anyone know of a more forceful way to make the Label appear on top of the RECT?
Also, because of the API and dll's I am using, I cannot use something other than a RECT or WinForms.
You can use BringToFront on the label itself:
_label.BringToFront();
This will bring the label to the front of the Z order on the form, so it should display on top of other form elements.
I have a RECT() (not a WinFrom control) the RECT fills the entire WinForm
A "RECT" isn't a control - it's a definition size and position. Depending on what you're using to display your background, this may not work. If it's painting into the entire form, it could be overwriting your other controls, and "masking" them, no matter what you use for z order. Without more information, it could be difficult to provide guidance, but you'd have to make sure you cause the label to redraw after the "RECT".

How to hide the border around child window

I have a child Window , and I am displaying it from the code behind as below:
ChildPhotoViewer PhotoViewer = new ChildPhotoViewer();
PhotoViewer.DataContext = selectedPhoto;
PhotoViewer.Title = selectedPhoto.strTitle.ToString();
PhotoViewer.Show();
But While Displaying the child window I am getting the Close Button and a Border thickness arround the Window.
I am able to hide the Close Button but is there a way to hide the thickness(Border) across the child window.
Edit:
![alt text][1]
In the Image , there is border arround image after Collpasing the Close button and making
PhotoViewer.Title = null;
PhotoViewer.HasCloseButton = false;
I want to get rid of that Rectangular Border.
Have you tried:-
PhotoViewer.BorderThickness = new Thickness(0);
Edit
Perhaps you are refering to the title block across the top of the window?
PhotoViewer.Title = null;
PhotoViewer.HasCloseButton = false;
Edit
Third attempt.
The template for ChildWindow place the content in border with a 7 pixel margin. This also has an outer border which has a White background. That is what you are seeing in the image. The only way to eliminate it is to copy the ChildWindow template and edit it.
Depends on what you mean by the Border.
If you have a look at the Documentation you can see there is a border (with a thickness of 1) around the edge of the entire window that can be altered like Anthony mentions.
However there is also the window Chrome which in the default template has a number of borders. To change the thickness of these borders you will need to create a style without the borders being present.

Resources