Difference between revisions of "Silverlight"
From Richard's Wiki
Line 4: | Line 4: | ||
* [http://joel.neubeck.net/2009/07/silverlight-3-drag-behavior/ Silverlight 3 Drag Behavior] (using WriteableBitmap()) | * [http://joel.neubeck.net/2009/07/silverlight-3-drag-behavior/ Silverlight 3 Drag Behavior] (using WriteableBitmap()) | ||
* [http://www.mostlydevelopers.com/mostlydevelopers/blog/post/2008/08/11/Call-Javascript-Method-from-Silverlight-and-Vice-Versa.aspx Call Javascript Method from Silverlight and Vice Versa] | * [http://www.mostlydevelopers.com/mostlydevelopers/blog/post/2008/08/11/Call-Javascript-Method-from-Silverlight-and-Vice-Versa.aspx Call Javascript Method from Silverlight and Vice Versa] | ||
− | * [http://blogs.msdn.com/brada/archive/2010/03/15/silverlight-4-ria-services-ready-for-business-index.aspx Silverlight 4 + RIA Services - Ready for Business: Index] | + | * [http://blogs.msdn.com/brada/archive/2010/03/15/silverlight-4-ria-services-ready-for-business-index.aspx Silverlight 4 + RIA Services - Ready for Business: Index (excellent introduction)] |
+ | * To fix problem with default Silverlight BusinessApplication template generated projects and Windows authentication, override the AuthenticationService GetAuthenticatedUser method in the web project, like this: | ||
+ | <code> | ||
+ | // Have to override GetAuthenticatedUser when using Windows authentication. | ||
+ | // Even when Windows auth is defined, the auth subsystem insists on looking for an | ||
+ | // AspNetProvider SQL database. Code below gets the user informaation from the | ||
+ | // principal in the WIndows Auth case. | ||
+ | protected override User GetAuthenticatedUser(System.Security.Principal.IPrincipal principal) | ||
+ | { | ||
+ | User user = new User(); | ||
+ | Configuration config = WebConfigurationManager.OpenWebConfiguration("~"); | ||
+ | SystemWebSectionGroup grp = (SystemWebSectionGroup)config.GetSectionGroup("system.web"); | ||
+ | AuthenticationSection auth = grp.Authentication; | ||
+ | if (auth.Mode == AuthenticationMode.Forms) | ||
+ | { | ||
+ | user = base.GetAuthenticatedUser(principal); | ||
+ | } | ||
+ | else if (auth.Mode == AuthenticationMode.Windows) | ||
+ | { | ||
+ | string[] a = principal.Identity.Name.Split('\\'); | ||
+ | //System.DirectoryServices.DirectoryEntry ADEntry = new System.DirectoryServices.DirectoryEntry("WinNT://" + a[0] + "/" + a[1]); | ||
+ | //string Name = ADEntry.Properties["FullName"].Value.ToString(); | ||
+ | user.Name = a[a.Length-1]; | ||
+ | } | ||
+ | return user; | ||
+ | } | ||
+ | </code> | ||
* Dropshadow effect (in Resources): | * Dropshadow effect (in Resources): | ||
<code> | <code> |
Revision as of 19:29, 13 May 2010
- 4 Simple Steps to Consume WCF Service using Silverlight
- Interaction between Silverlight and HTML
- How to Construct a Reusable Silverlight ASP.NET User Control
- Silverlight 3 Drag Behavior (using WriteableBitmap())
- Call Javascript Method from Silverlight and Vice Versa
- Silverlight 4 + RIA Services - Ready for Business: Index (excellent introduction)
- To fix problem with default Silverlight BusinessApplication template generated projects and Windows authentication, override the AuthenticationService GetAuthenticatedUser method in the web project, like this:
// Have to override GetAuthenticatedUser when using Windows authentication. // Even when Windows auth is defined, the auth subsystem insists on looking for an // AspNetProvider SQL database. Code below gets the user informaation from the // principal in the WIndows Auth case. protected override User GetAuthenticatedUser(System.Security.Principal.IPrincipal principal) { User user = new User(); Configuration config = WebConfigurationManager.OpenWebConfiguration("~"); SystemWebSectionGroup grp = (SystemWebSectionGroup)config.GetSectionGroup("system.web"); AuthenticationSection auth = grp.Authentication; if (auth.Mode == AuthenticationMode.Forms) { user = base.GetAuthenticatedUser(principal); } else if (auth.Mode == AuthenticationMode.Windows) { string[] a = principal.Identity.Name.Split('\\'); //System.DirectoryServices.DirectoryEntry ADEntry = new System.DirectoryServices.DirectoryEntry("WinNT://" + a[0] + "/" + a[1]); //string Name = ADEntry.Properties["FullName"].Value.ToString(); user.Name = a[a.Length-1]; } return user; }
- Dropshadow effect (in Resources):
<DropShadowEffect x:Key="DropShadow" BlurRadius="15" Color="Black" Direction="320" Opacity="1.0" ShadowDepth="10" />
- To use (in xaml):
Effect="{StaticResource DropShadow}"
- To use (in .cs):
control.Effect = Application.Current.Resources["DropShadow"] as System.Windows.Media.Effects.Effect
- To get position of a UIElement:
// Obtain transform information based off root element UIElement element = this as UIElement; GeneralTransform gt = element.TransformToVisual(Application.Current.RootVisual); // Find the four corners of the element Point topLeft = gt.Transform(new Point(0, 0)); Point topRight = gt.Transform(new Point(element.RenderSize.Width, 0)); Point bottomLeft = gt.Transform(new Point(0, element.RenderSize.Height)); Point bottomRight = gt.Transform(new Point(element.RenderSize.Width, element.RenderSize.Height));
Silverlight & CAL (PRISM)
- Silverlight 3 and MVVM (Silverlight forum)
- Prism for Silverlight - An Intro to Composite Applications
- Silverlight 4 - MVVM with Commanding and WCF RIA Services