return all Items

10 posts, 0 answers
  1. Davood
    Davood avatar
    21 posts
    Member since:
    Dec 2010

    Posted 25 May 2011 Link to this post

    hi
    i need return all item rad tree view in hierarchical mode?
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 25 May 2011 Link to this post

    Hello Davood,

    Could you please elaborate more on your scenario ? Is your tree databound or it is populated declaratively ? Do you need to access only the root collection or you need to iterate in depth (perform some kind of search) ?

    Kind regards,
    Petar Mladenov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Davood
    Davood avatar
    21 posts
    Member since:
    Dec 2010

    Posted 26 May 2011 Link to this post

     

    Thank you for your attention
    my tree is databound
    I need navigation all node tree and  put on a list<T> (node is type of T)
    Recursively have it. But is very slow
    Something like Outlook(inbox/sent/draft,..) tree  which dynamically node are added to the tree With the possibility of recovery and storage node
  5. Davood
    Davood avatar
    21 posts
    Member since:
    Dec 2010

    Posted 29 May 2011 Link to this post

    No one will answer?
  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 31 May 2011 Link to this post

    Hi Davood,

    You can examine this demo showing how RadTreeView is used for navigation in a Master/Detail type of application. Furthermore, this demo shows RadTreeView used for navigation placed in OutlookBar.
    You mentioned that you need recovery/storage mode. I guess you need to save the current state of the RadTreeView(selection, checking, expanded items, etc.) and use this state when needed, The good news is that this will be possible with the Persistance Framework that will be available in the Q2 2011 beta (scheduled for the middle of June). Feel free to ask if you need further assistance or info.

    Kind regards,
    Petar Mladenov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Davood
    Davood avatar
    21 posts
    Member since:
    Dec 2010

    Posted 31 May 2011 Link to this post

    thank you for answer

    but I did not notice, how can I navigate all rad tree node ( for example with foreach) ?
  8. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 06 Jun 2011 Link to this post

    Hello Davood,

    If by navigate you mean traverse the RadTreeView then you can use a foreach operator. Since the RadTreeView is databound, you can work with its ItemsSoucre collection and it will hold all your data items. In a databound RadTreeView most of the collection properties of the tree - ItemsSource, SelectedItems, CheckedItems hold the business objects.

    I am not sure how your business model is defined but if you have a collection of DataItems bound to the ItemsSource RadTreeview collection and each DataItem has a Children collection property, you can:
    foreach(DataItem item in radTreeView.ItemsSource)
    {
      ...
      foreach(DataItem child in item.Children)
      {
       ...
      }
    }
    Is this what you had in mind or am I missing somethig?

    Best wishes,
    Tina Stancheva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Davood
    Davood avatar
    21 posts
    Member since:
    Dec 2010

    Posted 06 Jun 2011 Link to this post

    Thank you very much for Attention and response.
    my tree is:
    <UserControl.Resources>
        <converters:BoolToVisibilityConverter x:Key="boolToVisibilityConverter"/>
        <Style x:Key="TreeViewItemStyle" TargetType="telerikNavigation:RadTreeViewItem">
            <Setter Property="IsExpanded" Value="{Binding IsExpanded}"/>
        </Style>
        <HierarchicalDataTemplate x:Key="TreeViewItemTemplate" ItemsSource="{Binding Items}">
            <StackPanel Orientation="Horizontal">
                <CheckBox IsChecked="{Binding Chart.Active}" Visibility="{Binding Chart.IsEnabled,Converter={StaticResource boolToVisibilityConverter}}">
                    <CheckBox.Style>
                        <Style TargetType="CheckBox"
                       BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:Windows7Theme, ElementType=CheckBox}}"/>
                    </CheckBox.Style>
                </CheckBox>
                <TextBlock Text="{Binding Chart.ChartLevelTitle}" FontFamily="B Nazanin" FontSize="11" Margin="5 0 0 0"/>
                <TextBlock Text="{Binding Chart.Title}" />
            </StackPanel>
        </HierarchicalDataTemplate>
        <DataTemplate x:Key="EditTreeViewTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBox Text="{Binding Chart.Title, Mode=TwoWay}" Margin="5 0 0 0" />
            </StackPanel>
        </DataTemplate>
    </UserControl.Resources>
    <Grid>
        <Border BorderBrush="Black" BorderThickness="1" Width="285" HorizontalAlignment="Left" CornerRadius="4">
            <telerikNavigation:RadTreeView IsEditable="True"  x:Name="treeView" IsExpandOnSingleClickEnabled="False"
                                       IsLineEnabled="True" IsDragDropEnabled="True" IsExpandOnDblClickEnabled ="True"
                                       ItemContainerStyle="{StaticResource TreeViewItemStyle}" IsTextSearchEnabled="True"
                                       ItemsSource="{Binding Items}" ItemTemplate="{StaticResource TreeViewItemTemplate}"
                                       ItemEditTemplate="{StaticResource EditTreeViewTemplate}">
                <telerikNavigation:RadContextMenu.ContextMenu >
                    <telerikNavigation:RadContextMenu x:Name="contextMenu" ItemClick="OnItemClick" Opened="OnMenuOpened" FlowDirection="RightToLeft" >
                        <telerikNavigation:RadMenuItem Header="سطوح سازمان" IsEnabled ="False"  FontWeight="Heavy" />
                        <telerikNavigation:RadMenuItem IsSeparator="True" />
                        <telerikNavigation:RadMenuItem Header="درج" x:Name="insertNode" />
                        <telerikNavigation:RadMenuItem Header="سابقه" x:Name="historyNode" />
                        <telerikNavigation:RadMenuItem IsSeparator="True" />
                    </telerikNavigation:RadContextMenu>
                </telerikNavigation:RadContextMenu.ContextMenu>
            </telerikNavigation:RadTreeView>
        </Border>
    </Grid>
    Possible to Create and remove and update the node by user is exists.
    We need that after pressing confirm, all node which have been created by the user Add To list.
    We had the following ways. that this method is slow:
    public IList<Chart> GetChartsForInsert()
            {
                foreach (var item in treeView.Items)
                {
                    RecursiveItems((item as Chart.InsertDataItem));
                }
      
                Singleton.Instance().BasMbs.CanInsertChart(_insertList);
                return _insertList;
            }
      
      
    private void RecursiveItems(Chart.InsertDataItem dataItem)
            {
                foreach (Chart.InsertDataItem item in dataItem.Items)
                {
                    if (item.Parent.Chart.Id != Guid.Empty)
                        item.Chart.ParentId = item.Parent.Chart.Id;
      
                    if (item.IsNew)
                        _insertList.Add(item.Chart);
                    else
                        _updateList.Add(item.Chart);
      
                    if (item.Items.Count > 0)
                    {
                        RecursiveItems(item);
                    }
                }
            }
    Please guide whether is way for return all RadTree node are?
  10. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 09 Jun 2011 Link to this post

    Hello Davood,

    I can see you are performing some kind of DFS iteration over the tree hierarchy which is not slow operation in the average case. I did not actually understand do you need to add into list only the items that you have edited. If so, you can add every Item immediately after the edit is completed. Could this fit in your scenario?

    Regards,
    Petar Mladenov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  11. Davood
    Davood avatar
    21 posts
    Member since:
    Dec 2010

    Posted 11 Jun 2011 Link to this post

    thank you for answer .My problem was solved
Back to Top
UI for WPF is Visual Studio 2017 Ready