About the author

Brian Keating is a developer addicted to Microsoft Technologies.

Month List

RecentComments

Comment RSS

Declarative Ria Data and Controls

clock March 24, 2010 21:27 by author Brian Keating |

I'm really loving this declarative approach with silverlight and wpf... (ask me why and I can't tell you ! :-)

Anyway I've just stumbled across a way of managing RiaDataContexts Declaratively
I found it on the Telerik samples.... If you've not looked at these guys controls then check them out!!

 

<navigation:Page xmlns:dataFormToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"  xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
  x:Class="SiteDocs.Loler"
  xmlns="//schemas.microsoft.com/winfx/2006/xaml/presentation">http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
  xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
  xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Ria"
  xmlns:e="clr-namespace:SiteDocs.Web.Services"
  xmlns:riaData="clr-namespace:System.Windows.Data;assembly=System.Windows.Controls.Ria"
  mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480" 
  Style="{StaticResource PageStyle}"
>

  <Grid x:Name="LayoutRoot" >
    <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}" >

            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
    
    <Grid x:Name="gridLolerLeft" >
     <Grid.RowDefinitions>
      <RowDefinition />
      <RowDefinition Height="Auto"/>
     </Grid.RowDefinitions>

                    <riaControls:DomainDataSource x:Name="DomainDataSource1" AutoLoad="True" QueryName="GetLolers" PageSize="10">
                        <riaControls:DomainDataSource.DomainContext>
                            <e:LolerContext />
                        </riaControls:DomainDataSource.DomainContext>
                        <riaControls:DomainDataSource.FilterDescriptors>
                            <riaData:FilterDescriptorCollection LogicalOperator="Or" />
                        </riaControls:DomainDataSource.FilterDescriptors>
                    </riaControls:DomainDataSource>

                    <telerik:RadGridView x:Name="RadGridView1" ItemsSource="{Binding Data, ElementName=DomainDataSource1}"
                             Filtering="RadGridView1_Filtering" IsBusy="{Binding IsBusy, ElementName=DomainDataSource1}" />
           <telerik:RadDataPager x:Name="RadDataPager1" Grid.Row="1" Source="{Binding Data, ElementName=DomainDataSource1}" DisplayMode="FirstLastPreviousNextNumeric, Text" IsTotalItemCountFixed="True"/>

    
    </Grid>

                </Grid>
    </ScrollViewer>
  </Grid>

</navigation:Page>




Expression blend visual states

clock March 23, 2010 22:57 by author Brian Keating |

A few people have asked me what's the easiest way of doing transitions on Silverlight.

One of the easiest ways has to be to use the VisualStateManager with Expression Blend, see screen show for sample logged in state.
If you don't know how to use this tool then start watching a few vids!

 

To change between states you can use this code..

 

 

if (WebContext.Current.User.IsAuthenticated)
{
    VisualStateManager.GoToState(this, (WebContext.Current.Authentication is WindowsAuthentication) ? "windowsAuth" : "LoggedIn", true);
}
else
{
    VisualStateManager.GoToState(this, "LoggedOut", true);
}





Providing Security in RIA services

clock March 23, 2010 21:18 by author Brian Keating |

If you wish to prevent clients accessing your data

[RequiresAuthentication]
[EnableClientAccess()]
public class LolerService : LinqToSqlDomainService<LolerModelDataContext>




Popups in wpf

clock March 17, 2010 17:14 by author Brian Keating |

Here is come code to show a popup in wpf, i've nothing in the popup at the moment, just a gradient background and border.

<Popup Name="popup1" 
   Width="{Binding ElementName=bdrCalendar, Path=ActualWidth, Converter={StaticResource MarginValueConverter}}"
   Height="150"
   Placement="Center"
   PopupAnimation="Scroll"
   AllowsTransparency="True"
   PlacementTarget="{Binding ElementName=bdrCalendar}"
   MouseDown="popup1_MouseDown" >
 <ctrls:PopupContent />
</Popup>

 

 

 

 




RIA Services

clock March 15, 2010 11:15 by author Brian Keating |

Over the w/end I was helping a mate with his Data-driven Silverlight app.

I was gobsmacked that his developer spent days and weeks writing plumbing code, hand coding infrastructure code and even worse my friend had to pay for it.
Being able to focus on the business needs is important so having a development platform that better enables that focus and increased productivity is an absolute must.

The solution to this problem is codenamed Alexandria i.e. .NET RIA Services, this technology provides a set of server components and ASP.NET extensions that ease the n-tier development process, making your applications almost as easy to develop as if they were running on a single tier, In addition, services such as authentication, roles and profile management are provided. The combination of client and server enhancements to Silverlight 3 and ASP.NET along with the addition of .NET RIA Services, streamline the end-to-end experience of developing data-driven Web applications also known as Rich Internet Applications, or RIAs.

I’m not going to show you how to do it as there are many-many training resources available but a good place to start is here: http://silverlight.net/getstarted/riaservices/

So if you find yourself writing needless plumbing code for a DAL in Silverlight, then spend some time figuring RIA services out!
(Spend some get some diesel for that digger and opposed to grabbing a shovel and diving in!!)