Disable ScrollBar when StackPanl is adding

3 posts, 0 answers
  1. Valentin
    Valentin avatar
    73 posts
    Member since:
    Mar 2016

    Posted 20 Sep Link to this post

    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. Dinko
    Admin
    Dinko avatar
    201 posts

    Posted 23 Sep Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Valentin
    Valentin avatar
    73 posts
    Member since:
    Mar 2016

    Posted 14 Oct in reply to Dinko Link to this post

    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.

Back to Top