Advertisement
Guest User

Untitled

a guest
Jun 28th, 2013
613
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 10.35 KB | None | 0 0
  1.     <ScrollViewer  x:Name="scrollViewer" Margin="0,10"    Grid.Row="0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"  >
  2.                     <ItemsControl Name="items" ItemsSource="{Binding PreferenceGroups}">
  3.                     <ItemsControl.Resources>
  4.                         <ItemsPanelTemplate x:Key="wrapPanel">
  5.                             <WrapPanel></WrapPanel>
  6.                         </ItemsPanelTemplate>
  7.  
  8.                         <DataTemplate x:Key="SoloSelection">
  9.                             <ItemsControl ItemsSource="{Binding .}" ItemsPanel="{StaticResource wrapPanel}">
  10.                                 <ItemsControl.DataContext>
  11.                                     <MultiBinding Converter="{StaticResource prefConv}">
  12.                                         <Binding Path="."></Binding>
  13.                                         <Binding ElementName="viewModel" Path="DataContext.OrderItem.Preferences"></Binding>
  14.                                     </MultiBinding>
  15.                                 </ItemsControl.DataContext>
  16.                                 <ItemsControl.ItemTemplate>
  17.                                     <DataTemplate>
  18.                                         <local:RadioButtonToggle                                            
  19.                                             Width="146" Height="58" Margin="0,0,4,4" GroupName="{Binding Path=Preference.GroupId}" Style="{StaticResource OrderRadioButton}" >
  20.                                          <i:Interaction.Triggers>
  21.                                                 <i:EventTrigger EventName="Unchecked">
  22.                                                     <cal:ActionMessage MethodName="RemovePreference">
  23.                                                         <cal:Parameter Value="$dataContext" />
  24.                                                            <cal:Parameter Value="false" />
  25.                                                     </cal:ActionMessage>
  26.                                                 </i:EventTrigger>
  27.                                                 <i:EventTrigger EventName="Checked">
  28.                                                     <cal:ActionMessage MethodName="AddPreference">
  29.                                                         <cal:Parameter Value="$dataContext" />
  30.                                                            <cal:Parameter Value="false" />
  31.                                                     </cal:ActionMessage>
  32.                                                 </i:EventTrigger>
  33.                                             </i:Interaction.Triggers>
  34.        
  35.                                          
  36.                                          
  37.                                             <TextBlock   Margin="4,0,3,0" VerticalAlignment="Center" TextWrapping="Wrap" Text="{Binding Preference.Name}"></TextBlock>
  38.  
  39.                                             <local:RadioButtonToggle.IsChecked>
  40.                                                 <MultiBinding Mode="OneTime" Converter="{StaticResource prefCheckedConv}">
  41.                                                     <Binding Path="."></Binding>
  42.                                                     <Binding ElementName="viewModel" Path="DataContext.OrderItem.Preferences"></Binding>
  43.                                                 </MultiBinding>
  44.                                             </local:RadioButtonToggle.IsChecked>
  45.                                         </local:RadioButtonToggle>
  46.                                     </DataTemplate>
  47.                                 </ItemsControl.ItemTemplate>
  48.                             </ItemsControl>
  49.                         </DataTemplate>
  50.  
  51.                         <DataTemplate x:Key="MultiSelection">
  52.                             <ItemsControl ItemsSource="{Binding .}"  ItemsPanel="{StaticResource wrapPanel}">
  53.                                 <ItemsControl.DataContext>
  54.                                     <MultiBinding  Converter="{StaticResource prefConv}">
  55.                                         <Binding Path="."></Binding>
  56.                                         <Binding ElementName="viewModel" Path="DataContext.OrderItem.Preferences"></Binding>
  57.                                     </MultiBinding>
  58.                                 </ItemsControl.DataContext>
  59.                                 <ItemsControl.ItemTemplate>
  60.                                     <DataTemplate>
  61.                                         <CheckBox
  62.                                            cal:Message.Attach="[Event Checked]=[Action AddPreference($dataContext,false)]; [Event Unchecked]=[Action RemovePreference($datacontext,false)]"
  63.                                            Width="146" Height="58" Margin="0,0,4,4"   Style="{StaticResource OrderCheckboxButton}">
  64.                                             <TextBlock  Margin="4,0,3,0" VerticalAlignment="Center" TextWrapping="Wrap" Text="{Binding Preference.Name}"></TextBlock>
  65.                                             <CheckBox.IsChecked>
  66.                                                 <MultiBinding Mode="OneTime" Converter="{StaticResource prefCheckedConv}">
  67.                                                     <Binding Path="."></Binding>
  68.                                                     <Binding ElementName="viewModel" Path="DataContext.OrderItem.Preferences"></Binding>
  69.                                                 </MultiBinding>
  70.                                             </CheckBox.IsChecked>
  71.  
  72.                                         </CheckBox>
  73.                                     </DataTemplate>
  74.                                 </ItemsControl.ItemTemplate>
  75.                             </ItemsControl>
  76.                         </DataTemplate>
  77.  
  78.                         <DataTemplate x:Key="MultiQuantitySelection">
  79.                             <ItemsControl ItemsSource="{Binding .}" ItemsPanel="{StaticResource wrapPanel}">
  80.                                 <ItemsControl.DataContext>
  81.                                     <MultiBinding Converter="{StaticResource prefConv}">
  82.                                         <Binding Path="."></Binding>
  83.                                         <Binding ElementName="viewModel" Path="DataContext.OrderItem.Preferences"></Binding>
  84.                                     </MultiBinding>
  85.                                 </ItemsControl.DataContext>
  86.  
  87.                                 <ItemsControl.ItemTemplate>
  88.                                     <DataTemplate>
  89.                                         <Grid Width="146" Height="58" Margin="0,0,4,4" >
  90.                                             <Grid.ColumnDefinitions>
  91.                                                 <ColumnDefinition Width="Auto"></ColumnDefinition>
  92.                                                 <ColumnDefinition Width="*"></ColumnDefinition>
  93.                                             </Grid.ColumnDefinitions>
  94.                                             <Button Name="quantity"
  95.                                                    Background="#1f1f1f"
  96.                                                    cal:Message.Attach="[Event Click]=[Action RemovePreference($dataContext,'True')]"
  97.                                                  Width="45" Style="{StaticResource OrderProductButton}" >
  98.                                                 <TextBlock Text="{Binding Quantity}"></TextBlock>
  99.                                             </Button>
  100.                                             <Button
  101.                                                   cal:Message.Attach="[Event Click]=[Action AddPreference($dataContext,'True')]"
  102.                                                   Margin="-1,0,0,0" Grid.Column="1" HorizontalAlignment="Stretch"  HorizontalContentAlignment="Left" Style="{StaticResource OrderProductButton}">
  103.                                                 <TextBlock  TextWrapping="Wrap" HorizontalAlignment="Left"  TextTrimming="CharacterEllipsis"  Text="{Binding Path=Preference.Name}" ></TextBlock>
  104.  
  105.                                             </Button>
  106.                                         </Grid>
  107.                                         <DataTemplate.Triggers>
  108.                                             <DataTrigger   Binding="{common:ComparisonBinding DataContext.Quantity,GT,0}" Value="{x:Null}">
  109.                                                 <DataTrigger.Setters>
  110.                                                     <Setter Value="{StaticResource BackgroundSelected}" Property="Background" TargetName="quantity"/>
  111.                                                 </DataTrigger.Setters>
  112.                                             </DataTrigger>
  113.                                         </DataTemplate.Triggers>
  114.  
  115.                                     </DataTemplate>
  116.                                 </ItemsControl.ItemTemplate>
  117.  
  118.  
  119.                             </ItemsControl>
  120.                         </DataTemplate>
  121.                     </ItemsControl.Resources>
  122.  
  123.                     <ItemsControl.ItemTemplate>
  124.                         <DataTemplate>
  125.                             <StackPanel>
  126.                                 <TextBlock FontSize="25"  FontWeight="Light"  Margin="0,8,0,5" Text="{Binding Name}"></TextBlock>
  127.                                 <!-- Εδω τα items -->
  128.                                 <ContentControl  Content="{Binding Preferences}" Name="items"></ContentControl>
  129.                             </StackPanel>
  130.  
  131.                             <DataTemplate.Triggers>
  132.                                 <DataTrigger Binding="{Binding Path=SelectionMode}" Value="1">
  133.                                     <Setter TargetName="items" Property="ContentTemplate" Value="{StaticResource SoloSelection}"/>
  134.                                 </DataTrigger>
  135.  
  136.                                 <DataTrigger Binding="{Binding Path=SelectionMode}" Value="2">
  137.                                     <Setter TargetName="items" Property="ContentTemplate" Value="{StaticResource MultiSelection}"/>
  138.                                 </DataTrigger>
  139.                                 <DataTrigger Binding="{Binding Path=SelectionMode}" Value="3">
  140.                                     <Setter TargetName="items" Property="ContentTemplate" Value="{StaticResource MultiQuantitySelection}"/>
  141.                                 </DataTrigger>
  142.                             </DataTemplate.Triggers>
  143.  
  144.                         </DataTemplate>
  145.                     </ItemsControl.ItemTemplate>
  146.                     <ItemsControl.ItemsPanel>
  147.                         <ItemsPanelTemplate>
  148.                                 <StackPanel  Orientation="Vertical"></StackPanel >
  149.                         </ItemsPanelTemplate>
  150.                     </ItemsControl.ItemsPanel>
  151.  
  152.  
  153.  
  154.                 </ItemsControl>
  155.                   </ScrollViewer>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement