This is a migrated thread and some comments may be shown as answers.

Empty space when items invisible

9 Answers 181 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Henk
Top achievements
Rank 1
Henk asked on 24 Dec 2010, 01:13 PM
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

9 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 28 Dec 2010, 07:01 PM
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
0
Henk
Top achievements
Rank 1
answered on 28 Dec 2010, 10:09 PM
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
0
Petar Mladenov
Telerik team
answered on 30 Dec 2010, 12:33 PM
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
0
Henk
Top achievements
Rank 1
answered on 04 Jan 2011, 07:16 PM
Nope, the proposed solution does not work :-(

Henk
0
Petar Mladenov
Telerik team
answered on 04 Jan 2011, 07:24 PM
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
0
Henk
Top achievements
Rank 1
answered on 05 Jan 2011, 07:58 PM
Hi Petar,

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

Henk
0
Petar Mladenov
Telerik team
answered on 10 Jan 2011, 01:30 PM
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>>
0
Tobias
Top achievements
Rank 1
answered on 16 Sep 2013, 08:58 AM
Hi,
do you fixed your problem? It would be nice to hear from you. :)

Regards,
- Tobias
0
Pavel R. Pavlov
Telerik team
answered on 18 Sep 2013, 01:50 PM
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 >>
Tags
TreeView
Asked by
Henk
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Henk
Top achievements
Rank 1
Tobias
Top achievements
Rank 1
Pavel R. Pavlov
Telerik team
Share this question
or