This project is read-only.

Why isnt ElementFlow a panel anymore?

Feb 24, 2010 at 4:19 PM
Edited Feb 24, 2010 at 4:23 PM

Hello,

 

I found a blog-entry that shows that ElementFlow changed its base-class to Panel:

http://blog.pixelingene.com/?p=14

Having a look at your SourceCode showed me that you have changed it back to ItemsControl soon. I my own application i have also build a little framework for 3-dimensional panels.

My self-build 3D-Panel works fine but i mentioned a problem using this panel as a ListBoxes ItemsSource: The selection don't work. I was wondering if you had the same problem.

I have described the detailed problem here: https://connect.microsoft.com/VisualStudio/feedback/details/535931/wpf-listbox-selecting-items-failes-if-listboxitems-arent-direct-visual-children-of-the-itemspanel#

 

Maybe microsoft can fix this issue until .NET 4.0 releases. I would be great if you could tell me if this was really the reasony why ElementFlow isnt a panel anymore.

But making a panel is much more comfortable that deriving directly from ItemsControl if you only have to arrange the items. You can use the Panel in differen ItemsControls. You get Selection for free and dont have to implement it by yourself (if the method described in the link above would work).

If you had other reasons to make ElementFlow to a ItemsControl i would also be interrested in hearing them.

 

Greetings,

Lector

Feb 24, 2010 at 6:26 PM

Hi Lector,

           Databinding, selection and navigation were the main reasons for converting ElementFlow (EF) into an ItemsControl. A panel's main purpose is layout and it shouldn't concern itself with navigation styles, selections, etc. However in my experience of using ElementFlow, I was constantly running into issues with Selection and navigation. When EF was a panel, focus was also a big challenge (By default a Panel class is not focusable). Also there was no easy way to setup selections and make them bindable. For example, I cannot bind the SelectedItem of EF-Panel to some other control's property in the view.

If you think of it, selection and navigation are higher level concepts and should not be coupled with the panel. Most often, people were using only one of the layouts and focusing more on selection + navigation + binding. By making EF into an ItemsControl, we can have better control over these features.

I personally think that EF is better off as a custom control than a panel, since it gives us much more flexibility and power.

 

HTH,

Pavan

Feb 25, 2010 at 11:19 AM

Hi pavanpodila,

I understand your problem. You can do linear navigation by implementing IScrollInfo. But you cant really do a nice CarousellView with it.

I have also Problems with the Section. But if you want to show the Selection of a item by changing the 3D-transformation you have problem when you derive from a pure panel.

In my scenario i have a linear ScrollBar and im showing Selections only by highlighting the items. If i will ever implement individual 3D-Transformations i can do this by checking if the Items are Selected in the ArrangeOverride-Methode(). But i agree with you that this isnt the right job for a panel. But i will anyway keep my class derived from VirtualizingPanel because i get a lot of features (scrolling, ItemsSource-Binding...) for free.

Thanks for your hints,

Lector