UpdateSourceTrigger

Report
Presentation logic
Orders
Appointments
Not reusable
People
REST
Vehicles
JSON
Tax
RIA
Orders
WCF
Web
Shipping
Services
Schedules
SQL
Server
Person
EF
Web
Services
Oracle
Telco
Switches
Media
Streams
Vehicle
POCO
Calendar
XML
People
Visual Studio
Team Test
Appointments
Appointments
Aggregation of data &
services for your
presentation logic
People
REST
Vehicles
JSON
Tax
RIA
Orders
WCF
Web
Shipping
Services
Schedules
SQL
Server
Person
EF
Web
Services
Oracle
Telco
Switches
Media
Streams
Vehicle
POCO
Calendar
XML
Appointments
ImplicitDataTemplates
RelativeSource Ancestor Bindings
Custom Markup Extensions
Databinding Debugging
DataContextChanged Event
UpdateSourceTrigger
WCF RIA Services Enhancements
Text, Printing & Media
namespace MyProject.Styles
{
public class MyAppStyles : INotifyPropertyChanged {
public Brush ForegroundColor {
get { return _foregroundColor; }
set {
_foregroundColor = value;
NotifyPropertyChanged("ForegroundColor");
<ResourceDictionary
xmlns:stylesNS="clr-namespace:MyProject.Styles">
<stylesNS:MyAppStyles
x:Key=“MyAppStyles"/>
<Style TargetType="TextBlock">
<Setter Property="Foreground"
Source={StaticResource MyAppStyles},
Value="{Binding ForegroundColor}"
Binding In Style Setters
Implicit DataTemplates
RelativeSource Ancestor Bindings
Databinding Debugging
Custom Markup Extensions
DataContextChanged Event
UpdateSourceTrigger
WCF RIA Services Enhancements
Text, Printing & Media
<ListBox ItemsSource="{Binding Vehicles}“
States}“
ItemTemplate="{StaticResource StatesDataTemplate}"/>
StatesDataTemplate}“/>
VehicleDataTemplate}"/>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary>
<!--Default
<DataTemplate
<DataTemplate
Vehicle
x:Key="vehiclesDataTemplate">
x:Key="stateDataTemplate">
DataTemplate-->
x:Key=“StatesDataTemplate">
<Grid>
<DataTemplate
DataType="models:Vehicle">
DataType=“models:State">
DataType="models:Vehicle">
<StackPanel
Orientation="Horizontal">
<Image
<Grid>
<Image
Source="Vehicle.png"/>
Source="Vehicle.png"/>
<TextBlock
Text="{Binding StateCode}"/>
<StackPanel
Orientation="Horizontal">
</DataTemplate>
</DataTemplate>
StateName}"/>
<TextBlock
</ResourceDictionary> Text="{Binding StateCode}"/>
</StackPanel>
<TextBlock
Text="{Binding
StateName}"/>
</Application.Resources>
<DataTemplate
DataType="models:Car">
</Grid>
</StackPanel>
<Image
</Grid>Source="Car.png"/>
</DataTemplate>
</DataTemplate>
</ResourceDictionary>
</DataTemplate>
</Application.Resources>
</ResourceDictionary>
<DataTemplate DataType="models:Truck">
</Application.Resources>
<Image Source="Truck.png"/>
</DataTemplate>
<DataTemplate DataType="models:Motorcycle">
<Image Source="Motorcycle.png"/>
</DataTemplate>
</ResourceDictionary>
</Application.Resources>
Binding In Style Setters
Implicit DataTemplates
Databinding Debugging
Custom Markup Extensions
DataContextChanged Event
UpdateSourceTrigger
WCF RIA Services Enhancements
Text, Printing & Media
namespace SLInsurance.ViewModels {
public class AppointmentsViewModel {
public ObservableCollection<Appointments> Appointments{
public ObservableCollection<Status> Status{get; set; }
get; set; }
namespace SLInsurance.Views
public partial class
{
AppointmentView
: UserControl {
...
this.DataContext =
new ViewModels.AppointmentViewModel();
<ListBox ItemsSource="{Binding Path=Appointments}">
<ListBox.ItemTemplate><DataTemplate><Grid ...
<TextBlock Text="{Binding Time}" …
<ComboBox ItemsSource="{Binding DataContext.Status,
RelativeSource={RelativeSource FindAncestor
AncestorType=UserControl,
Mode=FindAncestor}}"
<DataTemplate x:Key="StateComboBoxDataTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding StateCode}" Margin="0,0,5,0"/>
<TextBlock Text="{Binding StateName}"
Visibility="{Binding IsDropDownOpen,
RelativeSource={RelativeSource FindAncestor
AncestorType=ComboBox},
Converter={StaticResource BoolToVisibilityConverter} }"/>
</StackPanel>
Binding In Style Setters
Implicit DataTemplates
RelativeSource Ancestor Bindings
Databinding Debugging
Custom Markup Extensions
DataContextChanged Event
UpdateSourceTrigger
WCF RIA Services Enhancements
Text, Printing & Media
((System.Windows.Data.Debugging.BindingDebugState)BindingState).Error != null
Binding In Style Setters
Implicit DataTemplates
RelativeSource Ancestor Bindings
Databinding Debugging
Custom Markup Extensions
DataContextChanged Event
UpdateSourceTrigger
WCF RIA Services Enhancements
Text, Printing & Media
<ListBox
x:Name="appointmentsListbox"
ItemsSource="{Binding Appointments}"
SelectionChanged="OnAppointmentsListbox_SelectionChanged">
public partial class
Appointments
: UserControl {
OnAppointmentsListbox_SelectionChanged(object sender, SelectionChangedEventArgs e){
this.DataService.GetClaimById(GetClaimsCallback,
((AdjusterAppointment) (this.appointmentsListbox.SelectedItem)).Claim_Id);
private void GetClaimsCallback(ObservableCollection<Claim> claims) {
this.AppoinmentsListBox.Items.Add(claims[0]);
private void
GetClaimById(Action<ObservableCollection<Claim>> callback,
query = DataContext.GetClaimByIdQuery(claim_Id);
public void
var
_getClaimCallback = callback;
_claimLoadOperation = DataContext.Load<Claim>(query);
…
string claim_Id)
{
}
MethodInvokeExtension : IMarkupExtension<object>
// Properties Exposed in XAML as Intellisense Love
public String Method { get; set; }
public class
{
// Invoked by the XAML Parser @ runtime
public object ProvideValue(IServiceProvider serviceProvider) {
<UserControl x:Class=“AppointmentsView"
xmlns:MyUtils="clr-namespace:SLInsurance;assembly=SLInsurance">
...
<StackPanel x:Name="LayoutRoot">
<ComboBox Name=“appointmentsListBox"
SelectionChanged="{MyUtils:MethodInvoke Method=OnAppointmentChanged}"
<ListBox
x:Name="appointmentsListbox"
ItemsSource="{Binding Appointments}"
SelectionChanged="{helpers:MethodInvoke Method=OnAppointmentChanged}”>
public partial class AppointmentsViewModel {
private void OnAppointmentChanged( ) {
this.DataService.GetClaimById(GetClaimsCallback, this.SelectedAppointment.Claim_Id);
}
private void GetClaimsCallback(ObservableCollection<Claim> claims) {
this.SelectedClaim = claims[0];
GetClaimById(Action<ObservableCollection<Claim>> callback,
query = DataContext.GetClaimByIdQuery(claim_Id);
public void
var
_getClaimCallback = callback;
_claimLoadOperation = DataContext.Load<Claim>(query);
…
string claim_Id)
{
Binding In Style Setters
Implicit DataTemplates
RelativeSource Ancestor Bindings
Databinding Debugging
Custom Markup Extensions
DataContextChanged Event
UpdateSourceTrigger
WCF RIA Services Enhancements
Text, Printing & Media
this.DataContextChanged += View_DataContextChanged;
…
void View_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) {
INotifyPropertyChanged customer;
customer = e.OldValue as INotifyPropertyChanged;
if (customer != null)
customer.PropertyChanged -= customer_PropertyChanged;
customer = e.NewValue as INotifyPropertyChanged;
if (customer != null)
customer.PropertyChanged += customer_PropertyChanged;
}
Binding In Style Setters
Implicit DataTemplates
RelativeSource Ancestor Bindings
Databinding Debugging
Custom Markup Extensions
DataContextChanged Event
UpdateSourceTrigger
WCF RIA Services Enhancements
Text, Printing & Media
<TextBox
Name="vinTextBox"
Text="{Binding SelectedClaim.InsuredVIN, Mode=TwoWay}"
TextChanged="vinTextBox_TextChanged"
vinTextBox_TextChanged(object sender, TextChangedEventArgs e) {
Helpers.VinCarInfo carInfo = Helpers.VINParser.Parse(vinTextBox.Text);
this.vehicleYearsAutoComplete.Text = carInfo.Year.Value.ToString();
this.vehicleMakeAutoComplete.Text = carInfo.Make;
this.vehicleModelComboBox.SelectedValue = carInfo.Model;
private void
public void LoadVehicleYears() {
this.DataService.GetVehicleYears(GetVehicleYearsCallback);
}
public void LoadVehicleMakes(Nullable<int> year) {
if (year.HasValue) {
this.DataService.GetVehicleMakes(GetVehicleMakessCallback, year.Value);
…
public void LoadVehicleModels(Nullable<int> year, string make) {
if (year.HasValue) {
this.DataService.GetVehicleModels(GetVehicleModelssCallback, year.Value, make);
public void GetVehicleMakes(Action<ObservableCollection<string>> callback, int year) {
_getVehicleMakesCallback = callback;
this.SearchServiceClient.GetVehicleMakesCompleted += OnGetVehicleMakesCompleted;
this.SearchServiceClient.GetVehicleMakesAsync(year);
}
<TextBox Name="vinTextBox"
Text="{Binding SelectedClaim.InsuredVIN, Mode=TwoWay}"
UpdateSourceTrigger=PropertyChanged}"
OnClaimPropertyChanged(object
switch (e.PropertyName) {
case "InsuredVIN":
ParseVIN();
void
sender, System.ComponentModel.PropertyChangedEventArgs e) {
break;
…
private void ParseVIN() {
Helpers.VinCarInfo carInfo = Helpers.VINParser.Parse(this.SelectedClaim.InsuredVIN);
this.SelectedClaim.InsuredYear = carInfo.Year;
this.SelectedClaim.InsuredMake = carInfo.Make;
this.SelectedClaim.InsuredModel = carInfo.Model;
…
public void GetVehicleMakes(Action<ObservableCollection<string>> callback, int year) {
_getVehicleMakesCallback = callback;
this.SearchServiceClient.GetVehicleMakesCompleted += OnGetVehicleMakesCompleted;
this.SearchServiceClient.GetVehicleMakesAsync(year);
Binding In Style Setters
Implicit DataTemplates
RelativeSource Ancestor Bindings
Databinding Debugging
Custom Markup Extensions
DataContextChanged Event
UpdateSourceTrigger
WCF RIA Services Enhancements
Text, Printing & Media
Complex
Types (SP1)
EF Code First
(coming soon)
MVVM
Support
Custom Client
Code Gen(SP1)
DateTimeOffset
Binding In Style Setters
Implicit DataTemplates
RelativeSource Ancestor Bindings
Databinding Debugging
Custom Markup Extensions
DataContextChanged Event
UpdateSourceTrigger
WCF RIA Services Enhancements
Text, Printing & Media
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque
habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vivamus enim dolor,
molestie at auctor id, auctor ultrices nisi. Curabitur urna lorem, luctus hendrerit dapibus quis, facilisis
sed orci. Aliquam nunc massa, placerat id pretium eget, luctus sit amet diam. Vestibulum ante ipsum
primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque fermentum neque at nisl
bibendum cursus. Aliquam sollicitudin elit eu nunc placerat et pulvinar mauris condimentum. Donec
sed sapien elit, vel condimentum justo. Cum sociis natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Ut ut odio nunc. Maecenas vitae quam urna. Nulla a ante imperdiet sem
tincidunt porta. Donec est tellus, imperdiet eget ullamcorper eu, laoreet vel lorem. Fusce ornare nisl
mollis lacus cursus semper suscipit urna ultricies.
Phasellus magna justo, commodo sodales auctor nec,
euismod vitae purus.
Vivamus dignissim feugiat tristique. Cras aliquet
sapien non justo sagittis imperdiet. In a velit mauris, eu
sodales magna. Fusce lectus lectus, blandit non semper
vitae, cursus ut purus. Vestibulum quis aliquam augue.
Morbi id est sed diam imperdiet pretium vitae a turpis.
Sed vel sapien arcu. Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Suspendisse ac diam ut ante
imperdiet lacinia. Integer sit amet justo sit amet tortor
<RichTextBox
OverflowContentTarget="{Binding ElementName=overflow1}">
<RichTextBoxOverflow x:Name="overflow1"
OverflowContentTarget="{Binding ElementName=overflow2}">
<RichTextBoxOverflow x:Name="overflow2"
OverflowContentTarget="{Binding ElementName=overflow3}">
...
facilisis id sit amet augue. Etiam in risus vel erat molestie viverra. Suspendisse pellentesque bibendum
sagittis. Etiam convallis leo at dui ornare eget elementum odio dictum. Integer tempus ultricies lectus.
Maecenas dictum ipsum id nisl adipiscing eu iaculis tortor suscipit. Etiam sed sapien neque, in ultricies
magna. Aliquam in nisl et lectus bibendum vestibulum. Donec suscipit, velit vitae convallis accumsan,
tortor magna dignissim purus, sed convallis orci tortor sed sem. Cras quis est id turpis congue porta.
Proin pharetra mattis nulla quis vestibulum.
Ut in sapien id mauris egestas rhoncus a eget erat.
Vivamus tempor tempus quam facilisis dapibus. Curabitur
volutpat ipsum vitae tortor tincidunt sed malesuada urna
tincidunt. Quisque porttitor, neque id malesuada faucibus,
quam leo auctor nisl, quis aliquet enim ligula ut odio.
Etiam vel turpis magna. Cras iaculis est sem. Pellentesque
malesuada, libero eu tempor tempor, tellus ipsum
dignissim sapien, id facilisis augue ipsum vitae quam. Cras
quis imperdiet leo. In orci purus, placerat ac ultricies in,
elementum vitae turpis. Nunc lectus sapien, sagittis id
luctus ut, hendrerit ut massa. Sed purus sapien, pharetra id
faucibus nec, semper id lacus. Phasellus et lectus leo, eget
adipiscing lorem. Donec fermentum lacus dolor. Etiam laoreet tristique nisi, sit amet convallis nunc
lacinia et. Integer aliquam, magna ac porttitor congue, est libero consectetur lacus, lobortis porta orci
risus nec magna. Integer sapien purus, volutpat sit amet vehicula vitae, accumsan a felis. Sed a nulla
vel enim laoreet consequat. Nulla ut neque massa, at semper enim.
risus nec magna. Integer sapien purus, volutpat sit amet vehicula vitae, accumsan a felis. Sed a nulla
vel enim laoreet consequat. Nulla ut neque massa, at semper enim.
Spool Time
Text
Shapes
Bitmap
Vector
0
100
200
300
400
500
600
700
800
(milliseconds)
File Size Sent to Printer
Text
Shapes
Bitmap
Vector
0
20
40
60
80
(MB)
100
120
140
DataContextChanged Event*
UpdateSourceTrigger*
Printing* & Media*
*coming post beta
Please provide us feedback on the beta!
http://forums.silverlight.net/
[email protected]
http://Blogs.MSDN.com/SteveLasker
http://silverlight.net/riaservices

similar documents