Implement a window as a page in wpf - wpf

I have lots of windows in my project. Now I am thinking to convert it into pages then then implement it into frame navigation.
Is there any way to convert all the windows into frames?

There's a very simple way : build a new page then set the page content = the window content. But you loose some properties (width, height) some events loader (Loaded,...), and obviously some operations are not allowed on pages.
If you want to try without taking too much risk on your project, take a few windows (W1,W2,W3), then create the pages P1,P2,P3. Now create W1', W2', W3', which are just a Window with a frame linked to P1, P2, P3 respectively. This way you can check if your app can be 'translated' to page logic and begin testing navigation while still having full functionnalities for the Windowed version of your application. Note that if your application follows MVVM, the translation 'should' be easy.

Related

How do I form-fit my form to the handheld device?

I added a new form to my Windows CE/CF/C# app, but the form is too large -- I have to drag it around to see all of it - I thought the CF automatically made forms scale to the size of the device?
Is there a property or properties I need to set, or a particular size I need to give the form so that it will take up the entire screen but no more than that?
No, the Forms are not auto-sized for WinCE (WinMo they are). You can set it's size manually, or Maximize it to get the effect you're after.

Nested NavigationFrame in Silverlight App (Multi animation)

I would like to build a navigation enabled Silverlight app with a slight difference. I don't want to load the entire screen area just a part of it and only in some scenarios.
For example #/Customer/Cases loads /Customer/Cases.xaml in the entire screen area. But #/Customer/Cases/Orders loads /Customer/Cases/Orders.xaml in an area where a data grid was displayed (slides to the right maybe).
How do I tell the parent navigation frame not to load the entire #URL but just a part of it? And vis versa for the child navigation frame?
Has anyone done anything like this before?
Please let me know if doesn't make any sense, it's quite hard to explain :)
One possibility would be to have two frames.
In the inner-frame you set:
InnerFrame.JournalOwnership = JournalOwnership.OwnsJournal;
The link #/Customer/Cases/Orders loads the page /Customer/Cases.xaml?Orders in the outer-frame. The outer-frame than knows it should navigate the inner frame to /Customer/Cases/Orders.xaml
Check out Ultimate Framework - Silverlight Navigation Framework that supports unlimited parallel and nested frames with Prism

WinForms Control position in Simplified Chinese

We have a WinForms application that includes controls such as picture boxes that are positioned on a form. The base application is in English.
We've translated this application to a number of different languages (French, Spanish, Danish, Greek, etc.) and most recently to Simplified Chinese. The translated application works perfectly on our operation systems (English).
One of our customers installed the application on their operation system, Windows XP in Simplified Chinese. The layout of our application is broken. Simply put, the elements are pushed to the bottom right by a factor that is proportional to the distance between the element and the top left corner. For example, an element at the top right corner in design view is pushed off screen to the right whereas the items at the bottom of the page are pushed downwards and to the right.
The application supports switching languages while in use. When the locale is en-US, there are no layout issues. When switching to Simplified Chinese, the issue appears, but only on the Simplified Chinese operating system. The screen resolution and DPI are the same.
Do you have any ideas? I'm sure it must be a simple configuration setting somewhere, but I have been unable to solve this issue.
The size of the system base font matters as well. Which is indeed something you can change on XP. This will invoke the form's auto-scaling logic, designed to ensure that the controls grow larger to fit the larger font size.
This is by design, controlled by the form's AutoScaleMode property. Don't change it, rescaling is important. Just make sure the form layout still looks good, use properties like Anchor and Dock, controls like TableLayoutPanel, FlowLayoutPanel. Or the Resize event for tricky ones.
Paste this into your form to test this logic without having to change system settings:
protected override void OnLoad(EventArgs e) {
this.Font = new Font(this.Font.FontFamily, this.Font.SizeInPoints * 125 / 96);
}

Gtk: get usable area of each monitor (excluding panels)

Using gdk_screen_get_monitor_geometry, I can get the total area in pixels and the relative position of each monitor, even when there are two or more used as a single screen.
However, I want to get the usable area (that is, excluding panels) of each monitor. The only thing I have found is _NET_WORKAREA, but that is one giant area stretching across all monitors. Depending on the resolution and arrangement, there may be panels inside this area.
How can I get the actual usable area of each monitor? Ideally, using only Gtk/Gdk, nothing X11-specific.
The following approach is a bit convoluted, but it is what I'd use. It should be robust even when there is complex interaction between the window manager and GTK+ when a window is mapped -- for example, when some of the panels are automatically hidden.
The basic idea is to create a transparent decorationless maximized window for each screen, obtain its geometry (size and position) when it gets mapped (for example, using a map-event callback), and immediately destroy them. That gets you the usable area within each screen. You can then use your existing gdk_screen_get_monitor_geometry() approach to determine how the usable area is split between monitors, if any.
In detail:
Use gdk_display_get_default() to get the default display, then gdk_display_get_n_screens() to find out how many screens it has.
Create a new window for each screen using gtk_window_new(), moving the windows to their respective screens using gtk_window_set_screen(). Undecorate the windows using gtk_window_set_decorated(,FALSE), maximuze them using gtk_window_maximize(,TRUE), and make them transparent using gtk_window_set_opacity(,0.0). Connect the map-event signal to a callback handler (using g_signal_connect()). Show the window using gtk_widget_show().
The signal handler needs to call gtk_window_get_position() and/or gtk_window_get_size() to get the position and/or size of the newly-mapped window, and then destroy the window using gtk_widget_destroy().
Note that in practice, you only need one window. I would personally use a simple loop. I suspect that due to window manager oddities/bugs, it is much more robust to create a new window for each screen, rather than just move the same window between screens. It turns out it is easier, too, as you can use a single simple callback function to obtain the usable area for each screen.
Like I said, this is quite convoluted. On the other hand, a standard application should not care about the screen sizes; it should simply do what the user or window manager asks. Because of that, I would not be surprised if there are no better facilities to find out this information. Screen size may change at any point, for example if the user rotates their display, or changes the display resolution.
in the end I ended up using xlib directly, various "tricks" like the one suggested above ended up eventually failing in the long run often with odd corner cases and never followed the KISS principle.
The solution I used is in the X-Tile code base.

Custom scroll layout with fisheye in WPF

I know Windows Forms quite good but I'm new to WPF.
I'd like to create application similar to RSS reader - in main window every note will be displayed in Post-it like frame and all notes should be chained and scrollable up and down. I also want to include kind of fisheye view - single note will be displayed full size in the centre of the screen and will shrink and rotate on the edge.
I know custom control, transformation and databinding concepts but I'm not sure how to handle displaying and scrolling notes in the main window. The questions are:
what is the suggested way to arrange, display and scroll ordered chain of notes?
should single note discover own position on the screen or it should be notified by it's container?
how in such solution provide feature which will open related notes as a "multiple popups" notes connected by a line with original one? (like traversing correlated results in Google Wonder Wheel, adobe flash there)
are there any standard solutions for displaying and manipulating (moving, attaching, collapsing) such popup-widgets?
If there are any similarities in your proposal to other GUI frameworks (Forms, Swing, SWT), comparison are welcome too.
Thanks in advance!
It seems to me you are describing a "carousel control" or "element flow" or "cover flow". I've put some links at this answer.

Resources