Empty space when items invisible

10 posts, 0 answers
  1. Henk
    Henk avatar
    113 posts
    Member since:
    Apr 2006

    Posted 24 Dec 2010 Link to this post

    Hi,

    when filling dynamically a radtreeview some treeviewitems needs to be hide.
    howhever setting the visibilty to collapsed works but an empty space remains in the treeview for each hided item.
    to remove the empty space I follow the example from the forum:
    "How to Change the Default Height of a TreeViewItem"
    I define the following style:
      <Style TargetType="telerik:RadTreeViewItem" x:Key="HideTreeViewItemStyle">
        <Setter Property="MinHeight" Value="0"></Setter>
        <Setter Property="MaxHeight" Value="0"></Setter>
      </Style>
     
    In code behind I do the following:
    RadTreeViewItem NewItem = new RadTreeViewItem();
    NewItem.Visibility = Visibility.Collapsed; // to hide the view item
    NewItem.ItemContainerStyle = this.Resources["HideTreeViewItemStyle"] as Style; // to remove the remaining empty space
     
    but is not helping (the empty space still there, see attach screen shot)

    Any solutions are welcome..

    Henk
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 28 Dec 2010 Link to this post

    Hi Henk,

    Regarding your style question,y you have to use the Style property of the RadTreeViewItem instead of ItemContainerStyle. But still your issue cannot be resolved this way due to a bug in the TreeView.
    A possible workaround could be a kind of "restriction" to the collection passed to the RadTreeView. However, this is not preferred approach. We would highly appreciate if you can elaborate more on your scenario and especially what is your ultimate goal? Do you really need to add a collapsed RadTreeViewitems in your tree? This way we could advice you much better and try to avoid the rude workarounds.

    Kind regards,
    Petar Mladenov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
  4. Henk
    Henk avatar
    113 posts
    Member since:
    Apr 2006

    Posted 28 Dec 2010 Link to this post

    Hi Petar,

    A bummer that my problem cannot be solved using standard properties of the radtreeview because of the bug. Yes, I can parallel used a list to filter the items needed and dynamically feed the treeview. I am afraid this solution will give more flickering when refreshing. The application we build is an advanced and intelligent workflow application where for example questions are dynamically generated based on conditions that can be dependent from 1 or more questions or other actions (like calculation, subprocesses, database procedures or silverlight screens or reports) and only the questions that are relevant are presented (that is why I used the visibility property). But the hide items (not relevant because of some conditions) are still occupy space....

    I hope I will not have to wait months before, like my other RIA services problem with ORM (the screens we used also in our workflow) , that I am still waiting after promisses and promisses!

    Henk
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 30 Dec 2010 Link to this post

    Hello Henk,

    You can vote for this issue in our PITS (Issue ID 1556 - TreeView: TreeViewItems are not added correctly when Visibility=Hidden ) here and this way we would take it into consideration if it has enough votes.
    If you don`t want to use dynamical filtering and your tree is not virtualized, you can try the following:
    <telerik:RadTreeView Name="tree" >
                    <telerik:RadTreeView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel />
                        </ItemsPanelTemplate>
                    </telerik:RadTreeView.ItemsPanel>
                </telerik:RadTreeView>
    Hope this will fit in your situation.


    Regards,
    Petar Mladenov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  6. Henk
    Henk avatar
    113 posts
    Member since:
    Apr 2006

    Posted 04 Jan 2011 Link to this post

    Nope, the proposed solution does not work :-(

    Henk
  7. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 04 Jan 2011 Link to this post

    Hello Henk,

    Is your tree virtualized? It would be nice if you could provide your project ( or at least your xaml )so that we could think up a workaround? Thank you for your cooperation.

    All the best,
    Petar Mladenov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  8. Henk
    Henk avatar
    113 posts
    Member since:
    Apr 2006

    Posted 05 Jan 2011 Link to this post

    Hi Petar,

    No, the tree is not virtualized but fully in code behind.

    Henk
  9. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 10 Jan 2011 Link to this post

    Hello Henk,

    You could send us a support ticket with your code and you shouldn`t worry about privacy. This way we would investigate the this issue in depth. Thank you in advance. 

    Greetings,
    Petar Mladenov
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  10. Tobias
    Tobias avatar
    28 posts
    Member since:
    Jun 2013

    Posted 16 Sep 2013 Link to this post

    Hi,
    do you fixed your problem? It would be nice to hear from you. :)

    Regards,
    - Tobias
  11. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 18 Sep 2013 Link to this post

    Hello Tobias,

    The best way to understand when a bug is fixed is to follow the PITS item. If you do, we will send you an email when its status is changed.

    Hence, we suggest you follow the issue that is important for you.

    Thank you for understanding.

    Regards,
    Pavel R. Pavlov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
DevCraft banner