は、私は、このXAMLコードC#WPFのItemsControlの項目移動アニメーション
<ItemsControl ItemsSource="{Binding CellItems}" Background="Black">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter">
<Setter Property="Canvas.Left" >
<Setter.Value>
<MultiBinding Converter="{StaticResource MultiplierConverter}">
<Binding Path="J"></Binding>
<Binding Path="DataContext.ItemSize" ElementName="ThisControl"></Binding>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="Canvas.Top" >
<Setter.Value>
<MultiBinding Converter="{StaticResource MultiplierConverter}">
<Binding Path="I"></Binding>
<Binding Path="DataContext.ItemSize" ElementName="ThisControl"></Binding>
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
</ItemsControl.ItemContainerStyle>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Width="{Binding ElementName=ThisControl, Path=DataContext.ItemSize}"
Height="{Binding ElementName=ThisControl, Path=DataContext.ItemSize}"
Style="{StaticResource CellItemBorderStyle}">
<Border.InputBindings>
<MouseBinding MouseAction="LeftClick"
Command="{Binding DataContext.MoveCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ItemsControl}}}"
CommandParameter="{Binding}"/>
</Border.InputBindings>
<TextBlock Text="{Binding Value}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="{Binding ElementName=ThisControl, Path=DataContext.ItemSize, Converter={StaticResource SingleMultiplierConverter}, ConverterParameter=0.4}"
Style="{StaticResource CellItemTextBlockStyle}"/>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
CellItemsを持っているのItemsControl
でアニメーションについて少し疑問を持っているが
public List<CellItem> CellItems { get; set; }
CellItemがある私のViewModel内のプロパティです私のクラス:
public class CellItem : ViewModelBase
{
public int Value { get; set; }
private int i;
public int I
{
get { return this.i; }
set
{
this.i = value;
this.OnPropertyChanged(nameof(this.I));
}
}
private int j;
public int J
{
get { return this.j; }
set
{
this.j = value;
this.OnPropertyChanged(nameof(this.J));
}
}
}
IおよびJプロパティがItemsControl.ItemContainerStyleでバインドされています
I(またはJ)プロパティを変更するとアニメーションを行うにはどうすればよいですか?
お気軽にご相談ください
ありがとうございました!
更新済み
アイテムをクリックすると、アイテムは移動していますが、アニメーションは表示されません。私はアニメーションで移動を実現する必要があるが、私はどのように... DoubleAnimation、ストーリーボード分からないのですか?...
何をするかわからないのですか? _あなたは何を問題にしていますか?いつどのようにアニメーションをトリガーするのですか?どのようにアニメーション自体を実装するには?試したことを明確に示す良い[mcve]を持つようにコードを単純化し、そのコードが何をしているのか、また何をしたいのかを正確に説明してください。 –