Wednesday 18 July 2007

WPF (Windows Presentation Foundation) Control Part 1

Here is the good property add in XAML where you can easily start spell checking your textboxes or rich text boxes. Its is really useful when you are creating any web or windows based application where user tye comments and I found it in one my application which is web based very useful to use this property have a look here:

<TextBox SpellCheck.IsEnabled="True" />


Just using this property you can enable the spell checking wow that is the new era. For details here is the small project for the beginner which helps them to start learning the use of WPF control and how to enable spell checking.

1- Open the XAMLBrowserApplication from your Visual Studio 2005.

Note: You can also open Windows base but the code I am providing here is for web based

2- At this point one file is important for us to create this project i.e. Page1.xaml that is the file we do coding for XAML and for the code behind we use Page1.xaml.cs.

3- Copy and paste the following code between <Grid></Grid> code and press F5.

<StackPanel Margin="20">

<StackPanel Orientation="Horizontal">

<TextBlock FontWeight="Bold" FontSize="12">Type any text belowTextBlock>

StackPanel>

<StackPanel Orientation="Horizontal">

<TextBox SpellCheck.IsEnabled="True" TextWrapping="Wrap" AcceptsReturn="True"

VerticalScrollBarVisibility="Visible" Width="400" Height="200" Text="Typee anthinge which spell rong" BorderBrush="Black" />

StackPanel>

StackPanel>

The output is look alike this:


To correct the spelling just right click of your mouse after placing cursor on word it will give you popup like below :



You can download the code from here.


Wednesday 11 July 2007

How to start working on WPF?

If you don’t have Visual Studio 2005 don’t worry here is the easy way to start working on WPF. Microsoft always offer some beginners tools to get it free to work on like if you like to work you can download Visual Studio Code name ‘Orcas’ Express Editions from here.
But if you are going through my tutorials you must need to go with Microsoft Visual C# Codename ‘Orcas’ Express Edition you can download it from
here.
After downloading this package install it but still you are not able to open project for WPF either for windows or Web to start creating WPF project follow the step from this
link. You need to download and install Visual C# component.
Hope you will enjoy working on WPF in C#.