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

Disable ScrollBar when StackPanl is adding

2 Answers 473 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Valentin
Top achievements
Rank 1
Iron
Iron
Valentin asked on 20 Sep 2016, 02:08 PM

Hello Télérik,

 

I'm using a RadTreeView, and in my RadOutlookBarItem, when I added a StackPanel or a Grid, my Vertical and Horizontal ScrollBar are disabled. I can't use them, and the bottom of the Tree is going to infinity... (I can't see the last items)

 

Do you know where come from this problem ?

 

My code :

<telerik:RadSplitContainer InitialPosition="DockedLeft" x:Name="splitContainerMain">
                <telerik:RadPaneGroup x:Name="radPaneArbo">
                    <telerik:RadDocumentPane PaneHeaderVisibility="Visible" Header="Navigateur" IsEnabled="True" CanFloat="True" CanUserClose="False">
                        <telerik:RadOutlookBar x:Name="navigationBar">
                            <telerik:RadOutlookBarItem  x:Name="navigationStationVariables" Header="Stations et Variables">
                                <!--<StackPanel Orientation="Vertical">-->
                                    <!--<Grid VerticalAlignment="Top" Height="50px">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="Auto" />
                                        </Grid.ColumnDefinitions>
                                        <telerik:RadAutoCompleteBox Name="autocomplete" ItemsSource="{Binding Stations}"
                                                                    TextSearchPath="Code" SelectionMode="Single" WatermarkContent="Entrée une variable de test.."
                                                                    DropDownItemTemplate="{StaticResource StationsSearchAutoComplete}" BorderBrush="#FF25A0DA" BorderThickness="1" Height="30"
                                                                    SelectionChanged="autocomplete_SelectionChanged"
                                                                    />
                                    </Grid>-->
                                    <!--<Grid VerticalAlignment="Top" Height="950px">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto" />
                                        </Grid.ColumnDefinitions>-->
                                        <telerik:RadTreeView
                                        Name="treeViewStationsVariables"
                                        ItemTemplateSelector="{StaticResource ArboStationFinalTemplateSelector}"
                                        BorderThickness="1" Background="White"  PreviewMouseRightButtonUp="treeViewStationsVariables_PreviewMouseRightButtonUp"
                                        ScrollViewer.VerticalScrollBarVisibility="Visible"  >
                                            <telerik:RadTreeView.ContextMenu>
                                                <ContextMenu x:Name="treeViewNavigateurVisualisation" Placement="Left">
                                                    <ContextMenu.PlacementTarget>
                                                        <UIElement />
                                                    </ContextMenu.PlacementTarget>
                                                    <MenuItem x:Name="treeViewMenuItemVisualiserAjouterGraphique" Header="Ajouter au Graphique" Click="treeViewMenuItemVisualiserAjouterGraphique_Click"/>
                                                    <MenuItem x:Name="treeViewMenuItemVisualiserNouveauGraphique" Header="Nouveau Graphique" Click="treeViewMenuItemVisualiserNouveauGraphique_Click"/>
                                                </ContextMenu>
                                            </telerik:RadTreeView.ContextMenu>
                                            <telerik:RadTreeView.Resources>
                                                <HierarchicalDataTemplate DataType="{x:Type business:Repertoire}" ItemTemplateSelector="{StaticResource ArboStationFinalTemplateSelector}">
                                                    <HierarchicalDataTemplate.ItemsSource>
                                                        <MultiBinding Converter="{StaticResource RepertoireStationConverter}">
                                                            <Binding Path="Stations" />
                                                            <Binding Path="SousRepertoires" />
                                                        </MultiBinding>
                                                    </HierarchicalDataTemplate.ItemsSource>
                                                    <StackPanel Orientation="Horizontal">
                                                        <Image Source="/SIGT.EVEm.Client;component/Images/Navigateur/folder.png"  Width="20" Height="20" />
                                                        <TextBlock Text="{Binding Path=Code}"/>
                                                    </StackPanel>
                                                </HierarchicalDataTemplate>
                                                <HierarchicalDataTemplate DataType="{x:Type business:Station}" ItemsSource="{Binding Variables}" ItemTemplateSelector="{StaticResource ArboVariableTemplateSelector}">
                                                    <TextBlock Text="{Binding Code}"/>
                                                </HierarchicalDataTemplate>
                                            </telerik:RadTreeView.Resources>
                                        </telerik:RadTreeView>
                                    <!--</Grid>-->
                                <!--</StackPanel>-->
                            </telerik:RadOutlookBarItem>
                        </telerik:RadOutlookBar>
                    </telerik:RadDocumentPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>

 

 

2 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 23 Sep 2016, 10:50 AM
Hi Valentin,

When you place the RadTreeView control In StackPanel, ScrollViewer (for example) the default scroll view of the tree will be disabled because of the StackPanel, ScrollViewer measures its children with infinity. You can overcome this behavior by placing the RadTreeView in a Grid like you have done in the provided code snippet. In your case, you can remove Height property of the Grid which you have set and the ScrollBar will appear.
<Grid VerticalAlignment="Top" >
   <Grid.ColumnDefinitions>
       <ColumnDefinition Width="*" />
   </Grid.ColumnDefinitions>

Give this approach a try and let us know if it works for you.

Regards,
Dinko
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Valentin
Top achievements
Rank 1
Iron
Iron
answered on 14 Oct 2016, 09:18 AM

Hello,

 

I tried your solution but it doesn't working for me. So, I find that with a DockPanel, I have the good result :

<DockPanel>
    <telerik:RadAutoCompleteBox Name="autocomplete" ItemsSource="{Binding Stations}" TextSearchPath="Code" SelectionMode="Single" WatermarkContent="Rechercher une station..." DropDownItemTemplate="{StaticResource StationsSearchAutoComplete}" BorderBrush="#FF25A0DA" BorderThickness="1" Height="30" SelectionChanged="autocomplete_SelectionChanged" DockPanel.Dock="Top"/>
 
    <telerik:RadTreeView Name="treeViewStationsVariables" ItemTemplateSelector="{StaticResource ArboStationFinalTemplateSelector}" BorderThickness="1" Background="White" ScrollViewer.VerticalScrollBarVisibility="Visible" AllowDrop="True" PreviewMouseRightButtonUp="treeViewStationsVariables_PreviewMouseRightButtonUp"   >
        <......>
    </telerik:RadTreeView>
 </DockPanel>

 

My ScrollBars working find. Your remarks helped me !

 

Thank you very much for your help.

 

Valentin.

Tags
TreeView
Asked by
Valentin
Top achievements
Rank 1
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Valentin
Top achievements
Rank 1
Iron
Iron
Share this question
or