Click here to Skip to main content
15,891,940 members
Articles / Desktop Programming / WPF

How to create a VS 2012 like application - Wide IDE Framework (v0.1)

Rate me:
Please Sign up or sign in to vote.
4.64/5 (25 votes)
2 Apr 2013LGPL38 min read 66.1K   9.5K   113  
Participatory IDE framework built using WPF, PRISM and other open source projects
<Window x:Class="Wide.Shell.ShellView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:avalonDock="http://avalondock.codeplex.com"
        xmlns:Host="clr-namespace:Wide.Shell"
        Title="{Binding Title}" Icon="{Binding Icon}" Closing="Window_Closing_1">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary x:Name="ThemeDictionary">
                    <ResourceDictionary.MergedDictionaries>
                        
                    </ResourceDictionary.MergedDictionaries>
                </ResourceDictionary>
                <ResourceDictionary Source="pack://application:,,,/Wide.Interfaces;component/Styles/Controls.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <avalonDock:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
            <Host:ActiveDocumentConverter x:Key="ActiveDocumentConverter"/>
        </ResourceDictionary>
    </Window.Resources>
    <Border>
        <DockPanel>
            <!--Menu-->
            <Menu DockPanel.Dock="Top" IsMainMenu="True" x:Name="mainMenu" VerticalAlignment="Top" ItemsSource="{Binding Path=Menus, UpdateSourceTrigger=PropertyChanged}" />
            <!--Toolbar (can we improve this?)-->
            <ContentControl Content="{Binding ToolBarTray}" DockPanel.Dock="Top" />
            <!--Status bar-->
            <StatusBar DockPanel.Dock="Bottom">
                <StatusBar.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="25"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="4*"/>
                                <ColumnDefinition Width="Auto" MaxWidth="100"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                        </Grid>
                    </ItemsPanelTemplate>
                </StatusBar.ItemsPanel>
                <StatusBarItem>
                    <TextBlock x:Name="StatusBarText">Ready</TextBlock>
                </StatusBarItem>
                <StatusBarItem Grid.Column="2">
                    <TextBlock>Testing</TextBlock>
                </StatusBarItem>
            </StatusBar>
            
            <!--The magical avalon dock-->
            <avalonDock:DockingManager x:Name="dockManager" 
                                   AnchorablesSource="{Binding Tools, Mode=TwoWay}" 
                                   DocumentsSource="{Binding Documents}"
                                   ActiveContent="{Binding ActiveDocument, Mode=TwoWay, Converter={StaticResource ActiveDocumentConverter}}">
                <!--<avalonDock:DockingManager.Theme>
                    <avalonDock:VS2010Theme />
                </avalonDock:DockingManager.Theme>-->
                <avalonDock:DockingManager.LayoutItemTemplateSelector>
                    <Host:PanesTemplateSelector>
                        <Host:PanesTemplateSelector.ContentViewTemplate>
                            <DataTemplate>
                                <ContentPresenter Content="{Binding View, UpdateSourceTrigger=PropertyChanged}"/>
                            </DataTemplate>
                        </Host:PanesTemplateSelector.ContentViewTemplate>
                        <Host:PanesTemplateSelector.ToolViewTemplate>
                            <DataTemplate>
                                <ContentPresenter Content="{Binding View, UpdateSourceTrigger=PropertyChanged}"/>
                            </DataTemplate>
                        </Host:PanesTemplateSelector.ToolViewTemplate>
                    </Host:PanesTemplateSelector>
                </avalonDock:DockingManager.LayoutItemTemplateSelector>

                <avalonDock:DockingManager.LayoutItemContainerStyleSelector>
                    <Host:PanesStyleSelector>
                        <Host:PanesStyleSelector.ToolStyle>
                            <Style TargetType="{x:Type avalonDock:LayoutAnchorableItem}">
                                <Setter Property="Title" Value="{Binding Model.Title, Mode=TwoWay}"/>
                                <Setter Property="IconSource" Value="{Binding Model.IconSource}"/>
                                <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                                <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                                <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                                <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            </Style>
                        </Host:PanesStyleSelector.ToolStyle>
                        <Host:PanesStyleSelector.ContentStyle>
                            <Style TargetType="{x:Type avalonDock:LayoutItem}">
                                <Setter Property="Title" Value="{Binding Model.Title, Mode=TwoWay}"/>
                                <Setter Property="ToolTip" Value="{Binding Model.Tooltip}"/>
                                <Setter Property="CloseCommand" Value="{Binding Model.CloseCommand}"/>
                                <Setter Property="IconSource" Value="{Binding Model.IconSource}"/>
                                <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                            </Style>
                        </Host:PanesStyleSelector.ContentStyle>
                    </Host:PanesStyleSelector>
                </avalonDock:DockingManager.LayoutItemContainerStyleSelector>
                <avalonDock:DockingManager.LayoutUpdateStrategy>
                    <Host:LayoutInitializer />
                </avalonDock:DockingManager.LayoutUpdateStrategy>

                <avalonDock:LayoutRoot>
                    <avalonDock:LayoutPanel Orientation="Vertical">
                        <avalonDock:LayoutDocumentPane/>
                        <avalonDock:LayoutAnchorablePane Name="ToolsPane" DockHeight="150"></avalonDock:LayoutAnchorablePane>
                    </avalonDock:LayoutPanel>
                </avalonDock:LayoutRoot>
            </avalonDock:DockingManager>
        </DockPanel>
    </Border>
</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 GNU Lesser General Public License (LGPLv3)


Written By
Software Developer
United States United States
Hello! I'm a 26 year old, WPF/C# self-learned software developer, musician from India with a Master's degree in Computer science. I believe that every piece of software and information/knowledge is available for free for those who seek it.

My projects are available in my Webpage hosted on Github. I am eager to learn new things everyday, explore new technologies and solve problems.

Comments and Discussions