<UserControl x:Class="VisualPathFinder.Map"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:UC="clr-namespace:VisualPathFinder">
	<UserControl.Resources>
		<UC:CellContentConverter x:Key="convert" />

		<DataTemplate x:Key="Cell">
			<Rectangle Margin="2" MinHeight="12" MinWidth="12" MouseDown="cellClick">
				<Rectangle.Fill>
					<SolidColorBrush Color="{Binding Converter={StaticResource convert}}"/>
				</Rectangle.Fill>
			</Rectangle>
		</DataTemplate>
		
		<DataTemplate x:Key ="Row">
			<ItemsControl ItemsSource ="{Binding}" ItemTemplate="{StaticResource Cell}">
				<ItemsControl.ItemsPanel>
					<ItemsPanelTemplate>
						<UniformGrid Rows ="1"/>
					</ItemsPanelTemplate>
				</ItemsControl.ItemsPanel>
			</ItemsControl>
		</DataTemplate>
	</UserControl.Resources>
	
	<Grid Background="LightGray">
		<Grid.RowDefinitions>
			<RowDefinition/>
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition/>
		</Grid.ColumnDefinitions>
		<ScrollViewer Grid.Column="0" Grid.Row="0" HorizontalScrollBarVisibility="Visible">
			<ItemsControl ItemsSource="{Binding}" ItemTemplate ="{StaticResource Row}" x:Name="map">
				<ItemsControl.ItemsPanel>
					<ItemsPanelTemplate>
						<UniformGrid Columns ="1"/>
					</ItemsPanelTemplate>
				</ItemsControl.ItemsPanel>
			</ItemsControl>		  
		</ScrollViewer>
	</Grid>
</UserControl>
