In my Silverlight project, I have a couple canvases that all use ScaleTransforms to resize as the browser window size changes. However, if I make my browser window very small, then click the maximize button in the browser, the app stays the same size. How can I make it resize properly when the maximize button is clicked?
The canvas resizes up and down properly when I am resizing the window using the edge.
Have you tried wrapping your canvas with a Viewbox?
It turns out that the delegate for a resize event was being called after the resize happens (which makes sense); but that I had some conditionals that would prohibit it from resizing if it was already 800x600. If you resized the window quickly, it would not resize properly since it thought it was 800x600; but had in fact shrunk.
tl;dr - I did not code my resize event handler correctly.
Related
In WPF window, I have specified SizeToContent="WidthAndHeight".
I have a number of panels stacked up, of which I change the visibility (to Visible or Collapsed) as required. My window resizes itself according to the panel that I have set visible. No issues here.
My problem is with the resizing, that the window resizes with a jerk to the final size.
I want to animate this such that the resizing is smooth. And i want to do this in my XAML file.
Is there any solution for this???
P.S. - I have not set any Width or Height property in the window and I want to restrict myself from doing that.
I need to get the actual height of the displayed content inside an opened pop up control:
Problem:
I want to show a lot of data in a grid inside a pop up. If this content became higher than the browser height, this content is cropped at the end of the window.
I there any way to get the height of this content (i know that pop up isn't in the visual tree)?
Try calling UpdateLayout() once all controls have been added to your popup.
You will then be able to get the ActualHeight of the popup.
This has a bit of a performance overhead so trying calling it as little as possible.
I would like to know if there is a way to resize a button Width using the mouse, like when you are in the design mode, I'd like to change the cursor to the resize cursor when the mouse pass over the edge of the button, and with a sutained click resize the button.
thanks !!
You should look into using Adorners for this. Here is an article on Code Project that describes how to "drag, resize and rotate elements on a Canvas", with and without Adorners: WPF Diagram Designer: Part 1
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.
I currently have a Silverlight canvas that exceeds the viewable area of the screen (I'm letting the users drag the viewable areas around to navigate). I'm trying to display a modal popup that always shows up in the middle of the viewable area, and I can't seem to find any property that tells me what currently is on the screen. Basically if the user has panned down to the bottom and clicks something that causes a modal popup to appear it is stuck at the far top of the screen.
Any ideas anyone?
Thanks
~Steve
I don't think this is possible since the visibility isn't being surfaced. Perhaps with some fun JavaScript to figure out where the panning is?
Quite true. I wound up creating a holding canvas, making that full screen, and putting everything else as a child canvas within that. The modal popup now comes up in the holding canvas.
Gabriel GuimarĂ£es one works good.
App.Current.Host.Content.ActualHeight(and ActualWidth) does bring the browser size inside. Good for calculating position. And of course you can use LayoutUpdated on your main control to double check the sizes and resize stuff if need be.