Tag: wpf
Useful information on data binding in wpf
This is a set of useful information on data binding in wpf:
http://interactiveasp.net/blogs/natesstuff/archive/2009/01/21/6-things-i-bet-you-didn-t-know-about-data-binding-in-wpf.aspx
One of the very useful items is the list of fallback bindings (so you can bind to A if it is present else B &c) that makes for very flexible components.
WPF Tutorial
Here is a useful wpf tutorial.
WPF Funny Shaped Windows
Here is an article on creating custom windows shapes in wpf.
WPF Tooltips
Here is an example of how to create a markup extension to ease the addition of tooltips to a wpf application.
However this can be done just as easily via a resource entry!
Binding visibility of an element to a bool in WPF
Introducing WPF Zen Garden
The CSS world has Css Zen Garden as a showcase for what can be done with stylesheets.
I could not find an equivalent for wpf so I have set one up:
Adding WPF and WCF to VS2005
They have a tendancy to ignore possible futures and always test for exact current versions.
This is the case when you try and add the WPF and WCF addons to VS2005.
Here is an article on how to make it work once you have installed service pack 1 for .NET 3.0
The idiot who wrote the installer tested for the presense of the uninstall option for the initial version of .NET 3.0, ignoring the possibility of a service pack.
This is not the first time I have seen a microsoft installer perform this stupidity.
Back in the day I learnt a lot about the registry configuration for COM objects the hard way.
The 16 bit version of VB installed a common library. Subsequently this library had a 32 bit version released too.
If you installed the 16 bit version over the 32 bit one it clobbered the registry sufficiently to break the later version.
Rather inconsiderately the application suite that I was assisting used both versions…
I had to write a patch utility to correct this problem. COM always had a technique for handling this kind of versioning problem but it was clear that whoever wrote the installer did not understand this.
Improved wpf demo
I need to attribute this site for giving me hints to go in the right direction.
import System
import System.Windows
import System.Windows.Controls
import System.Windows.Navigation
class Exer1(NavigationWindow):
para as TextBlock
button as Button
def constructor():
para = TextBlock(Text:”Hello World!!!”, FontSize:36)
para.VerticalAlignment = VerticalAlignment.Center
para.HorizontalAlignment =HorizontalAlignment.Center
# create a button
//<![CDATA[
//]]>
button = Button(Content:”Click Me”, Height:30, Width:100)
# display the textblock when the button is clicked
button.Click += NavButtonClick
# display the button first
Navigate(button)
protected def NavButtonClick(sender as object, e as RoutedEventArgs):
Navigate(para)
[STAThread]
def Main():
app = Application()
Exer1().Show()
app.Run()
Boo and WPF
I am not claiming that it is origonal since it was cribbed from someone elses site.
However this version is not broken and does have a build script.
The following is wpdemo.boo:
namespace Boo.WinFx
import System
import System.Windows
import System.Windows.Controls
import System.Windows.Navigation
[STAThread]
def Main():
# create a window host
win = NavigationWindow()
# create a textblock
para = TextBlock(Text:”Hello World!!!”, FontSize:36)
para.VerticalAlignment = VerticalAlignment.Center
para.HorizontalAlignment =HorizontalAlignment.Center
# create a button
button = Button(Content:”Click Me”, Height:30, Width:100)
# display the textblock when the button is clicked
button.Click += { win.Navigate(para) }
# display the button first
win.Navigate(button)
# create an application host
app = Application()
# show the window
win.Show()
# fire the application
app.Run()
The following is default.build:
<?xml version=”1.0″ ?>
<project name=”wpfdemo” default=”build”>
<property name=”boo.dir” value=”C:/boo/bin” />
<target name=”build” depends=”wpfdemo” />
<target name=”wpfdemo”>
<loadtasks assembly=”${boo.dir}/Boo.NAnt.Tasks.dll” />
<booc output=”wpfdemo.exe” target=”winexe”>
<references>
<include name=”C:/Program Files/Reference Assemblies/Microsoft/Framework/v3.0/*.dll” />
</references>
<sources>
<include name=”wpfdemo.boo” />
</sources>
</booc>
</target>
</project>