How to hide the border around child window - wpf

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.

Related

Resizing elementhost is causing flickering

I use an ElementHost control to integrate Wpf into a winforms application. I have created a "kind" of step by step set of screens similar to a wizard with next and back buttons among others.
Windows Form ---- ElementHost ---- Wpf
When I go through the different screens, i am not closing and opening a new window again, instead I simply keep the same window already opened and I change only its content. The problem of this is that the elementHost is not resizing to fit its content height, neither if the content height is decreased or increased (caused by for example an expander collapse or expand or some other control). Instead the elementhost keeps always the height that was taken the first time it was open.
The elementhost has set its properties correctly, AutoSize = true and Dock to Fill. And the Windows Form where the elementhost is, also has AutoSize set to true correctly.
So in order elementhost resizes, what I do is to "force" the elementhost to resize by doing the following on each transition between screens:
System.Drawing.Size eh = myElementHost.Size;
ElementHost.SuspendLayout();
ElementHost.AutoSize = false;
ElementHost.Size = new System.Drawing.Size(eh.Width, eh.Height);
ElementHost.AutoSize = true;
ElementHost.ResumeLayout(true);
This trick causes elementhost to resize to fit its content height but.... it is causing flickering.... also for example, each time I click on the toggle button of an expander to collapse or expand it or do something in the content that cause it to modify the content height, I need to call above piece of code to force elementhost to resize correctly to fit its content height but again, it is causing flickering, so how can avoid flickering in this particular use case?

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

WPF control is on top of the window border, how do I stop that?

I have a WPF window and an Image in a grid in the window. I am animating the Image so it moves from out of view (beyond widow location) into the window.
The animation is nice and smooth and everything works but I notice the image is over top of the window border while it is moving. The image at the end of this question is what it looks like.
Why would the image be over top of the window border, and how do I get it to be "under" the border?
Thanks in advance!
Well after a lot of trial and error it seems the problem was the fact I was moving the image in a grid that had no defined width, so the width would expand over the border when moving the image thus extending the "client" area of the window and showing over the window area.
Once I defined a specific width of the grid, everything worked.

How to specify z-index for a panel

Hi I'm new to WPF and I want to place a Panel upon a StackPanel and show and hide it in my window without using Canvas and changing positions and size of other controls or the window.
Something like the fallowing image which the solution explorer is opened on another Panel, and as we see the user even can change the position of the Panel.
If you have a Grid as the Root Layout and a StackPanel on that, you can still use Canvas.
Canvas.SetZIndex(<YourPanelYouWantInFront>, <LargeValue (100)>);

Resources