Click here to Skip to main content
15,894,825 members
Articles / Web Development / HTML

WPF x FileExplorer x MVVM

Rate me:
Please Sign up or sign in to vote.
4.99/5 (52 votes)
24 Nov 2012LGPL323 min read 290.7K   9.4K   228  
This article describe how to construct FileExplorer controls included DirectoryTree and FileList, using Model-View-ViewModel (MVVM) pattern.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    
    <ResourceDictionary.MergedDictionaries>        
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Templates.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="focusVisualStyle">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Stroke="#8E6EA6F5" StrokeThickness="1" RadiusX="2" RadiusY="2"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="leftNavButtonStyle" TargetType="Button">
        <Style.Setters>
            <Setter Property="Template" Value="{StaticResource LNavButton}"/>
        </Style.Setters>
    </Style>

    <Style x:Key="rightNavButtonStyle" TargetType="Button">
        <Style.Setters>
            <Setter Property="Template" Value="{StaticResource RNavButton}"/>
        </Style.Setters>
    </Style>

    <Style x:Key="headeredGroupBox" TargetType="GroupBox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="GroupBox">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Border Grid.Row="0" Background="{StaticResource LightBrush}" BorderBrush="{StaticResource NormalBorderBrush}"
                                BorderThickness="1" CornerRadius="2,2,0,0" >
                            <ContentPresenter Margin="4" ContentSource="Header" RecognizesAccessKey="True" />
                        </Border>
                        <Border Grid.Row="1" Background="{StaticResource WindowBackgroundBrush}" 
                                BorderBrush="{StaticResource SolidBorderBrush}" BorderThickness="1,0,1,1" CornerRadius="0,0,2,2" >
                            <ContentPresenter Margin="4" />
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


</ResourceDictionary>

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
Founder
Hong Kong Hong Kong

Comments and Discussions