I'm currently working on some UI controls in Silverlight. Now I need to figure out some mathematical equation in order to figure out at what position an item should be inserted. Basically, the item to be inserted is inside a Grid at some odd row (1, 3, 5... you known, odd numbers). Once I click on the item, it should be taken out from the Grid and inserted into an ObservableCollection<T>. The relationship between the collection and the grid is that for every item in the collection, two rows in the Grid are created, so basically, the item at index 0 of the collection is also at row 0 of the Grid, but item 1 of the collection is at row 2 of the Grid and so on... When the user hovers over the odd row, a semi-transparent item appears and when the user clicks on the item, it should be inserted into the collection at the relative position.
I've been trying to find a pattern that I can use, but I just couldn't. It gets harder as more items are added, but I'm sure there has to be some equation to figure it out...
I've been trying to find a pattern that I can use, but I just couldn't. It gets harder as more items are added, but I'm sure there has to be some equation to figure it out...