Difference between revisions of "Silverlight"

From Richard's Wiki
Jump to: navigation, search
(Silverlight (&WPF) Pixel Shader Resources)
 
(38 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
* [http://blog.thekieners.com/2010/04/21/opening-an-microsoft-office-documents-with-silverlight/ Opening a Microsoft Office document with Silverlight]
 +
* [http://blog.kevindockx.com/post/Using-a-Channel-Factory-in-Silverlight-(instead-of-adding-a-Service-Reference)-With-cows.aspx Using a ChannelFactory in Silverlight (calling WCF without Service Reference)]
 +
* [http://blogs.msdn.com/b/carlosfigueira/archive/2008/03/07/enabling-cross-domain-calls-for-silverlight-apps-on-self-hosted-web-services.aspx Enabling cross-domain calls for Silverlight apps on self-hosted web services]
 +
 +
* [http://msdn.microsoft.com/en-us/library/ee796241(v=vs.91).aspx Walkthrough: Displaying Related Data in a Silverlight Business Application - WCF RIA Services (MSDN]
 +
** Edit a Domain Service Query to Include Related Data
 +
** Add [Include] attribute in .metadata.cs
 +
 +
 +
* [http://tomasz.janczuk.org/2010/04/debugging-wcf-ria-services-with-wcf.html Debugging WCF RIA Services with WCF traces]
 +
Need to also add this to web.config:
 +
<code>
 +
<configSections>
 +
  <sectionGroup name="system.serviceModel">
 +
    <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
 +
  </sectionGroup>
 +
</configSections>
 +
</code>
 +
* [http://www.scottleckie.com/2010/05/silverlight-databound-combobox/ Silverlight 4 data-bound combobox dropdown]
 +
* [http://www.dansoltesz.com/post/2010/02/19/Silverlight-datagrid-double-click-behavior.aspx Silverlight datagrid double click behavior]
 +
* To get dates to appear in correct dd/mm/yyyy Australian form in autogenerated DataGrid columns, do this in UserControl constructor:
 +
// This makes dates appear in correct local form in autogenerated DataGrid columns (yippee!)
 +
Language = System.Windows.Markup.XmlLanguage.GetLanguage(System.Threading.Thread.CurrentThread.CurrentCulture.Name);
 +
* [http://msdn.microsoft.com/en-us/library/cc296254(v=VS.95).aspx Accessing Web Services in Silverlight (MSDN) - Useful umbrella article, has detailed articles on security and service types supported]
 +
* [http://sandrinodimattia.net/blog/post/Making-WCF-RIA-Services-work-in-a-DMZMultitier-architecture-using-Application-Request-Routing.aspx Making WCF RIA Services work in a DMZ/Multitier architecture using Application Request Routing]
 +
* [http://shemesh.wordpress.com/2010/07/10/silverlight-gridsplitter-with-a-collapse%C2%A0button-%E2%80%93-best/ GridSplitter with a Collapse Button]
 +
* [http://blogs.msdn.com/b/deepm/archive/2010/05/14/silverlight-tv-episode-26-exposing-soap-json-and-odata-endpoints-from-ria-services.aspx  Silverlight TV Episode 26: Exposing SOAP, jSON and OData Endpoints from RIA Services]
 +
* [http://blogs.msdn.com/b/davrous/archive/2010/12/03/how-to-open-a-wcf-ria-services-application-to-other-type-of-clients-the-soap-endpoint-3-5.aspx How to expose a WCF RIA service as a “standard” WCF Service]
 +
* [http://msdn.microsoft.com/en-us/library/ee707351(v=vs.91).aspx Walkthrough: Creating a RIA Services Class Library]
 +
* Silverlight logging
 +
** [http://stackoverflow.com/questions/228723/silverlight-logging-framework-and-or-best-practices Stackoverflow Silverlight logging]
 +
** [http://clog.codeplex.com/ Codeplex CLOG (Client Logging) project page (LGPL license)]
 +
** [http://archive.msdn.microsoft.com/RCE Microsoft Silverlight Rough Cut Editor]
 +
* [http://pauliom.wordpress.com/2009/08/02/sharing-asp-session-state-with-silverlight/ Sharing ASP Session state with Silverlight]
 +
* [http://www.devtoolshed.com/tutorial-configuring-silverlight-4-entity-framework-and-wcf-ria-services-separate-component-assembli Tutorial For Configuring Silverlight 4, Entity Framework And WCF RIA Services In Separate Component Assemblies (DLL’s)]
 +
* [http://visualstudiomagazine.com/Articles/2011/01/01/Using-MEF-to-Expose-Interfaces-in-Your-Silverlight-MVVM-Apps.aspx Using MEF to Expose Interfaces in Your Silverlight MVVM Apps (Visual Studio Magazine)]
 +
* [http://www.codeproject.com/KB/silverlight/4StepsSilverLight.aspx 4 Simple Steps to Consume WCF Service using Silverlight]
 +
* [http://blog.clauskonrad.net/2010/04/aspnetsilverlight-how-to-pass.html ASP.NET/Silverlight: How to pass credentials to Silverlight control]
 +
* [http://visitmix.com/labs/rosetta/EyesOfBlend/ Silverlight (3, but excellent) Expression Blend tutorials]
 +
* To get rid of spurious HTML scrollbar outside Silverlight in IE, add this style to the body tag in the html page hosting the Silverlight: style="overflow:hidden"
 +
 +
* To get rid of warnings like:
 +
Type of 'Blah.Blah.Blah' is not CLS-compliant
 +
when you have a separate assembly for models, etc, add the following line to AssemblyInfo.cs in the library (ie non-UI) assembly:
 +
[assembly: CLSCompliant(true)]
 +
 +
* Silverlight 4 design-time sample data. Add a static collection to the view model, and set the following as the parent datacontext, remember to set ItemsSource to {Binding name_of_static_property_which_is_the_sample_collection}:
 +
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 +
d:DataContext="{d:DesignInstance local:ViewModelClassName, IsDesignTimeCreatable=True}"
 +
 +
* [http://visualstudiomagazine.com/articles/2010/11/01/visual-studio-2010-tips-2.aspx Debug WCF Services in Silverlight Apps] - set up separate WCF Service Library in Silverlight project, use '''wcftestclient''' command-line tool
 +
* [http://blog.bodurov.com/blog/Post.aspx?postID=27 How to Bind Silverlight DataGrid From IEnumerable of IDictionary by Transforming Each Dictionary Key Into a Property of Anonymous Typed Object] - see also [http://forums.silverlight.net/forums/t/16733.aspx How to Display DataSet in Silverlight DataGrid]
 +
* [http://weblogs.asp.net/dwahlin/archive/2009/06/11/customizing-silverlight-3-datagrid-headers.aspx Customizing Silverlight 3 DataGrid Headers]
 +
 +
* [http://reddevnews.com/articles/2010/07/29/top-10-silverlight-tips.aspx Top 10 Things I Wish I Knew Before I Started My Silverlight 4 Project(July 2010)]
 
* [http://www.codeproject.com/KB/silverlight/4StepsSilverLight.aspx 4 Simple Steps to Consume WCF Service using Silverlight]
 
* [http://www.codeproject.com/KB/silverlight/4StepsSilverLight.aspx 4 Simple Steps to Consume WCF Service using Silverlight]
 
* [http://blogs.msdn.com/b/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx Defining Silverlight DataGrid Columns at Runtime]
 
* [http://blogs.msdn.com/b/scmorris/archive/2008/04/14/defining-silverlight-datagrid-columns-at-runtime.aspx Defining Silverlight DataGrid Columns at Runtime]
Line 4: Line 59:
 
* [http://www.devx.com/RIA/Article/35772/7184 How to Construct a Reusable Silverlight ASP.NET User Control]
 
* [http://www.devx.com/RIA/Article/35772/7184 How to Construct a Reusable Silverlight ASP.NET User Control]
 
* [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.silverlightshow.net/items/Anatomy-of-the-ContextMenu-how-it-is-made-how-to-use-it-and-how-to-abuse-it.aspx Silverlight 4 Toolkit ContextMenu]
 
* [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 (excellent introduction)]
 
* [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)]
 +
* [http://www.silverlight.net/learn/quickstarts/wcf-ria-services/ Silverlight QuickStart - adding a WCF RIA Service]
 
* [http://visualstudiomagazine.com/articles/2008/01/15/silverlight-xaml-primer-5-working-with-radial-gradients.aspx Silverlight XAML Primer 5: Working with Radial Gradients]
 
* [http://visualstudiomagazine.com/articles/2008/01/15/silverlight-xaml-primer-5-working-with-radial-gradients.aspx Silverlight XAML Primer 5: Working with Radial Gradients]
 +
* [http://www.jeff.wilcox.name/2008/07/visibility-type-converter/ Visibility to boolean ValueConverter]
 
* To fix problem with default Silverlight BusinessApplication template generated projects and Windows authentication, override the AuthenticationService GetAuthenticatedUser method in the web project, like this (add "using System.Web.Configuration;"):
 
* To fix problem with default Silverlight BusinessApplication template generated projects and Windows authentication, override the AuthenticationService GetAuthenticatedUser method in the web project, like this (add "using System.Web.Configuration;"):
 
<code>
 
<code>
Line 72: Line 130:
 
* [http://forums.silverlight.net/forums/p/157248/352736.aspx Silverlight Chart with Horizontal Legend] - Custom Chart Template
 
* [http://forums.silverlight.net/forums/p/157248/352736.aspx Silverlight Chart with Horizontal Legend] - Custom Chart Template
 
* [http://cesso.org/Samples/ChartBuilder/ Silverlight Chart Builder]
 
* [http://cesso.org/Samples/ChartBuilder/ Silverlight Chart Builder]
 +
* [http://community.infragistics.com/forums/p/31516/173703.aspx#173703 Infragistics exploding pie chart]
  
 
==== Silverlight (&WPF) Pixel Shader Resources ====
 
==== Silverlight (&WPF) Pixel Shader Resources ====

Latest revision as of 17:34, 4 October 2011


Need to also add this to web.config:

<configSections>
 <sectionGroup name="system.serviceModel">
   <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
 </sectionGroup>
</configSections>

// This makes dates appear in correct local form in autogenerated DataGrid columns (yippee!)
Language = System.Windows.Markup.XmlLanguage.GetLanguage(System.Threading.Thread.CurrentThread.CurrentCulture.Name);
  • To get rid of warnings like:
Type of 'Blah.Blah.Blah' is not CLS-compliant

when you have a separate assembly for models, etc, add the following line to AssemblyInfo.cs in the library (ie non-UI) assembly:

[assembly: CLSCompliant(true)]
  • Silverlight 4 design-time sample data. Add a static collection to the view model, and set the following as the parent datacontext, remember to set ItemsSource to {Binding name_of_static_property_which_is_the_sample_collection}:
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
d:DataContext="{d:DesignInstance local:ViewModelClassName, IsDesignTimeCreatable=True}"

       // 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 information 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 Control Libraries & Resources

Silverlight (&WPF) Pixel Shader Resources