private void PrepareModel(FrameworkElement elt, object item) { int index = Items.IndexOf(item); // Update the positions of all model items foreach (Visual3D m in _modelContainer.Children) { int val = (int)m.GetValue(LinkedElementPositionProperty); if (val >= index) { m.SetValue(LinkedElementPositionProperty, val + 1); } } ModelUIElement3D model = CreateMeshModel(elt); model.SetValue(LinkedElementPositionProperty, index); _modelContainer.Children.Insert(index, model); model.SetValue(LinkedElementProperty, elt); elt.SetValue(LinkedModelProperty, model); if (IsLoaded) { ReflowItems(); } }
private void PrepareModel(FrameworkElement elt, object item) { int index = Items.IndexOf(item); ModelUIElement3D model = CreateMeshModel(elt); _modelContainer.Children.Insert(index, model); model.SetValue(LinkedElementProperty, elt); elt.SetValue(LinkedModelProperty, model); if (IsLoaded) { ReflowItems(); } }