Silverlight newbie here, trying to do a simple databinding:
Im trying to get a list of all users in a test db, but i cant;
Im using Openaccess and followed all tutorials on how to create a Domain Model, then a Domain Service;
Im having problems executing the following code, which returns always 0 even though i have 200 lines on db:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ServiceModel.DomainServices.Client;
using SLTest.Web;
namespace SLTest {
public partial class MainPage : UserControl {
private TestDomainContext link = new TestDomainContext();
public MainPage() {
InitializeComponent();
Loaded += new RoutedEventHandler(MainPage_Loaded);
}
private void MainPage_Loaded(object sender, RoutedEventArgs e) {
int count = 0;
LoadOperation<DomainUser> loadOperation = link.Load(link.GetDomainUsersQuery());
loadOperation.Completed += (s, a) =>{
theList.ItemsSource = link.DomainUsers;
count = link.DomainUsers.Count();
};
}
}
}
Also, why is that simply doing
int count = link.DomainUsers.Count();
doesnt work as it does in ASP.NET?
Here is the XAML:
<UserControl x:Class="SLTest.MainPage"
xmlns="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:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="theGrid">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<ListBox Grid.Row="0" Grid.Column="0" x:Name="theList">
<DataTemplate>
<TextBlock Text="{Binding FullName}"></TextBlock>
</DataTemplate>
</ListBox>
</Grid>
</UserControl>
I am guessing that the link object is your actual domain service and as such you should not be addressing it directly in the callback method as all query operations in your service are asynchronous and will not yield any result of addressed that way.
Instead you can use the asynchronous callback methods arguments to get the information you are requesting like that:
loadOperation.Completed += (s, a) =>
{
LoadOperation<DomainUser> loadedObjects = (LoadOperation<DomainUser>)s;
theList = loadedObjects.Entities;
count = loadedObjects.Entities.Count();
};
That should work.
Related
I ran into situation when some MessageBoxes with error messages were not displayed at all. After closer investigation, I was able to narrow down the problem to cases when a very long string is passed as messageBoxText.
In such cases, call MessageBox.Show does not display anything, returns MessageBoxResult.No and, in most cases, there's a message in the Output window saying The thread 0xHEXNUMBER has exited with code 0 (0x0). For me, this method silently fails.
This is very strange - WPF is a very mature technology and I expect this code to work according to spec or throw some exception (e.g. OutOfMemory, StackOverflowException). I've debugged the program and no manged or unmanged exceptions are thrown and caught.
What is the root cause of MessageBox not being displayed? Is there some easy way to debug such things (since no exceptions are thrown or logged). What is the messageBoxText length limit and what does it depend on (I could check that empirically on my computer, but would be conclusive for one OS/platform/.NET Framework version at best)?
Repro:
Here's a code which demonstrates the problem (it can be used with standard WPF Application template in Visual Studio).
MainWindow.xaml:
<Window x:Class="LongMessageInMessageBox.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button Grid.Row="0" Grid.Column="0" Click="ShortMessage_Clicked">Short Message</Button>
<Button Grid.Row="1" Grid.Column="0" Click="LongMessage_Clicked">Long Message</Button>
</Grid>
MainWindow.xaml.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace LongMessageInMessageBox
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
/// Method which shows that displaying short message works correctly
private void ShortMessage_Clicked(object sender, RoutedEventArgs e)
{
Console.WriteLine("ShortMessage_Clicked");
var result = MessageBox.Show("Short Message");
Console.WriteLine(result);
}
/// Method which shows that displaying a long message does not work
private void LongMessage_Clicked(object sender, RoutedEventArgs e)
{
Console.WriteLine("LongMessage_Clicked");
var longTextBuilder = new System.Text.StringBuilder(10000);
longTextBuilder.Append("Long Message \n");
for (int i = 1; i <= 100000; i++)
{
longTextBuilder.Append(" ").Append(i);
}
var result = MessageBox.Show(longTextBuilder.ToString());
Console.WriteLine(result);
}
}
}
Sample from Output window:
ShortMessage_Clicked
OK
ShortMessage_Clicked
OK
LongMessage_Clicked
No
The thread 0x55bc has exited with code 0 (0x0).
MessageBox class in WPF (and WinForms) wraps the Win32 MessageBox function, and doesn't throw an exception. In the old Win32 world error is reported by setting the last-error code, and if you don’t call GetLastError to check, you can just keep going without knowing something is broken.
From Reference Source
//so it just translates the return code to a MessageBoxResult
MessageBoxResult result = Win32ToMessageBoxResult (UnsafeNativeMethods.MessageBox (new HandleRef (null, owner), messageBoxText, caption, style));
I have not tested the capacity of the lpText string in the Win32 MessageBox function. But it is not surprising if the capacity limit is something like 1024, 4096 or 65536, after all, MessageBox function is designed to display short message.
I wrote a pretty simple WPF application.
I'm trying to bind a double property to text box text using a custom string format. Here is the code for view model and the code for window.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace StringFormat
{
internal class ViewModel : INotifyPropertyChanged
{
public ViewModel()
{
DoubleProperty = 0;
}
private double _doubleProperty;
public double DoubleProperty
{
get { return _doubleProperty; }
set
{
_doubleProperty = value;
NotifyPropertyChanged();
}
}
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}
<Window x:Class="StringFormat.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:StringFormat"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Row="0"
Grid.Column="0"
Width="120"
Height="25"
TextAlignment="Center"
Text="{Binding DoubleProperty, StringFormat={}{##.##}, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</Window>
namespace StringFormat
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DataContext = new ViewModel();
}
}
}
When I run the application it works but I get the following error in console:
System.Windows.Data Error: 6 : 'StringFormat' converter failed to convert value '0' (type 'Double'); fallback value will be used, if available. BindingExpression:Path=DoubleProperty; DataItem='ViewModel' (HashCode=486165); target element is 'TextBox' (Name=''); target property is 'Text' (type 'String') FormatException:'System.FormatException: Input string was not in a correct format.
at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
at System.String.Format(IFormatProvider provider, String format, Object[] args)
at System.Windows.Data.BindingExpression.ConvertHelper(IValueConverter converter, Object value, Type targetType, Object parameter, CultureInfo culture)'
I tried to change the string format and the error did not showed up but I think that is a little annoying to have a '0.0' when you try to delete the content of text box.
I don't know what to do in order to solve the error but also to be able to delete text box text without having that '0.0'.
Can you give me some advice how to deal with this situation?
Thanks!
try this
StringFormat={}{0:#.##}
you forgot 0: in your second curly braces couple
Then to not have "0.0" if textbox.Text is null or empty (i.e. if you delete it) you may try this:
Text="{Binding DoubleProperty, TargetNullValue={x:Static System:String.Empty}, StringFormat={}{0:##.##}, UpdateSourceTrigger=PropertyChanged}"
TargetNullValue={x:Static System:String.Empty} will set the default string value to empty if TextBox.Text = null.
But you may need to set your DoubleProperty nullable.
Note -- You may read this, it help me for lots of wpf question: wpf-tutorial.com
Try StringFormat=##.## then the Text is empty if the value is 0.0
I have used WPF to develop two moderately sized applications. I was much impressed by the cleanness of WPF and its features. When I explained to one of my colleagues (Who happens to develop business apps) the various benefits of WPF, he challenged me with this problem which had me totally stumped:
The Problem:
He coded an application in the following way in about 2 minutes:
Open a new WinForms project.
Define a class Loan.
Build project.
Define an object data source using Loan.
In Data Sources explorer, change view type of the Loan data source to Details.
Drag the data source onto the Form in the designer.
Supply the data source with a Loan[] containing one object.
Build and run application.
The code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WinForms_DataBinding_Example
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
loanBindingSource.DataSource = new Loan[] { new Loan() };
}
}
public class Loan
{
public decimal Amount { get; set; }
public decimal Rate { get; set; }
public decimal Total { get { return Amount * Rate; } }
}
}
The designer:
The application:
Now whenever you change the value of Amount or Rate in the window, the value of Total changes accordingly. After explaining that this is a very useful feature in business apps where any changes you make to one property in an entity immediately updates the view where calculated properties are refreshed instantly making the user experience better. Considering that the typical business entity class has a lot of properties, this saves a lot of coding. Then he asked me to do the same in WPF.
I first explained to him that I do not understand what sort of black magic goes on here. How does the Total textbox update itself automatically? This is my first question:
Q1. The Loan class does not implement INotifyPropertyChanged or something similar. So how does the Total textbox get updated when the Amount or Rate textboxes lose focus?
Then I told him that I do not know how to do the same thing so easily in WPF. However, I wrote the same app in WPF with 3 TextBlocks and 3 TextBoxs in the UI. I also needed to make Loan class implement INotifyPropertyChanged. Added backing fields to Amount and Rate. Whenever these properties were being set, I raised a property changed notification for the property Total. In the end, I was left with an app with badly aligned controls which did the same thing as the WinForms app. However, this was way harder to do than the WinForms method.
I came home and then had the bright idea of drag-dropping the Loan data source on to the WPF window (After I changed the view mode to detail). Sure enough, I got the same kind of UI as in WinForms app and after setting the data source to the same Loan[] as in WinForms app, it seemed to be complete. I ran the app, changed the Amount and Rate fields hoping to see Total change itself automagically. However, I was disappointed. The Total field did not change:
The code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WinForms_DataBinding_Example;
namespace WPF_Grid_Example
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Window_Loaded_1(object sender, RoutedEventArgs e)
{
System.Windows.Data.CollectionViewSource loanViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("loanViewSource")));
// Load data by setting the CollectionViewSource.Source property:
loanViewSource.Source = new List<Loan>() { new Loan() };
}
}
}
The xaml:
<Window
xmlns="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:WinForms_DataBinding_Example="clr-namespace:WinForms_DataBinding_Example;assembly=WinForms_DataBinding_Example" mc:Ignorable="d" x:Class="WPF_Grid_Example.MainWindow"
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded_1">
<Window.Resources>
<CollectionViewSource x:Key="loanViewSource" d:DesignSource="{d:DesignInstance {x:Type WinForms_DataBinding_Example:Loan}, CreateList=True}"/>
</Window.Resources>
<Grid>
<Grid x:Name="grid1" DataContext="{StaticResource loanViewSource}" HorizontalAlignment="Left" Margin="121,123,0,0" VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Content="Amount:" Grid.Column="0" HorizontalAlignment="Left" Margin="3" Grid.Row="0" VerticalAlignment="Center"/>
<TextBox x:Name="amountTextBox" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="3" Grid.Row="0" Text="{Binding Amount, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="120"/>
<Label Content="Rate:" Grid.Column="0" HorizontalAlignment="Left" Margin="3" Grid.Row="1" VerticalAlignment="Center"/>
<TextBox x:Name="rateTextBox" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="3" Grid.Row="1" Text="{Binding Rate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="120"/>
<Label Content="Total:" Grid.Column="0" HorizontalAlignment="Left" Margin="3" Grid.Row="2" VerticalAlignment="Center"/>
<TextBox x:Name="totalTextBox" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="3" Grid.Row="2" Text="{Binding Total, Mode=OneWay}" VerticalAlignment="Center" Width="120"/>
</Grid>
</Grid>
</Window>
Q2. I was confounded before by the black magic of WinForms, I was confounded now because the same black magic did not work in WPF. Why?
Q3. How do I make the WPF version to update the Total field automatically as in the WinForms example?
Q4. Which platform is better/faster for this sort of business app development? If I am to make a better argument on behalf of WPF, what should I be looking at?
I hope I was clear about the problem. Please let me know if any clarifications are needed. Thanks.
Q1: If you look at the designer file for the Windows Form you'll see about 300 lines of code generated for your 3 textboxes. Some of this code is similar to:
this.amountTextBox.DataBindings.Add(
new System.Windows.Forms.Binding("Text",
this.loanBindingSource, "Amount", true));
The Binding and the BindingSource co-operate to update the bound values and cause all bound controls to be updated every time one of the values changes (using reflection).
Q2: Because the WPF designer doesn't create a .Designer.cs file and the associated mess of code. You need to explicitly implement INotifyPropertyChange, which can be simplified by using say MVVM Light's ViewModelBase, e.g.
public class Loan : ViewModelBase
{
public decimal Amount
{
get
{
return this.amount;
}
set
{
if (Set(() => Amount, ref this.amount, value))
{
RaisePropertyChanged(() => Total);
}
}
}
Q3:
1) When Amount or Rate changes raise the property change notification for that property but also for the computed property 'Total'.
2) Modify your bindings on Amount and Rate to Binding="{Binding Amount, UpdateSourceTrigger=LostFocus}"
Q4: WPF no question (IMHO). The WPF way is more testable and maintainable and understandable.
Answer to Q4:
Regardless of winforms having the ability to generate 3 silly textboxes for a class, WPF is a much better, scalable and powerful framework. It has much greater performance due to hardware acceleration and whatnot, and requires less or no code to do some tasks that take tons of code in winforms, such as this, or this:
<CheckBox x:Name="chk"/>
<TextBox IsEnabled="{Binding IsChecked,ElementName=chk}"/>
Also, tipical Line-of-Business applications have to deal with thousands or hundreds of thousands of records, and UI Virtualization makes a huge difference.
The bottom line is that winforms, regardless of having some designer goodies (which are more a feature of Visual Studio than winforms itself), is nowhere near as practical and adequate when it comes to Line of Business.
I have been scratching my head for a bit and I'm sure this is a obvious one but I just can't see it.
I made a new application "WpfApplication3"
I add a class "Person.cs":
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WpfApplication3
{
public class Person
{
public string Name { get { return "Jonas"; } }
}
}
And then I try this:
<Window x:Class="WpfApplication3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication3"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.Resources>
<local:Person x:Key="somePerson"/>
</Grid.Resources>
<!--<TextBlock Text="{Binding {StaticResource somePerson.Name}}"/>-->
</Grid>
</Window>
And I get the error "The name "Person" does not exist in the namespace "clr-namespace:WpfApplication".
What am I doing wrong?
Using VS Express 2012 for windows desktop (trial).
This seems strange but I tested and sure enough it would not find Person.
Then I added a public ctor to Person
public class Person
{
public Person() { }
}
And it would compile
Now I can remove the ctor and it will (still) compile
Try (multiple) clean and rebuild
I know makes no sense but it happened to me
How can I reference the same object twice (or more often) in a XAML design data file?
I tried to use {x:Reference}, but this does not seem to work.
Here is an example:
The combo box in the cells of the second column of the sample's data grid displays a list of "data types". The list of available data types comes from the Types property of the main window's view model (= the data context). The list of items in the grid comes from the Items property of the view model. Each item has a Name and a Type column, where Type references a data type object.
The sample grid looks like this:
Here is the XAML design data which should show the same grid contents in the Visual Studio designer (but it doesn't):
<?xml version="1.0" encoding="utf-8" ?>
<local:MainWindowViewModel
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DataGridSample"
>
<local:MainWindowViewModel.Types>
<local:DataType Name="String" x:Name="String"/>
<local:DataType Name="Integer" x:Name="Integer"/>
</local:MainWindowViewModel.Types>
<local:MainWindowViewModel.Items>
<local:Item Name="Lorem" Type="{x:Reference String}"/>
<local:Item Name="Ipsum" Type="{x:Reference Integer}"/>
</local:MainWindowViewModel.Items>
</local:MainWindowViewModel>
Above, I am using {x:Reference String} to obtain a reference to the object that was created by <local:DataType Name="String" x:Name="String"/>.
In the Visual Studio designer, the list is empty, and the error message "Errors found in markup: ... DesignData.xaml" is displayed. In the editor for the design data XAML files, I get the error message "Service provider is missing the INameResolver service".
Is there any alternative to {x:Reference} which I could use in design data files to refer to an object?
For completeness, here are the remaining files of my sample:
MainWindow.xaml:
<Window x:Class="DataGridSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
Title="Sample" Height="300" Width="400"
d:DataContext="{d:DesignData Source=DesignData.xaml}">
<Window.Resources>
<CollectionViewSource x:Key="types" Source="{Binding Types}"/>
</Window.Resources>
<Grid>
<DataGrid ItemsSource="{Binding Items}" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Name}" Header="Name" Width="*"/>
<DataGridComboBoxColumn SelectedItemBinding="{Binding Type}"
ItemsSource="{Binding Source={StaticResource types}}"
DisplayMemberPath="Name"
Header="Type" Width="*"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Window>
MainWindow.xaml.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace DataGridSample
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
readonly MainWindowViewModel _viewModel = new MainWindowViewModel();
public MainWindow()
{
InitializeComponent();
DataContext = _viewModel;
}
}
}
MainWindowViewModel.cs:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
namespace DataGridSample
{
public class MainWindowViewModel
{
private readonly ObservableCollection<DataType> _dataTypes;
private readonly ObservableCollection<Item> _items;
public MainWindowViewModel()
{
DataType typeString = new DataType {Name = "String"};
DataType typeInteger = new DataType {Name = "Integer"};
_dataTypes = new ObservableCollection<DataType> {typeString, typeInteger};
_items = new ObservableCollection<Item>
{
new Item {Name = "Lorem", Type = typeString},
new Item {Name = "Ipsum", Type = typeInteger}
};
}
public ObservableCollection<DataType> Types
{
get
{
return _dataTypes;
}
}
public ObservableCollection<Item> Items
{
get
{
return _items;
}
}
}
public class DataType
{
public string Name { get; set; }
}
public class Item
{
public string Name { get; set; }
public DataType Type { get; set; }
}
}
Background on why x:Reference doesn't work .....
x:Reference is a XAML 2009 feature.
You can't use x:Reference in XAML markup that is compiled according to the MSDN docs.
http://msdn.microsoft.com/en-us/library/ee795380.aspx
It's designed for loose XAML...e.g. if you create a XAML Page (.xaml) and load it via Internet Explorer.
When you use DesignData the Designer effectively creates and compiles a new class whose shape and content is as described in your DesignData file.
There's no support for it in Visual Studio/Blend Designers.
http://www.infoq.com/news/2009/12/XAML-2009-Future
Here's a counter argument.
Here is the explanation from Adam Nathan's WPF 4 unleashed book: "The
x:Reference markup extension is often mistakenly associated with the
XAML2009 features that can only be used from loose XAML at the time
of this writing. Although x:Reference is a new feature in WPF 4, it
can be used from XAML2006 just fine as long as your project is
targeting version 4 or later of the .NET Framework. One glitch is
that the XAML designer in Visual Studio 2010 doesn�t properly handle
x:Reference, so it gives the following design-time error that you can
safely ignore: Service provider is missing the INameResolver service"
http://wpftutorial.net/XAML2009.html
Workaround solution ...