private void OnLayoutUpdated(object sender, object e) { if (_panel == null) { _panel = base.ItemsPanelRoot as VariableSizedGridPanel; if (_panel != null) { _panel.IsReady = true; _panel.SetBinding(VariableSizedGridPanel.OrientationProperty, new Binding { Source = this, Path = new PropertyPath("Orientation") }); _panel.SetBinding(VariableSizedGridPanel.AspectRatioProperty, new Binding { Source = this, Path = new PropertyPath("AspectRatio") }); _panel.SetBinding(VariableSizedGridPanel.MaximumRowsOrColumnsProperty, new Binding { Source = this, Path = new PropertyPath("MaximumRowsOrColumns") }); } } }