We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SelectedTreeItem

Thread ID:

Created:

Updated:

Platform:

Replies:

130727 May 29,2017 03:20 PM UTC Jun 5,2017 04:02 AM UTC WPF 4
loading
Tags: TreeViewAdv
Forstmeier Peter
Asked On May 29, 2017 03:20 PM UTC

Hi all togehter,

i use the TreeViewAdv Control in my WPF Application.

<ScrollViewer Grid.Row="1">
            
            <syncfusion:TreeViewAdv x:Name="Tree"
                

                ItemsSource="{Binding ProjectsView}"
                SelectedTreeItem="{Binding SelectedProject,Mode=TwoWay}"
                AllowMultiSelect="False"
        
                SelectionChanged="Tree_SelectionChanged"
            >
                
                <syncfusion:TreeViewAdv.ItemTemplate>
                    <HierarchicalDataTemplate ItemsSource="{Binding SubProjects}" >
                        <ContentControl Content="{Binding}"
                                        ContentTemplate="{StaticResource ProjectsSelectionTemplate}" />
                    </HierarchicalDataTemplate>
                </syncfusion:TreeViewAdv.ItemTemplate


                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="MouseDoubleClick">
                        <i:InvokeCommandAction
                            Command="{Binding EntitySelectedCommand,diag:PresentationTraceSources.TraceLevel=High}" >
                        </i:InvokeCommandAction>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </syncfusion:TreeViewAdv>
        </ScrollViewer>

Part of ViewModel wher PrpjectsView i typeop ICollectionView

ProjectDto _selectedProject;
        public ProjectDto SelectedProject {
            get {return _selectedProject;}
            set {
                
                SetProperty(ref _selectedProject,value);
                System.Threading.Thread.Sleep(500);
                if (SelectedProject != null) {
                    Console.WriteLine("Selected {0}",SelectedProject.ProjectName);
                    ProjectsView.MoveCurrentTo(SelectedProject);
                }
            }
        }

When i scroll down the Tree an click an Item, the SelectedTreeItem changes, but, the Tree always jump to the first position.

This works only with he line 'Thread.Sleep(500). If i comment out this line, the tree scrolls only to the first position, so there is no selection.

Any ideas?

Thanks

Peter


Forstmeier Peter
Replied On June 1, 2017 04:28 AM UTC

Hi,

me again.

is nobody outside who can help me.

This is a very serious problem i i never see this behavior bevore.


Thanks

Peter


Venkateshwaran Ramdoss [Syncfusion]
Replied On June 1, 2017 09:18 AM UTC

Hi Peter,   
  
Thank you for contacting Syncfusion Support.   
  
We have validated this reported behavior and it has a problem with AutoScrolling functionality in ScrollViewer control. It has been discussed in below MSDN article.    
   
   
As explained in above MSDN article, this reported behavior can be resolved handling RequestBringIntoView event. Kindly make use of the below code example for your reference.   
   
Code example   
   
XAML   
   
<syncfusion:TreeViewAdv  x:Name="TreeView"RequestBringIntoView="TreeView_RequestBringIntoView"    
ItemsSource="{Binding Customers}" SelectedTreeItem="{BindingSelectedTreeItem,Mode=TwoWay}">   
   
   
C#   
   
private void TreeView_RequestBringIntoView(object sender, RequestBringIntoViewEventArgse)   
        {   
            e.Handled = true;   
        }   
   
   
We have also prepared sample and video for your reference and it can be downloaded from the below link.   
   
  
  
Please check the above solution and let us know if it is helpful.   
  
Regards,   
Venkateshwaran V.R.   
 


Forstmeier Peter
Replied On June 2, 2017 07:15 AM UTC

Works perfectly

Thanks a lot

Peter


Vijayalakshmi Roopkumar [Syncfusion]
Replied On June 5, 2017 04:02 AM UTC

Hi Peter

Thank you for your update.

Please let us know if you need any further assistance on this.

Regards,
Vijayalakshmi V.R.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;