Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2011
788
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 5.50 KB | None | 0 0
  1. <UserControl x:Class="MVVM_Test.UserControl1"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3.             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4.             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5.             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6.             xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
  7.             xmlns:y="clr-namespace:MVVM_Test.Util"
  8.             xmlns:vm="clr-namespace:MVVM_Test.ViewModel"
  9.             mc:Ignorable="d"
  10.             d:DesignHeight="300" d:DesignWidth="400" >
  11.     <UserControl.Resources>
  12.         <y:DateTimeConverter x:Key="dateTimeConverter" />
  13.         <y:ColorConverter x:Key="colorConverter" />
  14.     </UserControl.Resources>
  15.     <UserControl.DataContext>
  16.         <vm:ViewModel/>
  17.     </UserControl.DataContext>
  18.     <Grid>
  19.         <Grid.ColumnDefinitions>
  20.             <ColumnDefinition />
  21.             <ColumnDefinition Width="115"/>
  22.         </Grid.ColumnDefinitions>
  23.         <Grid Grid.Column="1">
  24.             <Grid.ColumnDefinitions>
  25.                 <ColumnDefinition/>
  26.             </Grid.ColumnDefinitions>
  27.             <Grid.RowDefinitions>
  28.                 <RowDefinition Height="Auto"/>
  29.                 <RowDefinition Height="Auto"/>
  30.                 <RowDefinition Height="Auto"/>
  31.                 <RowDefinition Height="Auto"/>
  32.             </Grid.RowDefinitions>
  33.             <DatePicker Name="HistoryDateTime" Grid.Column="1" Grid.Row="0" HorizontalAlignment="Center" DisplayDateStart="{Binding Path=StartDate}" DisplayDateEnd="{Binding Path=EndDate}" SelectedDate="{Binding Path=SelectedDate}" >
  34.                 <interactivity:Interaction.Triggers>
  35.                 </interactivity:Interaction.Triggers>
  36.             </DatePicker>
  37.             <Button Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" Name="PrevHistoryDateButton" Command="{Binding Mode=OneTime, Path=PrevHistory_cmd}" >Prev</Button>
  38.             <Button Grid.Column="2" Grid.Row="1" HorizontalAlignment="Right" Name="NextHistoryDateButton" Command="{Binding Mode=OneTime, Path=NextHistory_cmd}">Next</Button>
  39.  
  40.             <Grid Grid.Row="2">
  41.                 <Grid.ColumnDefinitions>
  42.                     <ColumnDefinition Width="1.9*"/>
  43.                     <ColumnDefinition Width="1.33*"/>
  44.                     <ColumnDefinition Width="1.15*"/>
  45.                 </Grid.ColumnDefinitions>
  46.                 <Grid.RowDefinitions>
  47.                     <RowDefinition Height="Auto"/>
  48.                     <RowDefinition Height="Auto"/>
  49.                     <RowDefinition Height="Auto"/>
  50.                     <RowDefinition />
  51.                 </Grid.RowDefinitions>
  52.                 <Label>Width:</Label>
  53.                 <Label Grid.Row="1">Height:</Label>
  54.                 <Label Grid.Row="2">Length:</Label>
  55.                 <Label Grid.Row="3">Weight:</Label>
  56.  
  57.                 <Label Name="WidthCurrentBrickLabel" Grid.Column="1" >000</Label>
  58.                 <Label Name="HeightCurrentBrickLabel" Grid.Column="1" Grid.Row="1">000</Label>
  59.                 <Label Name="LengthCurrentBrickLabel" Grid.Column="1" Grid.Row="2">000</Label>
  60.                 <Label Name="WeightCurrentBrickLabel" Grid.Column="1" Grid.Row="3">000</Label>
  61.  
  62.                 <Label Grid.Column="2">mm</Label>
  63.                 <Label Grid.Row="1" Grid.Column="2">mm</Label>
  64.                 <Label Grid.Row="2" Grid.Column="2">mm</Label>
  65.                 <Label Grid.Row="3" Grid.Column="2">g</Label>
  66.             </Grid>
  67.  
  68.             <Button Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2">Start</Button>
  69.         </Grid>
  70.  
  71.         <Grid Grid.Column="0">
  72.             <Grid.ColumnDefinitions>
  73.                 <ColumnDefinition/>
  74.                 <ColumnDefinition/>
  75.                 <ColumnDefinition/>
  76.             </Grid.ColumnDefinitions>
  77.             <Grid.RowDefinitions>
  78.                 <RowDefinition Height="Auto"/>
  79.                 <RowDefinition/>
  80.             </Grid.RowDefinitions>
  81.  
  82.             <DataGrid Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="1" ItemsSource="{Binding Path=SavedBricks}" CanUserReorderColumns="False" CanUserResizeColumns="False" AutoGenerateColumns="False">
  83.                 <DataGrid.Columns>
  84.                     <DataGridTextColumn Header="Time" Binding="{Binding Time, Converter={StaticResource dateTimeConverter}}" IsReadOnly="True" />
  85.                     <DataGridTemplateColumn Header="Type">
  86.                         <DataGridTemplateColumn.CellTemplate>
  87.                             <DataTemplate>
  88.                                 <Rectangle Fill="{Binding Path=BrickType, Converter={StaticResource colorConverter}}" Stroke="Black" Width="10" Height="10" DataContext="{Binding}" />
  89.                             </DataTemplate>
  90.                         </DataGridTemplateColumn.CellTemplate>
  91.                     </DataGridTemplateColumn>
  92.                     <DataGridTextColumn Header="Height" Binding="{Binding Height}" IsReadOnly="False"/>
  93.                     <DataGridTextColumn Header="Width" Binding="{Binding Width}" IsReadOnly="False"/>
  94.                     <DataGridTextColumn Header="Length" Binding="{Binding Length}" IsReadOnly="False"/>
  95.                     <DataGridTextColumn Header="Weight" Binding="{Binding Weight}" IsReadOnly="False"/>
  96.                     <DataGridTextColumn Header="Density" Binding="{Binding Density}" IsReadOnly="False" Width="SizeToHeader"/>
  97.                 </DataGrid.Columns>
  98.             </DataGrid>
  99.         </Grid>
  100.     </Grid>
  101. </UserControl>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement