WPF
An ObservableCollection in WPF is a dynamic data collection that provides notifications when items get added, removed, or when the whole list is refreshed. It’s especially useful for data binding in applications because it automatically updates the UI when the data in the collection changes.
Here are some key points about ObservableCollection:
Namespace: ObservableCollection is part of the System.Collections.ObjectModel namespace.
Notifications: It implements the INotifyCollectionChanged interface, which means it raises events when the collection changes, allowing the UI to update automatically.
Common Uses: It’s often used in scenarios where you want to bind a collection to a UI control, such as a ListBox, ComboBox, or DataGrid, and have the UI reflect changes to the collection in real-time.
To rotate an image indefinitely in WPF using XAML
<Window x:Class="WpfApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Image Source="your_image.png" Width="200" Height="200">
<Image.RenderTransform>
<RotateTransform x:Name="rotateTransform" CenterX="100" CenterY="100"/>
</Image.RenderTransform>
<Image.Triggers>
<EventTrigger RoutedEvent="Image.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="rotateTransform"
Storyboard.TargetProperty="Angle"
From="0" To="360" Duration="0:0:5"
RepeatBehavior="Forever"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
</Grid>
</Window>