/// <summary> /// Adds an item to an ItemsControl. /// </summary> /// <param name="that">The ItemsControl instance.</param> /// <param name="item">The item to be inserted.</param> internal static void AddItem(this ItemsControl that, object item) { if (that.ItemsSource == null) { that.InsertItem(that.Items.Count, item); } else { that.ItemsSource.Add(item); } }