Click here to Skip to main content
15,884,099 members
Articles / Desktop Programming / WPF

Caliburn - Modules, Windows, and Actions

Rate me:
Please Sign up or sign in to vote.
5.00/5 (12 votes)
10 Mar 2010CPOL6 min read 50.6K   1.1K   49  
This article demonstrates breaking out of the shell with module development and using Caliburn actions.
<Window x:Class="emx.tcp.caliburn.loading.shell.Views.ShellView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:cal="http://www.caliburnproject.org"
    xmlns:shared.actions="clr-namespace:emx.tcp.caliburn.loading.shared.Actions;assembly=emx.tcp.caliburn.loading.shared"
    xmlns:Controls="clr-namespace:Caliburn.WPF.ApplicationFramework.Controls;assembly=Caliburn.WPF.ApplicationFramework"
    Title="ShellView" Height="432" Width="304">
    <DockPanel>
        <Grid>
            <StackPanel x:Name="LayoutRoot">
                <DockPanel LastChildFill="True">
                    <Label 
                        DockPanel.Dock="Left"
                        Content="Target of Module: "/>
                    <ComboBox 
                        x:Name="HostComboBox" 
                        DockPanel.Dock="Right"
                        SelectedIndex="0">
                        <ComboBoxItem>In a Window</ComboBoxItem>
                        <ComboBoxItem>Embedded here</ComboBoxItem>
                    </ComboBox>
                </DockPanel>
                <Button 
                    cal:Message.Attach="ShowModuleA(HostComboBox.SelectedIndex)"
                    Content="Module A - Persons"/>
                <Button 
                    cal:Message.Attach="ShowModuleB(HostComboBox.SelectedIndex)"
                    Content="Module B - Tasks"/>
                <TextBlock Text="{Binding CurrentPresenter.DisplayName}"
                       HorizontalAlignment="Center"
                       FontSize="18"
                       Foreground="CornflowerBlue"
                       Margin="5" />
                <Controls:TransitionPresenter x:Name="CurrentPresenter">
                    <cal:Action.TargetWithoutContext >
                        <shared.actions:CRUDAction />
                    </cal:Action.TargetWithoutContext >
                </Controls:TransitionPresenter>
            </StackPanel>
        </Grid>
    </DockPanel>
</Window>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Encore Software
Australia Australia
Contractor in Desktop and Web applications.
Gold Coast, Queensland.

Comments and Discussions