Skip to content

Instantly share code, notes, and snippets.

@karno
Created December 19, 2013 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karno/8035591 to your computer and use it in GitHub Desktop.
Save karno/8035591 to your computer and use it in GitHub Desktop.
<Window x:Class="Karno.Xac.Sample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:sample="clr-namespace:Karno.Xac.Sample"
Title="MainWindow"
Width="400"
Height="400">
<Window.DataContext>
<sample:MainWindowViewModel />
</Window.DataContext>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<ei:CallMethodAction MethodName="Loaded" TargetObject="{Binding}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="32" Text="時間: " />
<TextBlock FontSize="32" Text="{Binding CurrentTimeSec}" />
</StackPanel>
<ItemsControl Grid.Row="1"
AllowDrop="True"
ItemsSource="{Binding Collection}">
<i:Interaction.Behaviors>
<sample:DragAcceptBehavior Description="{Binding Description}" />
</i:Interaction.Behaviors>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Width="120"
Height="120"
Background="#FF1BA1E2"
BorderBrush="White"
BorderThickness="3">
<i:Interaction.Behaviors>
<sample:DragStartBehavior AllowedEffects="Move" DragDropData="{Binding}" />
</i:Interaction.Behaviors>
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="60"
Foreground="White"
Text="{Binding}"
TextAlignment="Center" />
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Window>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment