Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to get the Item of a 0 based intex collection

$
0
0

Dear all,

I have the follwoing code snipet that I try to use in order to retrive each items from a collection :

for (int i = 0, count = Items.Count; i < count; i++)
            {
				var ri = Items.GetItemAt(i) as RadialMenuItem;
				var angleDelta = 360.0 / count;
				var angleShift = ri.HalfShifted ? -angleDelta / 2 : 0;
				var startAngle = angleDelta * i + angleShift;
				var rotation = startAngle + angleDelta / 2;

				ri.AngleDelta = angleDelta;
				ri.StartAngle = startAngle;
				ri.Rotation = rotation;


					//Items[i].AngleDelta = angleDelta;
					//Items[i].StartAngle = startAngle;
					//Items[i].Rotation = rotation;
				            }

What is wierd is that the Items.GetItemAt(i) is returning NULL and my collection is containing 2 items of type RadialMenuItem.

My Items collection is of type ItemCollection from my ItemsControl.Items

How can I retriev the item from a given index position ?

Any idea ?

Thanks for help

regards


Viewing all articles
Browse latest Browse all 18858


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>