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)

Updates to the Panel and Treeview Controls

Pete Brown - 14 November 2007

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)

 

   
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. 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
  3. 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.
  4. 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
  5. 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.
  6. 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.
  7. 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
  8. 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.
  9. 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

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