Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Mole II for WPF

, , , 31 Dec 2007 CPOL
Introduces the second version of a very useful and educational debugger visualizer for WPF developers.
mole_visualizer_2_1_1_packages.zip
Mole_Visualizer_2_1_1_VS2008_SourceAndTestProject.zip
Mole_Visualizer_2_1_1_VS2005_SourceAndTestProject.zip
Mole_Visualizer_2_1_1_VS2005_Release.zip
Mole_Visualizer_2_1_1_VS2008_Release.zip
mole_visualizer_2_1_1_vs2005_release.zip
Mole.Visualizer.dll
mole_visualizer_2_1_1_vs2005_sourceandtestproject.zip
Mole.Visualizer
Custom Controls
Data Source
Image Processing
Data
Debugger Visualizer
Enums Constants
Event Args
Extended Controls
Images
MoleVisualUnavailable.gif
Mole.Visualizer.csi
Mole.Visualizer.suo
Mole.Visualizer.vbproj.user
My Project
Application.myapp
Settings.settings
Settings
Visualizer UI
XSLT
Mole.TestBench
bach.jpg
Mole.TestBench.csi
Mole.TestBench.suo
My Project
Settings.settings
mole_visualizer_2_1_1_vs2008_release.zip
Mole.Visualizer.dll
mole_visualizer_2_1_1_vs2008_sourceandtestproject.zip
bach.jpg
Mole.TestBench.csi
Mole.TestBench.suo
Settings.settings
MoleVisualUnavailable.gif
Mole.Visualizer.csi
Mole.Visualizer.suo
Mole.Visualizer.vbproj.user
Application.myapp
Settings.settings
mole_visualizer_2_1_vs2005_release.zip
Mole.Visualizer.dll
mole_visualizer_2_1_vs2005_sourceandtestproject.zip
MoleVisualUnavailable.gif
Mole.Visualizer.csi
Mole.Visualizer.suo
Mole.Visualizer.vbproj.user
Application.myapp
Settings.settings
bach.jpg
Mole.TestBench.csi
Mole.TestBench.suo
Settings.settings
mole_visualizer_2_1_vs2008_release.zip
Mole.Visualizer.dll
mole_visualizer_2_1_vs2008_sourceandtestproject.zip
MoleVisualUnavailable.gif
Mole.Visualizer.csi
Mole.Visualizer.suo
Mole.Visualizer.vbproj.user
Application.myapp
Settings.settings
bach.jpg
Mole.TestBench.csi
Mole.TestBench.suo
Settings.settings
mole_visualizer_vs2005_release.zip
Mole.Visualizer.dll
mole_visualizer_vs2005_sourceandtestproject.zip
MoleVisualUnavailable.gif
Mole.Visualizer.csi
Mole.Visualizer.suo
Mole.Visualizer.vbproj.user
Application.myapp
Settings.settings
bach.jpg
Mole.TestBench.csi
Mole.TestBench.suo
Settings.settings
mole_visualizer_vs2008_release.zip
Mole.Visualizer.dll
mole_visualizer_vs2008_sourceandtestproject.zip
MoleVisualUnavailable.gif
Mole.Visualizer.csi
Mole.Visualizer.suo
Mole.Visualizer.vbproj.user
Application.myapp
Settings.settings
bach.jpg
Mole.TestBench.csi
Mole.TestBench.suo
Settings.settings
<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2006"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    x:Class="MoleTestBench"
    Title="Mole II TestBench" Width="600" Height="575"
    WindowStartupLocation="CenterScreen"
    >
    <DockPanel Margin="10">
        <TextBlock
            DockPanel.Dock="Top"
            FontWeight="DemiBold"
            TextWrapping="WrapWithOverflow"
            Height="Auto"
            VerticalAlignment="Top"
            >
            1. Go into MoleTestBench.xaml.vb and put a breakpoint in the event handler.
            <LineBreak/>
            <LineBreak/>
            2. Then hold Ctrl and click on any element to hit the breakpoint.
            <LineBreak/>
        </TextBlock>

        <TabControl x:Name="mainTabControl">

            <!-- HETEROGENOUS LISTBOX -->
            <TabItem Header="Heterogenous ListBox">
                <ListBox>
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <!-- Use a non-virtualizing StackPanel so that all the visuals for every item are created. -->
                            <StackPanel IsItemsHost="True" />
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                    <ListBoxItem>
                        <TextBlock>
                            <Run Background="#FFBBFFBF">I am a Run, but a Run is not in the visual tree.</Run>
                        </TextBlock>
                    </ListBoxItem>
                    <ListBoxItem Content="SteelBlue"/>
                    <ListBoxItem Content="Gray (Mole's New MoleTone)"/>
                    <CheckBox x:Name="mrBlisterTwister" Content="Boo!"/>
                    <Image Source="bach.jpg" Width="50" Height="50" />
                    <System:String xml:space="preserve">This Is Just Text</System:String>
                    <System:Int32>1254</System:Int32>
                    <System:Int32>69874</System:Int32>
                    <System:Int32>36587</System:Int32>
                    <System:String xml:space="preserve">Select Mole!</System:String>
                    <CheckBox x:Name="cbDoYouMolenate" Content="Do you Molenate?" IsChecked="True" />
                </ListBox>
            </TabItem>

            <!-- HOMOGENOUS LISTVIEW -->
            <TabItem Header="Homogenous ListView">
                <ListView x:Name="listView" ItemsSource="{Binding}">
                    <ListView.View>
                        <GridView>
                            <GridViewColumn Header="Composer Name" DisplayMemberBinding="{Binding Name}" />
                            <GridViewColumn Header="Era" DisplayMemberBinding="{Binding Era}" />
                            <GridViewColumn Header="More Info">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock>
                                            <Hyperlink NavigateUri="{Binding WikipediaUri}">
                                                Learn more
                                            </Hyperlink>
                                        </TextBlock>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView>
                    </ListView.View>
                </ListView>
            </TabItem>

            <!-- COMMON CONTROLS -->
            <TabItem Header="Common Controls">
                <StackPanel>
                    <Button Height="Auto" Content="Hello, I am a Button" Margin="0,10,0,0" VerticalAlignment="Top" Grid.Row="1"/>

                    <ComboBox x:Name="theComboBox" SelectedIndex="0" Height="Auto" Margin="0,10,0,0" VerticalAlignment="Top" Grid.Row="2">
                        <Rectangle Fill="Red" Width="100" Height="30" />
                        <Rectangle Fill="Green" Width="100" Height="30" />
                        <Rectangle Fill="Blue" Width="100" Height="30" />
                        <TextBlock HorizontalAlignment="Left" ToolTip="Gone but not forgotten" VerticalAlignment="Top" Width="100" Height="30" Background="#FFEDC513" FontWeight="Bold" Foreground="#FF14BA00" Text="Moletones" TextAlignment="Center" TextWrapping="Wrap"/>
                    </ComboBox>

                    <TextBox Margin="0,10,0,0">I am a TextBox</TextBox>

                    <Slider Margin="0,10,0,0" />

                    <Label Background="LimeGreen" Margin="0,10,0,0">I am a Label</Label>

                    <GroupBox Header="I am a GroupBox who contains an InkCanvas" Margin="0,10,0,0">
                        <InkCanvas Height="60" />
                    </GroupBox>

                    <PasswordBox Password="password" Margin="0,10,0,0" />

                    <RadioButton Content="I am a RadioButton" Margin="0,10,0,0" />

                    <ProgressBar Value="50" Height="30" Margin="0,10,0,0"/>

                    <TreeView Margin="0,10,0,0">
                        <TreeViewItem Header="I am a TreeViewItem" IsExpanded="True">
                            <TreeViewItem Header="I am a child TreeViewItem"/>
                            <TreeViewItem Header="I am another child TreeViewItem"/>
                        </TreeViewItem>
                    </TreeView>
                </StackPanel>
            </TabItem>

            <!-- FLOW DOCUMENT -->
            <TabItem Header="Flow Document">

                <FlowDocumentScrollViewer Grid.Row="4">
                    <FlowDocument>
                        <Paragraph>
                            This is some text in a flow document.  Most of the document's elements seen in the XAML
                            will not appear in the visual tree, but will be in the logical tree.  Most elements in
                            a flow document derive from ContentElement, which means that they are not actually included
                            in visual trees.  Instead they are "hosted" by FrameworkElement subclasses which display them
                            in whatever way they want.  To do that, visual elements are internally created by WPF to
                            render the document.  Those internally created elements will appear in the visual tree.
                        </Paragraph>

                        <List>
                            <ListItem>
                                <Paragraph>
                                    I am an item in a list
                                </Paragraph>
                            </ListItem>
                            <ListItem>
                                <Paragraph>
                                    I am another item in a list
                                </Paragraph>
                            </ListItem>
                        </List>
                        <BlockUIContainer>
                            <Button>I am a Button in the FlowDocument</Button>
                        </BlockUIContainer>
                    </FlowDocument>
                </FlowDocumentScrollViewer>
            </TabItem>
        </TabControl>
    </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)

Share

About the Authors

Andrew Smith
Architect Infragistics, Inc.
United States United States
Andrew currently works as an architect for Infragistics working with windows forms and WPF. You can check out his blog here.

Josh Smith
Software Developer (Senior) Cynergy Systems
United States United States
Josh creates software, for iOS and Windows.
 
He works at Cynergy Systems as a Senior Experience Developer.
 
Read his iOS Programming for .NET Developers[^] book to learn how to write iPhone and iPad apps by leveraging your existing .NET skills.
 
Use his Master WPF[^] app on your iPhone to sharpen your WPF skills on the go.
 
Check out his Advanced MVVM[^] book.
 
Visit his WPF blog[^] or stop by his iOS blog[^].
Follow on   Twitter

Karl Shifflett
Architect Gayle Manufacturing Company
United States United States
Karl loves .NET, WPF, WCF, ASP.NET, VB.NET and C#.
 
Awards:
 
  • December 2008 VB.NET Code Project Article Award
  • 2009 Code Project MVP
  • 2008 Code Project MVP
  • 2008 Microsoft MVP - Client App Dev
  • December 2007 VB.NET Code Project Article Award
  • Gold Medal Winner at IBM's 1998 PROIV Programming Contest in Las Vegas
Click here to check out my Blog
 
Click here to learn about Mole 2010 debugging tool for Visual Studio 2010
 
Click here to read about XAML Power Toys
 

Just a grain of sand on the worlds beaches.

Follow on   Twitter

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141223.1 | Last Updated 31 Dec 2007
Article Copyright 2007 by Andrew Smith, Josh Smith, Karl Shifflett
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid