<Window x:Class="StructureHelper.Windows.BeamShears.BeamShearView"
        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/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:StructureHelper.Windows.BeamShears"
        xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
        xmlns:enums="clr-namespace:StructureHelper.Infrastructure.Enums"
        d:DataContext="{d:DesignInstance local:BeamShearViewModel}"
        mc:Ignorable="d"
        Title="Beam Shear Analysis" Height="450" Width="800" MinHeight="250" MinWidth="400" MaxHeight="1000" MaxWidth="1500" WindowStartupLocation="CenterScreen">
    <DockPanel>
        <ToolBarTray DockPanel.Dock="Top">
            <ToolBar ToolTip="Actions" DataContext="{Binding Actions}">
                <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding Add}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Shear action"
                                                IconContent="{StaticResource DistributedLoad}"
                                                DescriptionText="Adds beam shear action"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource DistributedLoad}"/>
                    </Viewbox>
                </Button>
            </ToolBar>
            <ToolBar ToolTip="Sections" DataContext="{Binding Sections}">
                <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding Add}"
                        CommandParameter="{x:Static enums:PrimitiveType.Rectangle}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Rectangle section"
                                                IconContent="{StaticResource ShearRectangleSection}"
                                                DescriptionText="Add rectangle shear section (height, width, strength)"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource ShearRectangleSection}"/>
                    </Viewbox>
                </Button>
                <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding Add}"
                        CommandParameter="{x:Static enums:PrimitiveType.Circle}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Circle section"
                                                IconContent="{StaticResource ShearCircleSection}"
                                                DescriptionText="Add circle shear section (diameter, strength)"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource ShearCircleSection}"/>
                    </Viewbox>
                </Button>
            </ToolBar>
            <ToolBar ToolTip="Stirrups" DataContext="{Binding Stirrups}">
                <Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:StirrupTypes.GroupOfStirrups}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Add group of stirrup"
                        IconContent="{StaticResource TreeGroup}"
                        DescriptionText="Adds group of stirrup which can contain several types of child stirrups at the same time"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource TreeGroup}"/>
                    </Viewbox>
                </Button>
                <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding Add}"
                        CommandParameter="{x:Static enums:StirrupTypes.Density}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Add stirrups by density"
                                                IconContent="{StaticResource StirrupDensity}"
                                                DescriptionText="Adds uniformly distributed stirrups by value of density"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource StirrupDensity}"/>
                    </Viewbox>
                </Button>
                <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding Add}"
                        CommandParameter="{x:Static enums:StirrupTypes.UniformRebar}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Add stirrup by rebars"
                                                IconContent="{StaticResource StirrupRebars}"
                                                DescriptionText="Adds uniformly distributed stirrups by rebars (step, diameter, strength)"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource StirrupRebars}"/>
                    </Viewbox>
                </Button>
                <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding Add}"
                        CommandParameter="{x:Static enums:StirrupTypes.InclinedRebar}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Add inclined rebar"
                                                IconContent="{StaticResource StirrupInclinedRebar}"
                                                DescriptionText="Adds inclined rebar by its diameter and strength"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource StirrupInclinedRebar}"/>
                    </Viewbox>
                </Button>
            </ToolBar>
            <ToolBar ToolTip="Calculators" DataContext="{Binding Calculators}">
                <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding Add}" CommandParameter="{x:Static enums:CalculatorTypes.BeamShearCalculator}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Add shear calculator"
                                                IconContent="{StaticResource ShearCalculator}"
                                                DescriptionText="Creates new shear beam calculator"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource ShearCalculator}"/>
                    </Viewbox>
                </Button>
            </ToolBar>
            <ToolBar ToolTip="Templates">
                <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding AddTemplate}"
                        CommandParameter="{x:Static enums:PrimitiveType.Rectangle}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Create rectangle template"
                                                IconContent="{StaticResource ShearSectionRectangleTemplate}"
                                                DescriptionText="Create rectangle section by template"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource ShearSectionRectangleTemplate}"/>
                    </Viewbox>
                </Button>
                <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding AddTemplate}"
                        CommandParameter="{x:Static enums:PrimitiveType.Circle}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Create circle template"
                                                IconContent="{StaticResource ShearSectionCircleTemplate}"
                                                DescriptionText="Create circle section by template"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource ShearSectionCircleTemplate}"/>
                    </Viewbox>
                </Button>
            </ToolBar>
        </ToolBarTray>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="25"/>
            </Grid.RowDefinitions>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="0"/>
                </Grid.ColumnDefinitions>
                <ScrollViewer>
                    <StackPanel>
                        <Expander DataContext="{Binding Actions}">
                            <Expander.Header>
                                <StackPanel Orientation="Horizontal">
                                    <Viewbox Height="16" Width="16">
                                        <ContentControl ContentTemplate="{DynamicResource DistributedLoad}"/>
                                    </Viewbox>
                                    <TextBlock Text="Actions"/>
                                </StackPanel>
                            </Expander.Header>
                            <Expander.ContextMenu>
                                <ContextMenu>
                                    <MenuItem Header="Add" Command="{Binding Add}"/>
                                </ContextMenu>
                            </Expander.ContextMenu>
                            <ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" ContextMenu="{StaticResource EditCopyDelete}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <TextBlock Text="{Binding Name}"/>
                                        </Grid>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </Expander>
                        <Expander DataContext="{Binding Sections}">
                            <Expander.Header>
                                <StackPanel Orientation="Horizontal">
                                    <Viewbox Height="16" Width="16">
                                        <ContentControl ContentTemplate="{DynamicResource ShearRectangleSection}"/>
                                    </Viewbox>
                                    <TextBlock Text="Cross-sections"/>
                                </StackPanel>
                            </Expander.Header>
                            <Expander.ContextMenu>
                                <ContextMenu>
                                    <MenuItem Header="Add">
                                        <MenuItem Header="Rectangle section" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}">
                                            <MenuItem.Icon>
                                                <Viewbox Height="16" Width="16">
                                                    <ContentControl ContentTemplate="{DynamicResource ShearRectangleSection}"/>
                                                </Viewbox>
                                            </MenuItem.Icon>
                                        </MenuItem>
                                        <MenuItem Header="Circle section" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}">
                                            <MenuItem.Icon>
                                                <Viewbox Height="16" Width="16">
                                                    <ContentControl ContentTemplate="{DynamicResource ShearCircleSection}"/>
                                                </Viewbox>
                                            </MenuItem.Icon>
                                        </MenuItem>
                                    </MenuItem>
                                </ContextMenu>
                            </Expander.ContextMenu>
                            <ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" ContextMenu="{StaticResource EditCopyDelete}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <TextBlock Text="{Binding Name}"/>
                                        </Grid>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </Expander>
                        <Expander DataContext="{Binding Stirrups}">
                            <Expander.Header>
                                <StackPanel Orientation="Horizontal">
                                    <Viewbox Height="16" Width="16">
                                        <ContentControl ContentTemplate="{DynamicResource StirrupRebars}"/>
                                    </Viewbox>
                                    <TextBlock Text="Stirrups"/>
                                </StackPanel>
                            </Expander.Header>
                            <Expander.ContextMenu>
                                <ContextMenu>
                                    <MenuItem Header="Add">
                                        <MenuItem Header="Group of stirrup" Command="{Binding Add}" CommandParameter="{x:Static enums:StirrupTypes.GroupOfStirrups}">
                                            <MenuItem.Icon>
                                                <Viewbox Height="16" Width="16">
                                                    <ContentControl ContentTemplate="{DynamicResource TreeGroup}"/>
                                                </Viewbox>
                                            </MenuItem.Icon>
                                        </MenuItem>
                                        <MenuItem Header="Uniformly distributed density" Command="{Binding Add}" CommandParameter="{x:Static enums:StirrupTypes.Density}">
                                            <MenuItem.Icon>
                                                <Viewbox Height="16" Width="16">
                                                    <ContentControl ContentTemplate="{DynamicResource StirrupDensity}"/>
                                                </Viewbox>
                                            </MenuItem.Icon>
                                        </MenuItem>
                                        <MenuItem Header="Uniformly distributed rebars" Command="{Binding Add}" CommandParameter="{x:Static enums:StirrupTypes.UniformRebar}">
                                            <MenuItem.Icon>
                                                <Viewbox Height="16" Width="16">
                                                    <ContentControl ContentTemplate="{DynamicResource StirrupRebars}"/>
                                                </Viewbox>
                                            </MenuItem.Icon>
                                        </MenuItem>
                                        <MenuItem Header="Inclined rebar" Command="{Binding Add}" CommandParameter="{x:Static enums:StirrupTypes.Density}">
                                            <MenuItem.Icon>
                                                <Viewbox Height="16" Width="16">
                                                    <ContentControl ContentTemplate="{DynamicResource StirrupInclinedRebar}"/>
                                                </Viewbox>
                                            </MenuItem.Icon>
                                        </MenuItem>
                                    </MenuItem>
                                </ContextMenu>
                            </Expander.ContextMenu>
                            <ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" ContextMenu="{StaticResource EditCopyDelete}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <TextBlock Text="{Binding Name}"/>
                                        </Grid>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </Expander>
                        <Expander DataContext="{Binding Calculators}">
                            <Expander.Header>
                                <StackPanel Orientation="Horizontal">
                                    <Viewbox Height="16" Width="16">
                                        <ContentControl ContentTemplate="{DynamicResource ShearCalculator}"/>
                                    </Viewbox>
                                    <TextBlock Text="Calculators"/>
                                </StackPanel>
                            </Expander.Header>
                            <Expander.ContextMenu>
                                <ContextMenu>
                                    <MenuItem Header="Add">
                                        <MenuItem Header="Beam Shear Calculator" Command="{Binding Add}" CommandParameter="{x:Static enums:CalculatorTypes.BeamShearCalculator}">
                                            <MenuItem.Icon>
                                                <Image Width="16" Height="16" Source="/Windows/MainWindow/Calculator32.png" />
                                            </MenuItem.Icon>
                                        </MenuItem>
                                    </MenuItem>
                                </ContextMenu>
                            </Expander.ContextMenu>
                            <ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" ContextMenu="{StaticResource AnalisesCRUD}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <TextBlock Text="{Binding Name}"/>
                                        </Grid>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </Expander>
                    </StackPanel>
                </ScrollViewer>
            </Grid>
        </Grid>
    </DockPanel>
</Window>
