Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 3e187df

Browse files
committed
Make Snapplines also work for Items in other Containers
1 parent 3dd4916 commit 3e187df

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,29 @@ void CreateSurface(PlacementOperation operation)
178178
}
179179
}
180180

181+
private IEnumerable<DesignItem> AllDesignItems(DesignItem designItem = null)
182+
{
183+
if (designItem == null)
184+
{
185+
designItem = this.ExtendedItem.Services.DesignPanel.Context.RootItem;
186+
yield return designItem;
187+
yield return designItem.ContentProperty.Value;
188+
designItem = designItem.ContentProperty.Value;
189+
}
190+
//yield return designItem.ContentProperty.Value;
191+
192+
if (designItem.ContentProperty.IsCollection)
193+
foreach (var collectionElement in designItem.ContentProperty.CollectionElements)
194+
{
195+
yield return collectionElement;
196+
197+
foreach (var el in AllDesignItems(collectionElement))
198+
{
199+
yield return el;
200+
}
201+
}
202+
}
203+
181204
void BuildMaps(PlacementOperation operation)
182205
{
183206
horizontalMap = new List<Snapline>();
@@ -188,7 +211,7 @@ void BuildMaps(PlacementOperation operation)
188211

189212
AddLines(containerRect, 0, false);
190213

191-
foreach (var item in ExtendedItem.ContentProperty.CollectionElements
214+
foreach (var item in AllDesignItems() /* ExtendedItem.ContentProperty.CollectionElements */
192215
.Except(operation.PlacedItems.Select(f => f.Item)))
193216
{
194217
var bounds = GetPosition(operation, item);

0 commit comments

Comments
 (0)