WPF: How to place a Popup on a BlockUIContainer? - wpf

The Popup class has a PlacementTarget which can be used to position the Popup relatively to a UIElement.
Popup p = new Popup();
p.PlacementTarget = someUIElement;
This is ok but in my case I have a BlockUIContainer (as part of a FlowDocument) and I want a Popup to be opened when the mouse cursor enters the BlockUIContainer. The problem is that the BlockUIContainer is NOT an UIElement.
Does anyone know a solution?
Or can anyone suggest how the screen position of a BlockUIContainer (or any other Block) can be determined? (Then one could use absolute positioning to place the Popup.)
Thanks in advance.

Related

WPF, MVVM - Set dialog window position relative to main window?

I'm creating my own DialogBox.
How can I make this DialogBox always appear to the top right corner of my MainWindow?
I mean the dialog box should move with the MainWindow like a conjoined twins.
Thx in advance.
You can use code from this answer to help you achieve your goal: How to set the location of a WPF window?
When you create a MyDialogBox, get the location of the current / main window and use that to help calculate where you should set the location of your MyDialogBox

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)>);

Get view position in window

Is it possible to get the absolute position of a View in a Titanium Window? I'm trying to overlay a rectangle on an ImageView, and I need to do a bounds check to see if the rectangle is exiting the bounds of the view.(I've registered a touchmove event handler to the window, as it doesn't seem to fire the event on the ImageView itself).
Thanks in advance.
Nevermind, I solved my own problem by overlaying a normal view and checking the touchmove event on that instead. That gave me coordinates relative to the overlayed view(and the ImageView) which was what I needed.

childWindow Full Screen Event tweak the Parent to also FullSCreen Mode

I have a ChildWindow which contains a ExpressionMediaPlayer inside it. When I click on the ChildWindow Media Player Full screen button it swiches the whole application to FullScreen Mode.
Is there a way to avoid it. I am not quite sure if this scenario is going to fall under SL security restrictions.
When I drag the ChildWindow(the position of ChildWindow changes) and click on the fullscreen
now the ChildWindow also changes it's position.
For example if I have dragged the ChildWindow 50px from Top and pressed the Full Screen button of of mediaPlayer (it contains) the Child Window also appears 50 pixels below the Screen Top.
But I want My ChildWindow to be FullScreen without having any Gap from LEFT,TOP,RIGHT or below.
Any help will be greatly appreciated.
Thanks,
Subhen
Silverlight only uses one of its two windows. The first is the normal window embedded in the Host application such as IE (or in windowless mode it co-operates with the host to draw directly on one of the host's windows in a give rectangle). The other window is a Fullscreen one.
When in full screen mode it moves all its rendering of its stack of content to the full screen window. You can't get Silverlight to render only some controls on the Fullscreen window, its an all or nothing proposition.
Creating a "fullscreenable" ChildWindow would be an interesting exercise. Probably a new templated control based on Childwindow with a new "Fullscreen" visual state (in a new state group) that hides the chrome and causes the content grid to stretch with Auto Width and Height.

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