Welcome to Pete Brown's 10rem.net

First time here? If you are a developer or are interested in Microsoft tools and technology, please consider subscribing to the latest posts.

You may also be interested in my blog archives, the articles section, or some of my lab projects such as the C64 emulator written in Silverlight.

(hide this)

14 Nov 2007

Updates to the Panel and Treeview Controls

   

I made some updates to the panel and treeview controls described in this post.

  1. Changed the name from AnimatedWrapPanel to AnimatedFlowPanel to be more consistent with established panel names
  2. Added Vertical layout to the AnimatedFlowPanel
  3. Tweaked the icon for the Treeview 
  4. Added a "using" around the stream in ControlBase.LoadXaml
  5. Changed the demo app so when you click a treeview node, it changes the AnimatedFlowPanel's orientation
  6. Added a bunch of random shapes to the panel to show how it handles shapes of various sizes

There's more to go, but I'll likely defer any work on these until we get an updated Silverlight 1.1 control model.

You can run the demo here. (same site as the old one)

You can download the code here. (new zip file)

 

Share |
posted by Pete Brown on Wednesday, November 14, 2007
filed under:    

20 comments for “Updates to the Panel and Treeview Controls”

  1. MrCypromsays:
    It seems that Orientation is now only vertical.
    When I resize horizontaly, the thumbnails don't move.
    In UpdateLayout I can see that you implemented the two orientations. So why this behavior ?

    Regards.
  2. MrCypromsays:
    I am very sorry for my previous post. I checked too fast your upgrades.

    Regards.
  3. Pete Brownsays:
    No problem. Glad it's working for you :)

    Pete
  4. Mike Wolfsays:
    doesn't seem to like osx / firefox
    http://nzduhw.bay.livefilestore.com/y1pfoLaKHBy7o9yIcMqSGTvj-4Fj5lOifSrluMPQdBgBfs2_FJ4ywXoK3cGR1n32K-XUZTBq-mx4Ao9w_7qsMICpA/Picture%201.png
  5. Pete Brownsays:
    Hi Mike

    One of two things happened there:
    1. The code doesn't work under osx
    2. The background "this is a test" code that I was trying out that doesn't work in IE7, actually works on the mac.

    I commented-out the background junk. If you get a moment and can try again, please do.

    Unfortunately I don't have a mac handy to try it out myself. It does work on FF on Windows, though.

    Pete
  6. Mike Wolfsays:
    you got it. great
  7. Pete Brownsays:
    Scary that that worked on the mac! I'll need to be careful when messing around with layering controls over Silverlight.

    Thanks for point that issue out.

    Pete
  8. MrCypromsays:
    I integrated your code in my projet. I changed the namespaces.

    I get an assembly missing error when I use x:Name so I have to replace it with Name. But obviously I can't directly interact with my control (without findname).

    Do you have an explication ?

    Regards.
  9. Pete Brownsays:
    Unless your code is in the main Page, you have to use FindName; there's no other way right now. That's the way Silverlight 1.1 alpha works in its current state.

    On the x: bit, make sure your namespaces are set up correctly in your xaml. If you leave off the required xmlns:x= bit, you will get that error.

    The assembly missing error is puzzling. I'd have to look at your xaml to understand what is going on there.

    Pete
  10. MrCypromsays:
    Hi,

    There is a problem with your TreeView.
    When I create a TreeNode and add it in another and then I test the parentNode of the one added the parent is Null. I checked your code and I did not find where you set the parent of a TreeNode added in another one.
    Am I right ?

    Regards.
  11. Pete Brownsays:
    You're right on the parentNode bit. I never implemented that. I will on the next rev. My apologies for not noting that in the readme.

    Thanks.

    Pete
  12. MrCypromsays:
    Hi,

    No problem.

    I have a weird error : It is when I inherit from your FlowPanel, and try to use my control.
    Your "try catch" in LoadXaml gives me this error :
    "InitializeFromXaml may not be called more than once"

    Do you have an idea ?

    Regards.
  13. MrCypromsays:
    I found that LoadXaml function is called twice because of inheritance.

    So I can't inherit your controls.
    Do you have a solution ?

    regards ?
  14. Pete Brownsays:
    Much like the Silverlight 1.1 SDK, the intent of the controls is to show examples of how you can build your own controls, and to give you a foundation of source code you can use to create your own.

    I haven't looked at an inheritance scenario and didn't consider it when coming up with the samples. I should make marked them sealed to amke that more obvious.

    I have a bunch of demos to prepare for an upcoming event. TIme permitting, I'll revisit these controls here, so please post/email any other questions or suggestions you have.

    Pete
  15. Anandsays:
    if i add more node in Page.xaml.cs for treeview. It does not show vertical scrollbar. You have made a class file for that but there is no code for it. Can u give some idea how i can make scrollbar in treeview.
  16. Pete Brownsays:
    Hi Anand

    I haven't looked at this code in a while, so I don't recall if I put in anything that will help.

    There is a scroll panel/viewer example with the sdk. That may help you out. Basically you have one very large canvas, sized to hold all the nodes (you have to resize it based on expansion) and a containing canvas with clip bounds set to its own extents. You then slap a scrollbar on the right and use it to move one canvas around inside the other.

    I'll revisit these controls when 2.0 comes out, but continuining them in 1.1 is counter productive for me at the moment.

    Pete
  17. Pankajsays:
    there is no scrollbar in treeview. I want scrollbar.
  18. Chris Pietschmannsays:
    Have you done any work on coverting this code over to Silverlight 2 Beta 1?
  19. Pete Brownsays:
    Hi Chris

    Not yet. It's on my radar, but I won't get to it for a bit.

    Pete
  20. sudarshansays:
    Is there any updated version of tree view in SL beta 2.0?

Comment on this Post

Remember me

2 trackbacks for “Updates to the Panel and Treeview Controls”

  1. POKE 53280,0: Pete Brown's Blog : Silverlight 1.1 TreeView and Animated Wrap Panel Controls with Source Codesays:
    PingBack from http://community.irritatedvowel.com/blogs/pete_browns_blog/archive/2007/11/01/Silverlight-1.1-TreeView-and-Animated-Wrap-Panel-Controls-with-Source-Code.aspx
  2. POKE 53280,0: Pete Brown's Blogsays:
    In a break from some of my previous Silverlight talks, today at the NoVA Code Camp, I did a mostly slideless