WPF (AKA Avalon)

Sunday, May 28, 2006

Mue's WPF MusicPlayer

Hiho,

here is the latest version of my WPF MP3-Player ...

Tuesday, October 11, 2005

Get connected with other WPF developers

Hi, bonk and me made the experience that sometimes it is really helpful and/or fun to be able to ask or discuss things directly. For that reason bonk has set up an irc channel on efnet: #wpf - ready for you to join and discuss WPF. You will need an irc client (such as Klient, mIRC or HydraIRC) find a reliable irc server for EFNet (such as irc://irc.blessed.net:6667) and then join #wpf (type /join #wpf in your client) and you're all set.

Friday, October 07, 2005

Book: "Programming Windows Presentation Foundation" from Chris Sells and Ian Griffiths

It's more than two months now that I'm working with WPF and I did a lot with it. The book helps to get into programming WPF and moreover to understand mechanisms and programming model of WPF. The Chapter "Custom Controls" mentions many issues but a it is little bit too short. There could be some more practical examples (I know this is not the intension of that book and perhaps you can write a whole manuscript concerning Custom Controls). The book's structure
is concise which supports efficient work. This book is essential for both: WPF-Beginners in order to understand WPF and of course for more experienced WPF-Programmers in order to have an excellent reference compared to the WinFX Documentation.

Tuesday, September 27, 2005

Reuse a panel with help of a UserControl

This is better sample of how You can build a component like a panel for reuse purposes. The class UserControl offers a simple way to divide a page (like a dialog) or window into pieces. The programming model is analog to Window. In this case we benefit from the advantage that a UserControl can thus be used to build a composite control for reuse within your app in multiple places. A good example is the volume-panel from the last sample, again:

    1) Add an 'Avalon User Control' to your visual studio project
    2) Fill the FixedTemplate with your desired controls
    3) Add logic to the code-behind file of your control

To use this UserControl in your application add 'Mapping' to the XAML file i which you want to refer to your UserControl. Now place the new UserControl within a layout multiple times.

Monday, September 19, 2005

Reuse a panel with help of a template (XAML)

Here is a short sample which demonstrates how to build a panel for reuse purposes with a ContentTemplate (completely in XAML). Another way would be to code one XAML-file encapsulating the panel and refer to this panel when needed.
OK, now here's what I did:
 
<ControlTemplate x:Key="myContent">
<Border Margin="4" Padding="4"
HorizontalAlignment="Center"
BorderBrush="Silver"
BorderThickness="1"
CornerRadius="5">
<DockPanel HorizontalAlignment="Center">
<TextBlock HorizontalAlignment="Center"
DockPanel.Dock="Top" Text="DefaultText" />
<Button DockPanel.Dock="Top" Content="Check 1" />
<Button DockPanel.Dock="Top" Content="Check 2" />
<Button DockPanel.Dock="Top" Content="Check 3" />
<DockPanel DockPanel.Dock="Top" HorizontalAlignment="Center">
<Button DockPanel.Dock="Left" Content="On" />
<Button DockPanel.Dock="Right" Content="Off" />
</DockPanel>
<Slider Orientation="Vertical" DockPanel.Dock="Top"
HorizontalAlignment="Center" Height="100" />
<TextBlock HorizontalAlignment="Center" DockPanel.Dock="Top" Text="Line 1" />
<TextBlock HorizontalAlignment="Center" DockPanel.Dock="Top" Text="Line 2" />
<TextBlock HorizontalAlignment="Center" DockPanel.Dock="Top" Text="Line 3" />
<Button DockPanel.Dock="Top" Content="Normalize" />
<Button DockPanel.Dock="Top" Content="Invert" />
<Button DockPanel.Dock="Top" Content="Print" />
<Slider Orientation="Horizontal" Value="5" Minimum="0" Maximum="10" />
</DockPanel>
</Border>
</ControlTemplate>

After defining this template (could be anything e.g. a mixer bar) in the Resources of the Window one can use it several times:

<DockPanel LastChildFill="False">
<ContentControl Template="{StaticResource myContent}" />
<ContentControl Template="{StaticResource myContent}" />
<ContentControl Template="{StaticResource myContent}" />
<ContentControl Template="{StaticResource myContent}" />
<ContentControl Template="{StaticResource myContent}" />
</DockPanel>