How do I recreate this design of silverlight? - silverlight

I have a silverlight sample code that looks like this simple design of just an APP and a PAGE file. I want to recreate this sort of setup from scratch to create a project that ouputs a silverlight program yet it only has these couple of files along with some support files. I went through the creation of a number of Silverlight creations and none produced such a simple and small design. How do I create such a formation that is just an App and a Page and such a few additional files from scratch and still have it output as a silverlight app?

First of all, to create this kind of project - I see you are using Visual Studio 2010, simply go to : file-new-project. On the left window there should be a tab for the templates. Select Silverlight (it will be under Visual C#). In the main window, select "Silverlight application". Once you named your project and click ok, you will be prompted on whether to host the page in a new website. Untick the checkbox and click ok. Now you will have your project exactly as it looks in your image.
Just note though, as you run it in VS, it will automatically generate a page for the app to run in, but since you indicated that it should not create a website to host it in, when wanting to deploy, you will have to create your own page and add the required markup yourself.

Related

Failed to load toolbox item in VIsual Studio in WinForms C++

I am creating a windows form application in managed C++. To add a custom user control either one can create a new project or add CLR User control to same project. When I add a user control to same project it builds and shows control in toolbar. When I drag and drop it onto my main UI it throws up error.
"Failed to load toolbox item, It will be removed from Toolbox".
There is no error if I create a separate project under same solution and compile control as a DLL. Is there a way I can add a custom user control to same project and use it.
Also I looked up similar question on the topc but none of them has helped me. I have checked the files and I am building the project as Win32 and there is no way control being separately built as x64.
Had same problem after one or both of renaming project or/and changing platform, most posted "solutions" provided to other people asking the same question didn't seem to work.
What did work for me was to go into the project folder and delete the obj folder, and just to be safe the bin folder too, then build again. (Seems the so called Build->Clean menu item only does half of the required work.)

Behaviours in wpf apps Microsoft expression blend 4

I am using Microsoft expression blend 4 and i want to add a simple button,in a wpf application, which by clicking it(on "Run Project" mode) navigates the user to another existing wpf application in expression blend 4.This can be done by using a method but maybe I used the wrong method or i used the right method the wrong way.To be more specific i dragged on the button(that i want to make the task i mentioned) the "Launch UriOrFile Action" method but i realised(by making experiments with various files on desktop and using internet url's) that i can only link the running wpf application with random files or internet sites and not to another wpf application as i wanted(when i put the path of the wpf application it pops up a window saying"windows explorer has stopped working",something that didnt occured when i put random file's paths or internet sites url's).If anyone understands my problem let me know!thanks!!
Check out Process.Start. Create a command that fires code that calls that method.

Is it possible to share code between a Silverlight web app and Windows Phone 7 app

I have a simple Silverlight app that I want to run on Windows Phone 7 almost exactly as is. I've created a new Windows Phone 7 project and when I reference the Silverlight app I get a warning that says "Adding a reference to a Silverlight project might not work properly. Do you want to continue?".
If I continue and try to run anyway, the WP7 project never starts or sometimes I get "AG_E_PARSER_BAD_TYPE error" and it points to the line in the xaml I used a control from the Silverlight project .
The code between these two projects is about 99% the same. Is there another way to reuse code then what I am trying? Or how can I get this to work?
I'm not that familiar with the difference between the two platforms, but you can link the code files into a different project without duplicating them. Add existing item, and click on the down arrow next to the 'Add' or OK button. Choose Link.
The typical way of achieving this is by using a pattern like MVVM which will allow you to define a common model and viewmodel layer (perhaps in a separate project) the defining a different view layer that references that common project.
You said it yourself, you will only share MOST of the code, not all of it, so you will, at least at some time, need to create device/front-end specific logic and layout.
Rather than add a Silverlight [presumably class library] project to your WP7 app, try creating a WP7 class library and then link the files from the silverlight library. You will still only have one copy of each file but all your libraries will be built appropraitely for the platform they are running on.
This may also help you identify the cause of the problem. The error AG_E_PARSER_BAD_TYPE suggests that you have a type in the XAML in your Silverlight project which isn't supported on the phone.

Reusing a Control in another Windows Forms Project

I've got lots of web experience but am a total novice when it comes to Windows Forms so this might be easy to answer:
I have Project1 which I've added a reusable control to which allows filtering and searching of data and presenting results.
I now want to use the same control in another Project.
When I open Project1 and select my form the reusable control appears on the toolbar so I can drag it onto any form in the project, but how do I get this to happen in my new Project?
You can add a reference to the (binary) control:
menu Project/Add Reference/tab Browse
Then it should turn up in the Toolbox (menu View/Toolbox).

WPF - Switching from WPF app to xbap

I have a working WPF application. I would like to see it running as an xbap. What do I need to change in my WPF app to make it run as an xbap?
When it comes to what you can do graphically, the only difference between the two is that XBAP can't use BitmapEffects. Other than that, the sandbox security issues are pretty much the only things you need to deal with. Most pure WPF programs should transition smoothly.
Check out this comparison of the differences between WPF and XBAP.
Here's a tutorial for creating an XBAP application.
Based on that there's a fairly simple refactor you can do to accommodate both WPF and XBAP for your program.
First, move all of your WPF code into
a .dll project separate from the core
WPF EXE project. Reference this project in your core WPF EXE project.
Modify the EXE project's App.xaml to point to
your main page from your .dll
project.
Create a new XBAP project.
Reference the dll project mentioned above in your XBAP project
Modify the XBAP project's App.xaml to point to the main page from your .dll
Publish and run.
Yes, we can use Windows in XBAP.
But the first object must be a Page, because the Page will be displayed on the browser. You can put a button on the page and open your window from it.

Resources