<Window x:Class="Zadatak4.MainWindow"
        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:Zadatak4"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <DockPanel>
        <Grid DockPanel.Dock="Bottom">
            <Grid.RowDefinitions>
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <TreeView Grid.Column="0" Grid.Row="0" Name="trvProizvodi">
                <TreeView.Resources>
                    <HierarchicalDataTemplate DataType="{x:Type local:Supermarket}" ItemsSource="{Binding KategorijeProizvoda}">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Naziv}"/>
                            <StackPanel.ContextMenu>
                                <ContextMenu>
                                    <MenuItem Header="Dodaj kategoriju" Command="{Binding AddCategory}"></MenuItem>
                                </ContextMenu>
                            </StackPanel.ContextMenu>
                        </StackPanel>
                    </HierarchicalDataTemplate>
                    <HierarchicalDataTemplate DataType="{x:Type local:Kategorija}" ItemsSource="{Binding Proizvodi}">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Naziv}"/>
                            <StackPanel.ContextMenu>
                                <ContextMenu>
                                    <MenuItem Header="Dodaj proizvod" Command="{Binding AddProduct}"></MenuItem>
                                </ContextMenu>
                            </StackPanel.ContextMenu>
                        </StackPanel>
                    </HierarchicalDataTemplate>
                    <DataTemplate DataType="{x:Type local:Proizvod}">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Naziv}" FontWeight="Bold"/>
                            <TextBlock Text=" ("/>
                            <TextBlock Text="{Binding Cena}"/>
                            <TextBlock Text=" din"/>
                            <TextBlock Text=")"/>
                        </StackPanel>
                    </DataTemplate>
                </TreeView.Resources>
            </TreeView>
            <ContentPresenter Grid.Column="1" Grid.Row="0" Content="{Binding ElementName=trvProizvodi,Path=SelectedItem}">
                <ContentPresenter.Resources>
                    <DataTemplate DataType="{x:Type local:Proizvod}">
                        <Grid Margin="10 0 0 0">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Column="0" Grid.Row="0">Naziv:</TextBlock>
                            <TextBlock Grid.Column="0" Grid.Row="1">Cena:</TextBlock>
                            <TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Path=Naziv}"></TextBox>
                            <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Path=Cena}"></TextBox>
                        </Grid>
                    </DataTemplate>

                    <DataTemplate DataType="{x:Type local:Kategorija}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Grid.Row="0">Naziv:</TextBlock>
                            <TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Path=Naziv}"></TextBox>
                        </Grid>
                    </DataTemplate>

                    <DataTemplate DataType="{x:Type local:Supermarket}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Grid.Row="0">Naziv:</TextBlock>
                            <TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Path=Naziv}"></TextBox>
                        </Grid>
                    </DataTemplate>
                </ContentPresenter.Resources>
            </ContentPresenter>
        </Grid>
    </DockPanel>
</Window>
