-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UniformGrid does not adjust layout when Columns property changes. #3082
Comments
I guess it's lacking |
Experiencing this problem too, but with different layout: public ObservableCollection<ShellPage>? Items { get; set; } <ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="1" Columns="{Binding Items, Converter={StaticResource CollectionToItemsCount}}"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel> Workaround: // Fody.PropertyChanged delegate
public void OnPropertyChanged(string propertyName, object before, object after)
{
if (propertyName == nameof(Items))
{
if (before != null && before is ObservableCollection<ShellPage> bItems)
bItems.CollectionChanged -= ItemsChanged;
if (after != null && after is ObservableCollection<ShellPage> aItems)
aItems.CollectionChanged += ItemsChanged;
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private void ItemsChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
switch (e.Action)
{
case NotifyCollectionChangedAction.Add:
case NotifyCollectionChangedAction.Remove:
case NotifyCollectionChangedAction.Reset:
OnPropertyChanged(nameof(Items));
break;
case NotifyCollectionChangedAction.Move:
case NotifyCollectionChangedAction.Replace:
default:
break;
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Changes to the Columns property do not appear to trigger a layout recalculation for the UniformGrid.
In the following example, moving the slider changes the SliderValue VM property, but the changes are not reflected in the UniformGrid (the rendered columns are always at the default of 7):
The text was updated successfully, but these errors were encountered: