<Window x:Class="TwitterClient.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="clr-namespace:TwitterClient.ViewModel"
		xmlns:local="clr-namespace:TwitterClient"
        xmlns:c="clr-namespace:TwitterClient.Converters"
        Title="TwitterClient" Height="596" Width="408"
        Icon="/TwitterClient;component/Images/TwitterClientIconSmall.png">
    <Window.DataContext>
        <vm:TwitterViewModel/>
    </Window.DataContext>
    <Window.Resources>
        <DrawingImage x:Key="HRedOverlay">
            <DrawingImage.Drawing>
                <ImageDrawing ImageSource="Images\HRed.png" Rect="0,0,16,16"/>
            </DrawingImage.Drawing>
        </DrawingImage>
        <DrawingImage x:Key="URedOverlay">
            <DrawingImage.Drawing>
                <ImageDrawing ImageSource="Images\URed.png" Rect="0,0,16,16"/>
            </DrawingImage.Drawing>
        </DrawingImage>
        <!--możliwość użycia konwertera obrazków w zależności od timeline-->
        <c:TimeLineToImageConverter x:Key="TimeLineToImageConverter"/>
    </Window.Resources>
    <Window.TaskbarItemInfo>
        <TaskbarItemInfo  ThumbnailClipMargin="5,5,5,480"  x:Name="taskBarItemInfo"  Description="{Binding ElementName=Window, Path=TimeLine}" >
            <TaskbarItemInfo.ThumbButtonInfos>
                <ThumbButtonInfo Description="User Timeline" ImageSource="Images\UGreen.png" Click="ThumbButtonInfo_Click" />
                <ThumbButtonInfo Description="Home Timeline" ImageSource="Images\HGreen.png" Click="ThumbButtonInfo_Click_1" />
                <ThumbButtonInfo Description="Public Timeline" ImageSource="Images\PGreen.png" Click="ThumbButtonInfo_Click_2" />
                <ThumbButtonInfo Description="Mentions" ImageSource="Images\MGreen.png" Click="ThumbButtonInfo_Click_3" />
                <ThumbButtonInfo Description="Retweeted By Me" ImageSource="Images\RGreen.png" Click="ThumbButtonInfo_Click_4" />
            </TaskbarItemInfo.ThumbButtonInfos>
        </TaskbarItemInfo>
    </Window.TaskbarItemInfo>
    <Grid Background="{DynamicResource AppBackgroundBrush}">
        <Button Style="{DynamicResource ResourceKey=RoundedButtonStyle}" Height="28" HorizontalAlignment="Right" Margin="0,37,12,0" Name="button1" VerticalAlignment="Top" Width="41" Click="button1_Click" BorderBrush="{StaticResource ActiveColorBrush}">
            <Viewbox >
                <Path Margin="7" Data="M0,40 L24.499999,40.083996 12.083667,55.75 z M45.667,0 C67.758393,8.2635896E-07 85.667,17.908609 85.667,40 85.667,62.091392 67.758393,80 45.667,80 L45.667,67 C60.57869,67 72.667,54.91169 72.667,40 72.667,25.088314 60.57869,13.000001 45.667,13 30.755314,13.000001 18.667001,25.088314 18.667001,40 L5.6670005,40 C5.6670012,17.908609 23.57561,8.2635896E-07 45.667,0 z"     StrokeThickness="0" />
            </Viewbox>
        </Button>
        <ListBox Background="Transparent"
                 Foreground="{DynamicResource ActiveColorBrush}"
			ScrollViewer.CanContentScroll="True"
            ScrollViewer.HorizontalScrollBarVisibility="Disabled"
            ScrollViewer.VerticalScrollBarVisibility="Disabled"
			Margin="12,71,12,113" 
			Name="listBox1" 
			ItemsSource="{Binding Path=Tweets}"
                 BorderBrush="{x:Null}">
            <ListBox.ItemContainerStyle>
                <StaticResourceExtension ResourceKey="ListBoxItemStyle"/>
            </ListBox.ItemContainerStyle>
            <ListBox.GroupStyle>
                <GroupStyle>
                    <GroupStyle.HeaderTemplate>
                        <DataTemplate>
                            <Border CornerRadius="4" Background="{DynamicResource GrupColorBrush}">
                                <TextBlock FontWeight="Bold" Foreground="{DynamicResource GrayColorBrush}" Text="{Binding Path=Name}" />
                            </Border>
                        </DataTemplate>
                    </GroupStyle.HeaderTemplate>
                </GroupStyle>
            </ListBox.GroupStyle>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <local:TweetTemplate />
                </DataTemplate>
            </ListBox.ItemTemplate>
            <ListBox.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="Sortuj według">
                        <MenuItem Header="Data" IsCheckable="True" Name="Data" Checked="Data_checked" Unchecked="Data_unchecked" />
                        <MenuItem Header="ScreenName" IsCheckable="True" Name="ScreenName" Checked="ScreenName_checked" Unchecked="ScreenName_unchecked" />
                    </MenuItem>
                    <MenuItem Header="Grupuj według">
                        <MenuItem Header="Użytkownik" IsCheckable="True" Name="Uzytkownik" Checked="Uzytkownik_checked" Unchecked="Uzytkownik_unchecked" />
                    </MenuItem>
                    <MenuItem Header="Time Line">
                        <MenuItem Header="User"  Name="user" Click="user_Click" />
                        <MenuItem Header="Home"  Name="home" Click="home_Click" />
                        <MenuItem Header="Public"  Name="public" Click="public_Click" />
                        <MenuItem Header="Mentions"  Name="mentions" Click="mentions_Click" />
                        <MenuItem Header="RetweetedByMe"  Name="retweetedByMe" Click="retweetByMe_Click" />
                    </MenuItem>
                    <Separator/>
                    <MenuItem Header="O programie" Click="MenuItem_Click" />
                </ContextMenu>
            </ListBox.ContextMenu>
        </ListBox>
        <TextBox Background="{DynamicResource TweetMessageBoxBackground}" BorderBrush="{x:Null}" TextWrapping="Wrap" Height="80" Margin="12,0,86,27" Name="textBox1" VerticalAlignment="Bottom" MaxLength="140" IsEnabled="True" Text="{Binding Path=TweetText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
        <Button  IsEnabled="{Binding Path=Text.Length, ElementName=textBox1,Converter={StaticResource lenghtToIsEnabledConverter} }" Style="{DynamicResource RoundedButtonStyle}"  Height="80" HorizontalAlignment="Right" Margin="0,0,12,27" Name="button2" VerticalAlignment="Bottom" Width="70" Click="button2_Click" BorderBrush="{DynamicResource ActiveColorBrush}" >
            <Grid>
                <Rectangle Width="6" Height="22"/>
                <Rectangle Width="22" Height="6" />
            </Grid>
        </Button>
        <!--<Label  Height="21" Margin="12,0" Name="label1" VerticalAlignment="Bottom" ContentStringFormat="{}{0} znak(ów)" Content="{Binding  Path=Text.Length, ElementName=textBox1,Converter={StaticResource lenghtToDescriptionConverter}}" Foreground="#F0867878" FontSize="10" BorderBrush="Black"
                Background="{Binding Path=Text.Length, ElementName=textBox1,Converter={StaticResource lenghtToBackgroundConverter}}"/>-->
        <Label  Height="21" Margin="12,0" Name="label1" VerticalAlignment="Bottom" Content="{Binding  Path=Text.Length, ElementName=textBox1,Converter={StaticResource lenghtToDescriptionConverter}}" Foreground="{DynamicResource LabelForeground}" FontSize="10" 
                Background="{Binding Path=Text.Length, ElementName=textBox1,Converter={StaticResource lenghtToBackgroundConverter}}"/>
        <TextBox Background="Transparent" Height="28" Margin="12,37,59,0" Name="textBox2" VerticalAlignment="Top" TextChanged="textBox2_TextChanged"/>
    </Grid>
</Window>
