This sample creates a product listing application that allows users to enter items for sale. This sample demonstrates the following data binding concepts:
The binding object
Data context
Data templates
Property change notifications
Validation
Conversion
Data triggers
Multibinding
Binding to sub-properties
Master-Detail paradigm
Collection view source
Grouping
Sorting
Filtering
This sample demonstrates a specific feature of the Windows Presentation Foundation (WPF) and, consequently, does not follow application development best practices. For comprehensive coverage of Windows Presentation Foundation (WPF) and Microsoft .NET Framework application development best practices, refer to the following as appropriate:
Accessibility - Accessibility Best Practices
Security - Windows Presentation Foundation Security
Localization - WPF Globalization and Localization Overview
Download sample
Install the Windows Software Development Kit (SDK) and open its build environment command window. On the Start menu, point to All Programs, Microsoft Windows SDK, and then click CMD Shell.
Download the sample, usually from the software development kit (SDK) documentation, to your hard disk drive.
To build the sample from the build environment command window, go to the source directory of the sample. At the command prompt, type MSBUILD.
To build the sample in Microsoft Visual Studio, load the sample solution or project file and then press CTRL+SHIFT+B.
To run the compiled sample from the build environment command window, execute the .exe file in the Bin\Debug or Bin\Release folder contained under the sample source code folder.
To run the compiled sample with debugging in Visual Studio, press F5.
<ComboBox.IsEnabled><MultiBindingConverter="{StaticResource specialFeaturesConverter}"><Binding Path="CurrentUser.Rating"Source="{x:Static Application.Current}"/><Binding Path="CurrentUser.MemberSince" Source="{x:Static Application.Current}"/></MultiBinding></ComboBox.IsEnabled>This is at the 4th point of exercise 1.
In SpecialFeaturesConverter.cs, update the following two lines of code -
Line 13 - int rating = values[0] is int? (int)values[0] : 0;Line 14 - DateTime date = values[1] is DateTime ? (DateTime)values[1] : new DateTime(1900, 1, 1);
dmcgloin: You will no longer see the errorCheers,indyfromoz
Such a shame MS are not consistent and provide code in both vb and c# for all their examples, it's proving very diffucult to follw when they mix and match so much omitting vb half way through an example
[tfl - 22 02 09] You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the
MSDN Newsgroups at http://www.microsoft.com/communities/newsgroups/en-us/.d You are much more likely get a quick
response using the forums than through the Community Content.For specific help about:Visual Studio : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C&.NET Framework : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.frameworkAll Public : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public%2C&
int rating; //declare rating Dim rating
if(values[0] is int){rating = values[0];// no need to do cast because check passes}else{rating = 0;}
DateTime date; //Dim DateTime
if(values[1] is DateTime){date = values[1];no need to do cast because check passes}else{date = new DateTime(1900,1,1);}
This should be fairly straightforward to convert to VB.NET. Hope that helps.
Class SpecialFeaturesConverter...If