Some photos from the Pulau Ubin trip.
Tuesday, March 30, 2010
Saturday, March 27, 2010
Vibram Five Fingers Repair
When we went for Pulau Ubin this Chinese New Year and went biking, I got my Vibram Five Fingers ripped (a little). Here are photos of the repair job. I didn't have black thread so just used white.
Labels:
Chinese New Year,
Pulau Ubin,
repair,
Vibram Five Fingers
Saturday, March 20, 2010
WPF Data Binding
Here is an introduction to WPF Data Binding. So whip up your Visual Studio 2008 or in my case I installed the Visual Studio 2010 beta, available free from this Microsoft website. After that, go and create a new WPF application which will include all the files we need for this tutorial. Open the xaml file for the window (in VS2008 its Window1.xaml and in VS2010 its MainWindow.xaml) then you should see xaml code similar to the one below:
So, as another example, we have another
If compile and run the project you should see a window similar to this:
This example also shows us that we can have anonymous objects in the case of the
There you have it a very simple introduction to Binding in WPF. Solution files can be downloaded here
<Window x:Class="CM001_WpfDataBinding.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">
<StackPanel>
<StackPanel>
<TextBlock Text="{Binding ElementName=txtInput, Path=Text}" Margin="2.5" />
<TextBox x:Name="txtInput" Margin="2.5"/>
</StackPanel>
<StackPanel >
<TextBlock Text="{Binding ElementName=sldInput, Path=Value}" Margin="2.5"/>
<Slider x:Name="sldInput" Margin="2.5"/>
</StackPanel>
</StackPanel>
</Window>
The object tags we need to focus on are first the <TextBlock> and <TextBox> tags. A TextBlock, as the name implies, is a block of text. In this case, we set the Text property to be bound to the Text property of the txtInput object which is our TextBox. This means that anything we type into out txtInput TextBox will also change the value in the said TextBlock. All these happens because of the magic of Data Binding.So, as another example, we have another
TextBlock object this time with a slider. We again bind the Text property of the TextBlock to the Value property of the sldInput Slider object. Therefore, whenever we move the sldInput's slider to a different position it will prompt a change in the Text property of the TextBlock we are bound to.If compile and run the project you should see a window similar to this:
This example also shows us that we can have anonymous objects in the case of the
StackPanels and the TextBlocks we used.There you have it a very simple introduction to Binding in WPF. Solution files can be downloaded here
Subscribe to:
Posts (Atom)
