Click here to Skip to main content
15,885,278 members
Articles / Desktop Programming / WPF

WPF Form Designer Prototype (MVVM)

Rate me:
Please Sign up or sign in to vote.
4.83/5 (31 votes)
3 Apr 2013CPOL9 min read 79.3K   3.4K   108  
Form designer with editable display properties and bindings. Generates XAML forms.
<UserControl x:Class="WPFFormDesigner.FormDesignerToolboxView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:DragDrop="clr-namespace:FluidKit.Helpers.DragDrop;assembly=FluidKit" xmlns:DragDrop2="clr-namespace:WPFFormDesigner.WPFControlUtils.DragDrop" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <SolidColorBrush x:Key="ToolboxBackgroundBrush" Color="#FFE5DBB3" />
        <!--<SolidColorBrush x:Key="ExpanderBackgroundBrush" Color="#AAADC972" Opacity="1" />-->
        <SolidColorBrush x:Key="ExpanderBackgroundBrush" Color="#AAADC972" Opacity="1" />
        <DragDrop2:DefaultDragSourceAdvisor x:Key="sourceAdvisor" />
    </UserControl.Resources>
    <StackPanel Grid.Column="0">
        <Expander Header="WPF Form Controls" Background="{StaticResource ToolboxBackgroundBrush}" IsExpanded="True">
            <StackPanel x:Name="_topPanel" Background="{StaticResource ToolboxBackgroundBrush}" HorizontalAlignment="Center" DragDrop:DragDropManager.DragSourceAdvisor="{StaticResource sourceAdvisor}">
                <Rectangle Name="Border" StrokeThickness="1" StrokeDashArray="2" Fill="Transparent" SnapsToDevicePixels="true" />
                <Label Content="Label" Width="Auto" Height="Auto" Margin="3,7,3,7" ToolTip="Label" />
                <TextBox Width="75" Height="20" Margin="3,7,3,7" ToolTip="TextBox" />
                <CheckBox Content="Check Box" Width="Auto" Height="Auto" Margin="3,7,3,7" ToolTip="CheckBox" VerticalAlignment="Center" />
                <RadioButton Content="Radio Button" Height="Auto" Width="Auto" VerticalAlignment="Center" Margin="3,7,3,7" />
                <DatePicker Width="125" Height="25" Margin="3,7,3,7" ToolTip="DatePicker" />
                <ComboBox MinWidth="50" Width="150" Height="20" Margin="3,7,3,7" ToolTip="ComboBox" />
                <Expander ToolTip="Expander" Margin="10,10,10,10" Header="Expander">
                    <Border BorderBrush="#FF000000" BorderThickness="1,1,1,1" CornerRadius="8,8,8,8">
                        <!--<Grid Name="InnerGrid" ShowGridLines="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">-->
                        <Grid ShowGridLines="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                        </Grid>
                    </Border>
                </Expander>
                <Button Content="ListView" ToolTip="ObservableCollection ListView" Margin="3,7,3,7" Tag="ObservableCollectionListView"/>
            </StackPanel>
        </Expander>
    </StackPanel>
</UserControl>

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
United States United States
Sr. application developer currently developing desktop and web applications for the specialty insurance sector. Data integration specialist, interested in learning the latest .Net technologies.

Comments and Discussions