I would like to bind a stackpanel to an ObservableCollection(Of Grid), but I don't know how :-(
At the moment I use CollectionChanged event and NotifyCollectionChangedAction, in this way I can Add/Remove object, but not move it. I can change index of collection items, but how can I move object in the stackpanel?
This is a piece of my xaml
<ScrollViewer Name="StickyScroll" Grid.Row="1" CanContentScroll="True" VerticalScrollBarVisibility="Auto">
<StackPanel Name="DockSticky" >
<StackPanel.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="{Binding Path=DockBackColor}" Offset="0"/>
<GradientStop Color="Transparent" Offset="3"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</StackPanel.Background>
<StackPanel.ContextMenu>
<ContextMenu>
<MenuItem Click="newTextITEM" Header="New Textbox" />
<MenuItem Click="NewChkITEM" Header="NewCheckBOX" />
<Separator />
<MenuItem Click="closeSticky" Header="Close Sticky" />
<MenuItem Header="Move UP" />
<MenuItem Header="Move Down" />
<Separator />
<MenuItem Click="closeProgram" Header="Exit Program" />
<!--<MenuItem Click="Collapse" Header="Collapse" />-->
</ContextMenu>
</StackPanel.ContextMenu>
</StackPanel>