Is it possible to use Kit3D in WPF? If so, how? - wpf

I have a Silverlight application that uses Kit3D and I want to convert it to WPF.
How would I do that?
Should I do that?

You could try downloading the source code from its Codeplex repository and recompiling with WPF as the target. No guarantees this will work without modifications, though, since WPF is not a complete superset of Silverlight. But according to the author's description on his web page, Kit3D is modeled after WPF's built-in Media3D namespace, so you could just use that directly rather than bother with a 3rd-party library.

Related

How to use the WinRT SwapChainPanel control in a WPF window?

I added references to WinRT dlls to a WPF project and I want to use SwapChainPanel inside of a WPF window.
Is it really possible? For now I cant get it work.
The NuGet package description for Microsoft.Toolkit.Wpf.UI.Controls mentions a SwapChainPanel but I have not found any samples using this control in WPF.
SwapChainPanel : Provides a hosting surface, where Microsoft DirectX swap chains provide content that can be rendered into a XAML UI. A SwapChainPanel element is a key component for an app that renders Microsoft DirectX graphics and then presents those visuals within a XAML page.
It's not currently officially supported - might require some private APIs in Windows, though since Stardock could implement its ModernMix - there might be some way to get it working. The thing is though - you don't have to do that. You can render content with DirectX to a WPF window in other ways. I haven't done that and it might be quite a bit of work to do, but so is anything in DirectX. You can look into DirectComposition or D3DImage class. Perhaps the article on using Direct2D with WPF can be a good sample solution.
You dont have to, as says Filip Skakun, but you can ! Just give a try to SlimDX or SharpDX. They're DirectX's implementations in C#.

What is the best way of localization LOCBaml or Resx based localization?

I came through this What is the best way to localize a WPF application, sans LocBAML? . But, this didn't answer what I'm looking for.
I'm creating a CustomControl in WPF. I would like to provide localization support. The control contains, images, strings etc.,
Any help would be greatly appreciated.
Thanks
I think the document linked in this post contains a lot of information about localization in WPF. In the end, it is up to you to decide which mechanism to use.
Since you are talking about a custom control, I would consider to give it a Culture dependency property which the consumer of your control can use to specify the desired culture. This way, the consumer can use your localized control, relatively independent of the localization strategy he/she chose.
I'd suggest using Resx, try integrating into a WPF application with the TranslationByMarkupExtension example. http://www.wpftutorial.net/LocalizeMarkupExtension.html
LocBaml was a very odd thing for Microsoft to put out there and isn't better, or even complete.

How to use Silverlight SDK with WPF

as easy as it sounds,
How can I use the themes provided in SL SDk 4.0 into WPF project??
It should be easy!! Am I missing something?
While Silverlight and WPF are related they are not identical. Each has namespaces, classes and methods that don't exist in the other.
Simply copying the Silverlight xaml into your WPF project and fixing the compile errors is one approach, but I wouldn't recommend it. There are differences, like Triggers for example, that have no direct equivalent.

Is it possible to use the WP7 Panorama or Pivot in SL4?

I'm making pretty heavy use of the Panorama and Pivot controls in my WP7 applications. Is it possible to use these same controls in a standard Silverlight (4) application?
http://phone.codeplex.com/
I added the dll's, was able to compile and create the controls in my views. However; I was not able to "Scroll". I thought they used the "LeftMouseDown" event handlers but I guess I'm wrong.
You would need to do additional work to get them to work on the desktop: manipulation events are used in phone controls since they have much more information available such as the maniupation delta.
Being an open source project I am sure they could look into adding that support, would be good to open such a work item on that site perhaps. (There are no official Pivot and Panorama controls yet from Microsoft)
I created a panorama-like control for SL4 in the following blog post:
http://www.scottlogic.co.uk/blog/colin/2010/10/silverlight-as-an-alternative-to-powerpoint/
It might be a good starting point for making a more fully features control

Anyone with experience of targeting Silverlight & WPF?

Is it possible to develop against Silverlight and WPF using the same source code? Maybe using some #define blocks where it is necessary.
Theoretically it should be doable. It's not a big problem for the code. However, you'll have to be very careful with XAML and use only the intersecting subset of WPF and SL (1), as there's no #if/#endif for XAML.
(1) Contrary to the common belief, SL is not a proper subset of WPF. It has some features that WPF does not have, though these are being worked on.
Incidentally, PRISM (the composite application block from patterns and practices) now supports Silverlight and there's a C9 video with a quick sample on using code in both WPF and Silverlight.
I think if you stick to MV-V-VM (or something along those lines) then a lot of your backend code will be reusable, but the XAML itself might need to be forked if you want a full on "rich" experience, unless you are willing to use the VSM beta for WPF.
I have no experience on that but I have used a component that targets both WPF and Silverlight environment with the same code (there are only few differences).
The component is Chart from Visifire and it's Open Source
Maybe you can take a look into it
You can use Visual Studio file linking to include classes from WPF projects in Silverlight - but only if they don't do any UI or XAML based stuff (as this is where you will usually find inconsistencies between the two)...
So keep it to business logic etc.
Flashcards.Show application is a great example of this WPF/SL/WP7 code sharing and cross platform possibilities.
http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/03/03/flashcards-show-planning-a-cross-platform-solution.aspx
Concept of cross platform is pretty simple because everything works on .NET and a similar XAML binding system. My advice here is to invest more time on architecture of the app in terms of MVVM and other abstraction to segregate the platform dependencies. So that a major percentage of the code can be re-used across while some of the XAML might need to rewrite depends on the visual complexity of the app in different platforms.

Resources