Print Page | Close Window

Silverlight Templates

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
Printed Date: 19-Jan-2019 at 6:00am

Topic: Silverlight Templates
Posted By: voulgeor
Subject: Silverlight Templates
Date Posted: 06-Jun-2010 at 12:11pm
Hi guys i am testing your great product against the RIA services so i can make a decision. I think that it would be a great add-on to your product and good start for new users that are used to RIA services if you could add the same templates as the RIA services have. i am talking about Silverlight Business Application and Silverlight Navigation Application or even more combining template with view model setups.
Also it would be a great help to vb programmers if you dont forget them by including vb examples. Thank you keep up the good work.

sorry for my bad English.

Posted By: WardBell
Date Posted: 10-Jun-2010 at 8:47pm

Excellent idea ... and one we've considered. We are working on our own versions of these templates.

Meanwhile, I just happen to have been working on a tutorial for starting with the SL Navigation Application template when creating a DevForce app ... an another tutorial on converting a DevForce app built with our SL Application template to the Navigation Application template. I hope to release those soon.
The Business Application template is a bit more complicated because they wove RIA Services' Login code deep into the template. That template is such a mess that I'm not yet sure how best to tackle it.
Good point about VB support.
Your Enlish is terrific :-)
Thanks for the feedback and stay tuned.
p.s.: Templates aside, we'd like to know what factors are important in your comparison. I encourage you to send your thoughts to AskWard at IdeaBlade dot Com

Posted By: dcsoft
Date Posted: 20-Jun-2010 at 5:01pm
Until Ward posts his tutorial or the new DevForce templates are ready (which would be most welcome indeed), perhaps this will help. Here are the steps I performed to integrate the UI from the Silverlight Navigation Application template into an application generated by DevForce Silverlight Application.

   1.  Generate a new project based on Silverlight Navigation Application.  Assume it is called default “SilverlightNavigationApplication1”.  We will be copying stuff out of this project into the DevForce one.

   2.  Generate a new project based on DevForce Silverlight Application.  Assume it is called “DevForceSilverlightApplication1”.  We will be replacing the simple UI showing “Hello DevForce” with the multi-page UI from SilverlightNavigationApplication1.

   3.  Assets\Assets.xaml --- Copy Assets\Assets.xaml from SilverlightNavigationApplication1 to DevForceSilverlightApplication1.  Create Assets folder in Solution, Add Assets.xaml to it, and set properties to be the same as reference project (Set Build action to Resource).

   4.  Views\* --- Copy all 6 .xaml and .cs files in the Views\ subfolder (i.e. Views\*) from SilverlightNavigationApplication1 to DevForceSilverlightApplication1.  Create Views folder in Solution, Add all files from Views\ to it.  (All properties are already correctly set, so there is no need to change.)

   5.  App.xaml – Open SilverlightNavigationApplication1’s App.xaml and copy the contents of the <Application.Resources> tag to the clipboard.  Paste it into the App.xaml in DevForceSilverlightApplication1, overwriting the original tag.

   6.  MainPage.xaml / MainPage.xaml.cs --- Replace MainPage.xaml and MainPage.xaml.cs in DevForceSilverlightApplication1 with the files from SilverlightNavigationApplication.

   7.  Search/Replace namespace in Entire Solution:  replace “SilverlightNavigationApplication1” with “DevForceSilverlightApplication1”.

   8. Add references to System.Windows.Controls and System.Windows.Controls.Navigation

Hope this helps,

Posted By: master-of-disaster
Date Posted: 22-Jun-2010 at 8:16am
I've convert for few days the navigation template to work with DevForce for Silverlight.
But I've implement a BOSServer from Scratch and so on to a navigation template. This way works, too.
After that I've implement PRISM + MEF to my navigation template with using DevForce for Silverlight.
But I've some confusion to handle implement and handle user login and asp.membership to my new navigation temlate with DevDorce or to convert the business navigation template to a working DevForce Template.
To create a login is not the problem. But I'm confusiong to get user.roles, IsAuthenticated or other user information/status in a navigation page. On my mainpage all works fine.
I've create a Testsolution (WCF Ria), with standard  Business Navigation Template,  which check user authentication on startup. If user is not authenticated I will load a "blank" usercontrol with a login child window. When user is authenticated I load a navigation page with Prism + MEF Modules.
Here a Code example fragment from my app.xaml.cs:

public App()


this.Startup += (s, e) =>


this.Resources.Add("WebContext", WebContext.Current);

WebContext.Current.Authentication.LoadUser(Application_UserLoaded, null);

WebContext.Current.Authentication.LoggedIn += (lSender, lE) =>


if (!WebContext.Current.Authentication.User.Identity.IsAuthenticated)


WebContext.Current.Authentication.Logout(null, null);

this.progressIndicator.Content = new LoginContainer();




Bootstrapper bootstrapper = new Bootstrapper(this);




WebContext.Current.Authentication.LoggedOut += (lSender, lE) =>


this.progressIndicator.Content = new LoginContainer();




this.Exit += this.Application_Exit;

this.UnhandledException += this.Application_UnhandledException;



In the original business navigation template in the app.xaml and app.xaml.cs are a webcontext is build, to get the authentication information of a user login. Show below my example code.
In german we say - I stand on the line -, I don't know, what it is in english. But I thing the way is so easy, that I don't say it.
How can I convert the WCF Ria WebContext in the solution to a DevForce Userlogin and ASP.Mebership?
Do anyone have a example to convert the WebContext to DevForce for Silverlight?
Sorry I'm not an english evangelist, so I hope someone can understand my english description of my problem.
I hope someone can give a little help or an example to understand my issue. It's urgent, because I've to built a new solution and I will do it with DevForce and not WCF Ria. I've to find a solution for my problem in the next two days, other way I must use WCF Ria Services, my timetable is very small...

Posted By: ting
Date Posted: 23-Jun-2010 at 7:08pm
master-of-disaster - Unfortunately, I don't have the knowledge to help out.  I was hoping Ward would be able to jump in, but he is out this week and may not be able to respond.

Posted By: master-of-disaster
Date Posted: 24-Jun-2010 at 10:11am
I've found a solution for handle UserBase in a navigation page.
Actuall I've implement DevForce to a silverlight navigation page template. After that I've implement a login with DevForce.
The "convert" WebContext, I'll use a Globals.cs in my Silverlight Project.
Here I have declare: public static UserBase CurrentUser = null;
In private void Login_Completed I set
Globals.CurrentUser = _entityManager.Principal as UserBase;

Posted By: DavidKozikowski
Date Posted: 28-Jun-2010 at 10:07am

Any chance of getting a Prism Explore refresh that uses Version 2.2 and SL4 with DevForce 2010?


Posted By: jeejee
Date Posted: 14-Jul-2010 at 6:47am
I am currently evaluating DevForce 2010 in SL4 and was wondering whether there is there any information about using DevForce 2010 to replace the functionality provided by WebContext.
Most application examples out there and project templates provided by control vendors are using WebContext and there does not seem to be a seamless way in which to swap in DevForce into these applications.
IMHO it would be quite beneficial to have examples of how to do this as it would make it much easier for people to use DevForce instead of WCF RIAS
Any information would be welcome

Posted By: WardBell
Date Posted: 15-Jul-2010 at 7:26am
The RIA Services WebContext as I recall is a RIA Services context devoted to working with the ASP.NET Security apparatus. An example of its use is baked into the RIA Services Business Application Template.
There is a DevForce equivalent in the Learning Resources "Security" folder that also illustrates DevForce support for POCO classes.
We realize that we should do a better job of guiding folks with RIA Services backgrounds. An effort of that nature is high on our agenda for the next few weeks ... and ASP Security integration will get early attention. Please hold us to it!
I am hopeful you can proceed with the core of your application while we get our training materials together. We won't be far behind you.

Posted By: master-of-disaster
Date Posted: 15-Jul-2010 at 1:47pm
Hello jeejee,
show my post. Here I've that CurrentUser as UserBase, here you have login status and roles and so on. So you've a status like WebContext for the most important function.
Actual I'm working on a POCO classes for a user profile and custom membership.
In the last few weeks I've spend a lot of time to understand, convert and to use DevForce special in ASP.NET Membership integration and business application. There are some questions I actual try to understand and solve. Here I miss more examples, too. This would save a lot of time.
May be, I can help you. If you have a question, send me an email. (in the next three days I'm out of my office, don#t wonder when I responde on sunday or monday)

Posted By: DavidKozikowski
Date Posted: 16-Jul-2010 at 5:45am

So are you saying that you are working on a DevForce / Silverlight solution using the ASP.NET security model?


What would be nice if we could make a Module that could be shared with all of us.


This would have a login screen / forgot password etc. This needs to "attach" to a User Repository that maps to the ASP.Net security DB Schema via the entity framework and DevForce. The LoginViewModel would have some event maybe that would be fired on a good log in maybe a RelayCommand or something.


The point is all of this could be packaged up and then added to a DevForce SL Template called "DevForce 2010 SL 4 app with Security" so after I press the button all of this is there as Long as I run the ASP.NET db script into my production DB then all is well.


Anyone want to help on this?  Does anyone want to "claim a part, better yet has anyone done this yet as that is coming up soon on my agenda.


Posted By: WardBell
Date Posted: 19-Jul-2010 at 2:38pm
David + Master - You are both on the right trail. It is only a matter of time.
The Learning Resource has the essence of what we need. The packaging is what is missing.

Would have used the RIA Services template but it is so awful ... really some of the worst code I've seen in a long time ... and so wired into peculiarities of RIA Services ... that (a) I would not duplicate it if I could and (b) I would have to shoot myself if I did.
I predict something good coming from all of this in the next few weeks.

Posted By: master-of-disaster
Date Posted: 20-Jul-2010 at 12:57am
Hello Ward,
your answer makes me happy. I'm a newbie and I have thought by myself, it's an awf... code in the ria service template. But I doubted myself.
I very satisfied of DevForce for Silverlight. I try to convert the ria Template, but for my project I build a new template from  scratch with MEF and Prism.
All works fine, actual I desparate to write a POCO-Class for a Membership Profile. Here I've same problem with the inherited classes from DevForce and ASP.NET Membership.
I very curious of the next few weeks. I you have same code samples/snippets in the next few days for a Membership Profile,I would be happy, when you can send me it.

Posted By: WardBell
Date Posted: 21-Jul-2010 at 11:48pm
This is an important topic for us. We won't have anything in the "next few days". I suspect it will take us a few weeks ... not because it is hard; it is a matter of priority and resources. But we will do it.
We intend to do it in a public way. We intend to publish our source and to invite you - the DevForce community - to participate with your comments and your own creativity, perhaps inspired by what we publish.
Don't feel like you have to wait for us. If you have something to share, let me know.

Posted By: WardBell
Date Posted: 10-Aug-2010 at 2:56pm
I thought I better touch base on this topic again because it's been awhile since I said anything on the subject and we are often asked about it.
We agree with you. We think it is important too! We want to fill this gap in our exposition of good practices as soon as we can. We're going to do so. At the moment, we are addressing what we think are more urgent priorities ... but we won't let this linger either.
I hasten to add that DevForce security is quite strong and can leverage the ASP Security protocols and artifacts. We don't have to change DevForce at all to get the login and registration experience you are requesting. We are only talking about some open source example code that imitates to some degree the material you find in the RIA Services template.
As I mentioned above, there are Learning Resources units ("080_Security\Silverlight\CodeCS") that propose an entity-based approach to login and ASP user account management. These are valuable clues to one possible way to use login and register with ASP Security; it's an entity-centric approach in contrast to RIA Service's operational approach but it does the job.
No, it does not tie into the Business Application tempate's UI. Whether you like that UI or not (hint: I do not), we know our audience would like to see it. Perhaps one of you will take a stab at it before we do ... I have merit badges waiting for you :-)
Meanwhile, ... a question for you: is it ok to suggest that you by-pass this feature for now and concentrate on your business functionality?
In principle, authentication is a service that should be performed externally to your application. You consume it, mostly through the side-effect of Authentication and Authorization state in the IPrincipal. RIA Services works this way as does DevForce. 
It follows that login and registration can be added later. At most you might need your custom derivative of UserBase to get at roles and permissions; you should be able to stub this out until we get our act together.
Obviously this answer won't help you if you must deploy to production tomorrow. If not, can you wait a bit for this?
Appreciatively, Ward (for IdeaBlade).

Posted By: WardBell
Date Posted: 10-Aug-2010 at 2:58pm
@David K -
Back in June you asked: "Any chance of getting a Prism Explorer refresh that uses Version 2.2 and SL4 with DevForce 2010?".
That question got lost in the larger authentication topic.
I don't remember when we posted it but that very update has been available from our web site for some time now. Hope you've picked it up by now.

We just deployed it to Azure too :-)

Posted By: DavidKozikowski
Date Posted: 11-Aug-2010 at 3:44am
Do you have a link to it? I can't seam to find it.

Posted By: DavidKozikowski
Date Posted: 11-Aug-2010 at 9:49am
Found it Thanks. -

Posted By: master-of-disaster
Date Posted: 12-Aug-2010 at 1:42am
Hello Ward,
for a reference I've build a custom ASP-Membership, User-Login = eMail, a custom role- and profile-provider to save Usertemplate and other information in a own datatable with POCO and LinqToSQL.
I hope, I've time to convert this custom Membership-Example to DevForce for Silverlight, in the next two days. When I've done the work, I'll send you the code-sample.

Print Page | Close Window