<Window x:Class="Zadatak2.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:Zadatak2" d:DataContext="{d:DesignInstance Type=local:Stavka}"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <TabControl>
            <TabItem Header="Pregledaj sve">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="3*"/>
                    </Grid.RowDefinitions>
                    <Grid Margin="5 0 0 0" Grid.Row="0" Grid.ColumnSpan="2">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="3*"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="3*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock HorizontalAlignment="Left" Text="Pretrazi po nazivu" Grid.Row="1"/>
                        <TextBox x:Name="searchBox" Grid.Row="2" Grid.Column="0" TextChanged="searchBox_TextChanged"/>
                        <Button  x:Name="search" Grid.Row="2" Grid.Column="1" Margin="5 0 5 0" Click="search_Click">Pretrazi</Button>
                        </Grid>
                        <DataGrid Grid.Row="1" x:Name="ViewDataGrid" IsReadOnly="True" GridLinesVisibility="Horizontal"
                                     AutoGenerateColumns="False" Grid.ColumnSpan="2">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Id" Binding="{Binding Path=Id}"/>
                            <DataGridTextColumn Header="Naziv" Binding="{Binding Path=Naziv}"/>
                            <DataGridTextColumn Header="Cena" Binding="{Binding Path=Cena}"/>
                            <DataGridTextColumn Header="Vrsta" Binding="{Binding Path=Vrsta}"/>
                            <DataGridTextColumn Header="Opis" Binding="{Binding Path=Opis}"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>
            </TabItem>
            <TabItem Header="Dodaj">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="3*"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="3*"/>
                        <ColumnDefinition Width="2*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="2*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="2*"/>
                        <RowDefinition Height="2*"/>
                    </Grid.RowDefinitions>
                    <ListBox x:Name="lbStavkePrikaz" 
                              Margin="0,5,60,5" Grid.RowSpan="7" Grid.Column="0">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>

                                    <TextBlock Grid.Column="0" Text="{Binding Id}" Padding="5"/>
                                    <TextBlock Grid.Column="1" Text="{Binding Naziv}" Padding="5"/>
                                    <TextBlock Grid.Column="2" Text="{Binding Cena}" Padding="5"/>
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                    <TextBlock Text="Id :" FontWeight="Bold" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Top"  TextWrapping="Wrap" Grid.ColumnSpan="2"/>
                    <TextBlock Text="Naziv :" FontWeight="Bold" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Top" TextWrapping="Wrap" Grid.ColumnSpan="2" Grid.RowSpan="2"/>
                    <TextBlock Text="Cena :" FontWeight="Bold" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Left" VerticalAlignment="Top" TextWrapping="Wrap" Grid.ColumnSpan="2" Grid.RowSpan="2"/>
                    <TextBlock Text="Vrsta :" FontWeight="Bold" Grid.Column="1" Grid.Row="4" HorizontalAlignment="Left" VerticalAlignment="Top" TextWrapping="Wrap" Grid.ColumnSpan="2" Grid.RowSpan="2"/>
                    <TextBlock Text="Opis :" FontWeight="Bold" Grid.Column="1" Grid.Row="5" HorizontalAlignment="Left" VerticalAlignment="Top" TextWrapping="Wrap" Grid.ColumnSpan="2" Grid.RowSpan="2"/>
                    <TextBox x:Name="txtId" Padding ="2" Grid.Row="1" Grid.Column="2" VerticalAlignment="Top"/>
                    <TextBox x:Name="txtNaziv" Padding ="2" Grid.Row="2" Grid.Column="2" VerticalAlignment="Top" Grid.RowSpan="2"/>
                    <TextBox x:Name="txtCena" Padding ="2" Grid.Row="3" Grid.Column="2" VerticalAlignment="Top" TextWrapping="Wrap"/>
                    <ComboBox x:Name="cmbVrsta" Padding ="2" Grid.Row="4" Grid.Column="2" VerticalAlignment="Top"/>
                    <TextBox x:Name="txtOpis" Padding ="2" Grid.Row="5" Grid.Column="2" VerticalAlignment="Stretch" TextWrapping="Wrap"/>
                    <Button x:Name="btnDodaj" Click="btnDodaj_Click" HorizontalAlignment="Right" VerticalAlignment="Center" Width="100" Height="25" Content="Dodaj" Grid.Column="2"
Grid.Row="6"/>
                </Grid>
            </TabItem>
            <TabItem Header="Izmeni" VerticalAlignment="Top">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="3*"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="3*"/>
                        <ColumnDefinition Width="2*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="2*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="2*"/>
                        <RowDefinition Height="2*"/>
                    </Grid.RowDefinitions>

                    <TextBlock Text="Id :" FontWeight="DemiBold" Grid.Row="1" Grid.Column="1" VerticalAlignment="Top" TextWrapping="Wrap" />
                    <TextBlock Text="Naziv :" FontWeight="Bold" Grid.Row="2" Grid.Column="1" VerticalAlignment="Top" TextWrapping="Wrap" />
                    <TextBlock Text="Cena :" FontWeight="Bold" Grid.Row="3" Grid.Column="1" VerticalAlignment="Top" TextWrapping="Wrap"/>
                    <TextBlock Text="Vrsta :" FontWeight="Bold" Grid.Row="4" Grid.Column="1" VerticalAlignment="Top" TextWrapping="Wrap"/>
                    <TextBlock Text="Opis :" FontWeight="Bold" Grid.Row="5" Grid.Column="1" VerticalAlignment="Top" TextWrapping="Wrap"/>
                    <TextBox x:Name="txtIdIzmena" IsEnabled="False" Text="{Binding Id}" Padding ="2" Grid.Row="1"  Grid.Column="2" VerticalAlignment="Top"/>
                    <TextBox x:Name="txtNazivIzmena" Text="{Binding Naziv}" Padding ="2" Grid.Row="2" Grid.Column="2" VerticalAlignment="Top" TextWrapping="Wrap"/>
                    <TextBox x:Name="txtCenaIzmena" Text="{Binding Cena}" Padding ="2" Grid.Row="3" Grid.Column="2" VerticalAlignment="Top" TextWrapping="Wrap"/>
                    <ComboBox x:Name="cmbVrstaIzmena" Text="{Binding Vrsta}" Padding ="2" Grid.Row="4" Grid.Column="2" VerticalAlignment="Top"/>
                    <TextBox x:Name="txtOpisIzmena" Text="{Binding Opis}" Padding ="2" Grid.Row="5" Grid.Column="2" VerticalAlignment="Stretch" TextWrapping="Wrap"/>
                    <Button x:Name="btnIzmeni" Click="btnIzmeni_Click" HorizontalAlignment="Left" VerticalAlignment="Center" Width="100" Height="25" Content="Izmeni" Grid.Column="2"
                        Grid.Row="6"/>
                    <Button x:Name="btnObrisi" Click="btnObrisi_Click"
                         VerticalAlignment="Center" HorizontalAlignment="Right" Height="25" Content="Obrisi" Grid.Column="2" Grid.Row="6" Width="100"/>
                    <ListBox x:Name="lbStavke" SelectionChanged="lbStavke_SelectionChanged"
                             Margin="0,5,60,5" Grid.RowSpan="7">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>

                                    <TextBlock Grid.Column="0" Text="{Binding Id}" Padding="5"/>
                                    <TextBlock Grid.Column="1" Text="{Binding Naziv}" Padding="5"/>
                                    <TextBlock Grid.Column="2" Text="{Binding Cena}" Padding="5"/>
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>

            </TabItem>
        </TabControl>

    </Grid>

</Window>
