How can I use transition themes (e.g. EntranceThemeTransition) in WPF? - wpf

I created a Universal Windows Application that performed a basic transition between my MainPage and 3 other BasicPages. Each BasicPage had a Grid and I was able to animate the items in the Grid when it was loaded using EntranceThemeTransition in XAML. So good so far. The problem, however, is that I can't run this like a normal Windows application. My understanding is that it must be loaded as a Metro app in order to run. This is problem because I would like to run this program on a Windows 7 machine.
Now I'm re-creating the project in WPF, but I can't use EntranceThemeTransition like I did before. There is no TransitionCollection or EntranceThemeTransition in the XAML for VB.NET.
Is there some way to access this prebuilt transition or will I have to use a combination of DoubleAnimation on the *.Left property *.Opacity property?

Related

Adding WPF Windows to an XNA Game Project

I'm creating an experimental game (which would eventually become a map editor for a game) and I'd like to include a WPF window in the same project which would communicate with the game logic. This is not another render-xna-game-in-wpf-window question, I've read tons of those, I want to spawn a seperate WPF window independent from the XNA game window, but in the same program, in the same project. When I click Add Item and select WPF, all it gives me as an option is a User Control, no window or any other options etc. I've tried referencing PresentationCore but no lock either, am I missing something? I am not super with interoperability, so forgive me if what I tried is stupid. I also don't want "hacky" solutions (like creating a window and a borderless control and setting their location same etc) if it can't be done just tell it so, but I'm sure there is a relatively "clean" way of doing it since they'll be completely seperate, think of it like a very simple MVC: M Game Logic, V XNA Window, C WPF Window. And don't offer me Forms, I know how to go with forms, but I want WPF, I just work with WPF/XAML and WPF style controls more easily.
Being able to add a Window from the Add Item menu is controlled by a Visual Studio project type GUID. Have you tried to create the window xaml and cs files manually (or create it in another, test solution and Add Existing file)? Or just create a Window instance in code and show that? Also, Window is in PresentationFramework, not PresentationCore.

New window in Silverlight out-of-browser application

In a Silverlight application that doesn't run in a browser, is it possible to create a new top-level window? Or at least a child window?
I found some solution using the ChildWindow class, but even though my project is configured for Silverlight 4, that class can not be found.
I have a UserControl (XAML file) that I want to show as a new window. Using a tab control is not really an option unfortunately as the user has to be able to arrange windows to see more than one at once.
Any suggestions?
ChildWindow is part of the SDK, you need to add the System.Windows.Controls.dll to access the ChildWindow type.
I'm not sure you can get the ChildWindow to do what you are expecting. A ChildWindow is designed to present a window in a modal manner. However this modal behaviour is really a function of the ChildWindow template. It is possible to re-template to remove the modal behaviour. However I've never tried to manipulate multiple child windows. You could give it a go, the big question would be what happens if you close Child windows in a different order in which they were created?
In order to use a ChildWindow to present your UserControl it would probably be best for you to derive from ChildWindow, instead of UserControl. You may even find it would ultimately be better for you create base class between your specific Xaml and ChildWindow where you would put code that is common to all your windows.
I might be worth you noting the Silverlight 5 will support multiple windows.

WPF precompiled resources in WinForm application?

I am working on an application that started out as a WinForm but it is now utilizing WPF windows with UI. The interaction is all working beautifully but when the WPF windows are first shown it takes quite a long time (around 1-3 seconds) for them to show. So long that some wonder if the app has crashed (until the content shows). The second time the same windows are invoked they come up quickly. I need them to come up quickly the first time around.
I am making use of styles and control templates that are located as XAML in the resource folder. In the XAML for the WPF windows I then merge them into the windows resource dictionary. The Build Action for those (in VS 2010) needs to be set to "Resource".
Preferably I want to keep them in separate files for easy maintenance.
As far as I understand if the build action was "Page" the XAML would be precompiled and should load faster but if I set it to Page I cannot merge them into the resource dictionary. Is there a way around that?
I am fairly new to this part of WPF and so far my internet search hasn't been successful.
To be clear: I am not talking about WPF controls being embedded in WinForms. I am talking about entirely separate WPF windows that are spawned from the WinForm context.
Is there a way to precompile the entire app or at least all XAML (it's all static, no dynamic XAML)?
Thanks in advance!
Edit: The UIs are not heavy by any means. The ones in question have between 5 and 20 buttons and the usual containers (basically a grid with 1 or 2 stack panels).
Update:
I tried precompilation with "NGEN install appname" - no effect on WPF window load.
I included all resources and templates into the window.xaml - no effect.
(window.xaml is pre-compiled)
I found this really interesting article about pre-jitting upon app load here:
http://www.codeproject.com/KB/dotnet/pre_JIT.aspx
(I used the improvement suggested by 'ittay ophir')
again: no effect on WPF window load...
The load times simply won't change on first load but they are significantly reduced on all consecutive loads (loads in 20ms or less).
What the heck is going on here?
How about loading the XAML asynchronously using XamlReader.LoadAsync Method ?

WPF Component in Windows Application

i have created one component in WPF. its working fine with WPF but when i tried to use it in windows application i am getting one issue.
i have one textbox in that control so in when the control hosted in windows applicaion and i try to type something in that textbox its not working.
i tried to put some messageboxes in "KeyPreview", "KeyDown" and "Textxchanged" events any of these events have not been fired.
so is there any limitation for WPF usercontrols usage in windows application??
one more thing i have used Dispatcher timer in the usercontrol.
This MSDN walkthrough shows how to use a WPF user control in Windows Forms. It may help you in your query.
http://msdn.microsoft.com/en-us/library/ms745781.aspx

WPF custom control looking weird on deployment

I use a custom numericUpDown control in my WPF application which works fine in my local development environment. However when i deploy my application the control looks strange, to be more specific, all the elements within the control seem to be in place but without the styles. What could be the reason for this?

Resources