I have a WPF Form with SizeToContent="Height"
and only a Listbox
in it. During runtime severall items will be added to the ObservableCollection
the Listbox
is bound to and the Listbox
will expand.
This works just fine but the problem is that I want to keep the Form in the bottom right corner always.
I added the CollectionChanged Event:
((INotifyCollectionChanged)History.ItemsSource).CollectionChanged +=new NotifyCollectionChangedEventHandler(HistoryCollectionChanged);
Snd implemented it the following way:
private void ClipsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) {
var desktopWorkingArea = System.Windows.SystemParameters.WorkArea;
this.Left = desktopWorkingArea.Right - this.ActualWidth;
this.Top = desktopWorkingArea.Bottom - this.ActualHeight;
}
But although the event gets triggered every time, the positioning is always off.