How to implement auto-Vertical-Scrollbar in a ListView with Datatemplate?ListBox vs. ListView - how to choose for data bindingHow to find a ListView in a DataTemplate?Does my code demonstrate good WPF practice?WPF ListView ScrollbarsWPF ListView no scrollbar if height set to autoVertical scrollbar includes header of ListView in WPFHow to fix Auto Vertical Scrollbar space in ItemsControlWPF listview vertical scrollbarGet vertical scrollbar position of ListViewVertical scrollbar for a listview within an expander

How many people are necessary to maintain modern civilisation?

What is the origin of Scooby-Doo's name?

.NET executes a SQL query and Active Monitor shows multiple rows blocking each other

Explain why a line can never intersect a plane in exactly two points.

"How can you guarantee that you won't change/quit job after just couple of months?" How to respond?

Is there a way, while dragging, to "snap" to the nearest guide?

What does it mean to "control target player"?

If I wouldn't want to read the story, is writing it still a good idea?

How to find the last non zero element in every column throughout dataframe?

Is there a term for the belief that "if it's legal, it's moral"?

What's the difference between a deep fryer and a chip pan?

Can there be an UN resolution to remove a country from the UNSC?

How does DC work with natural 20?

Count All Possible Unique Combinations of Letters in a Word

Loss of power when I remove item from the outlet

Helping ease my back pain when I'm studying 13 hours everyday, even weekends

Ndsolve problem with Sign (friction)

Why does this method with an optional parameter not override the base class method?

Why do all the teams that I have worked with always finish a sprint without completion of all the stories?

Improving triangulation on AutoCAD-generated stl files

How would modern naval warfare have to have developed differently for battleships to still be relevant in the 21st century?

When can you leave off “le/la” to say “it” in French?

Employer wants to use my work email account after I quit

How to make clear to people I don't want to answer their "Where are you from?" question?



How to implement auto-Vertical-Scrollbar in a ListView with Datatemplate?


ListBox vs. ListView - how to choose for data bindingHow to find a ListView in a DataTemplate?Does my code demonstrate good WPF practice?WPF ListView ScrollbarsWPF ListView no scrollbar if height set to autoVertical scrollbar includes header of ListView in WPFHow to fix Auto Vertical Scrollbar space in ItemsControlWPF listview vertical scrollbarGet vertical scrollbar position of ListViewVertical scrollbar for a listview within an expander






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I want to insert this template into a ListView and have the scrollbar apear when I overflow my MaxHeight.



I dont know if it's the ControlTemplate or the DataTemplate or whatever.
DataBinding works though.



I would realy appreciate hints and help



<ListView Grid.Row="8" 
Grid.Column="2"
Margin="5,5,5,5"
HorizontalContentAlignment="Stretch"
MaxHeight="110"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="auto"
ItemsSource="Binding Linie_Erholungsweg_Typen, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged">

<ListView.Template>
<ControlTemplate>
<Border
CornerRadius="4"
BorderThickness="1"
BorderBrush="#333333"
Background="White"
>
<ItemsPresenter></ItemsPresenter>
</Border>
</ControlTemplate>
</ListView.Template>

<ListView.ItemTemplate>
<DataTemplate>
<WrapPanel>
<CheckBox IsChecked="Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" />
<TextBlock Text="Binding Typ" FontWeight="Bold" />
</WrapPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>









share|improve this question






























    1















    I want to insert this template into a ListView and have the scrollbar apear when I overflow my MaxHeight.



    I dont know if it's the ControlTemplate or the DataTemplate or whatever.
    DataBinding works though.



    I would realy appreciate hints and help



    <ListView Grid.Row="8" 
    Grid.Column="2"
    Margin="5,5,5,5"
    HorizontalContentAlignment="Stretch"
    MaxHeight="110"
    ScrollViewer.CanContentScroll="True"
    ScrollViewer.VerticalScrollBarVisibility="auto"
    ItemsSource="Binding Linie_Erholungsweg_Typen, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged">

    <ListView.Template>
    <ControlTemplate>
    <Border
    CornerRadius="4"
    BorderThickness="1"
    BorderBrush="#333333"
    Background="White"
    >
    <ItemsPresenter></ItemsPresenter>
    </Border>
    </ControlTemplate>
    </ListView.Template>

    <ListView.ItemTemplate>
    <DataTemplate>
    <WrapPanel>
    <CheckBox IsChecked="Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" />
    <TextBlock Text="Binding Typ" FontWeight="Bold" />
    </WrapPanel>
    </DataTemplate>
    </ListView.ItemTemplate>
    </ListView>









    share|improve this question


























      1












      1








      1








      I want to insert this template into a ListView and have the scrollbar apear when I overflow my MaxHeight.



      I dont know if it's the ControlTemplate or the DataTemplate or whatever.
      DataBinding works though.



      I would realy appreciate hints and help



      <ListView Grid.Row="8" 
      Grid.Column="2"
      Margin="5,5,5,5"
      HorizontalContentAlignment="Stretch"
      MaxHeight="110"
      ScrollViewer.CanContentScroll="True"
      ScrollViewer.VerticalScrollBarVisibility="auto"
      ItemsSource="Binding Linie_Erholungsweg_Typen, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged">

      <ListView.Template>
      <ControlTemplate>
      <Border
      CornerRadius="4"
      BorderThickness="1"
      BorderBrush="#333333"
      Background="White"
      >
      <ItemsPresenter></ItemsPresenter>
      </Border>
      </ControlTemplate>
      </ListView.Template>

      <ListView.ItemTemplate>
      <DataTemplate>
      <WrapPanel>
      <CheckBox IsChecked="Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" />
      <TextBlock Text="Binding Typ" FontWeight="Bold" />
      </WrapPanel>
      </DataTemplate>
      </ListView.ItemTemplate>
      </ListView>









      share|improve this question
















      I want to insert this template into a ListView and have the scrollbar apear when I overflow my MaxHeight.



      I dont know if it's the ControlTemplate or the DataTemplate or whatever.
      DataBinding works though.



      I would realy appreciate hints and help



      <ListView Grid.Row="8" 
      Grid.Column="2"
      Margin="5,5,5,5"
      HorizontalContentAlignment="Stretch"
      MaxHeight="110"
      ScrollViewer.CanContentScroll="True"
      ScrollViewer.VerticalScrollBarVisibility="auto"
      ItemsSource="Binding Linie_Erholungsweg_Typen, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged">

      <ListView.Template>
      <ControlTemplate>
      <Border
      CornerRadius="4"
      BorderThickness="1"
      BorderBrush="#333333"
      Background="White"
      >
      <ItemsPresenter></ItemsPresenter>
      </Border>
      </ControlTemplate>
      </ListView.Template>

      <ListView.ItemTemplate>
      <DataTemplate>
      <WrapPanel>
      <CheckBox IsChecked="Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" />
      <TextBlock Text="Binding Typ" FontWeight="Bold" />
      </WrapPanel>
      </DataTemplate>
      </ListView.ItemTemplate>
      </ListView>






      wpf






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 5 '16 at 13:29









      ASh

      22.2k43261




      22.2k43261










      asked Jul 5 '16 at 13:21









      John LloydJohn Lloyd

      106




      106






















          3 Answers
          3






          active

          oldest

          votes


















          0














          A solution could be adding a ScrollViewer to your ListView Template:



           <ListView.Template>
          <ControlTemplate>
          <Border CornerRadius="4" BorderThickness="1" BorderBrush="#333333" Background="White">
          <ScrollViewer>
          <ItemsPresenter></ItemsPresenter>
          </ScrollViewer>
          </Border>
          </ControlTemplate>
          </ListView.Template>





          share|improve this answer


















          • 1





            thanks alot! this was the Sollution I was looking for!!

            – John Lloyd
            Jul 5 '16 at 13:43



















          0














          You need to add a "ScrollViewer" as a parent of the objects you want to scroll, try this:



          <DataTemplate>
          <ScrollViewer>
          <WrapPanel>
          <CheckBox IsChecked="Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" />
          <TextBlock Text="Binding Typ" FontWeight="Bold" />
          </WrapPanel>
          </ScrollViewer>
          </DataTemplate>





          share|improve this answer























          • sadly this didnt work for me

            – John Lloyd
            Jul 5 '16 at 13:43


















          0














          If you have StackPanel wrapping your listView. Like in this example.

          It will not work! Just change it to Grid, for example, and than it will work.



           <StackPanel>
          <ListView Grid.Row="1" ItemsSource="Binding Path=DictationVMs" ScrollViewer.VerticalScrollBarVisibility="Visible"
          Focusable="True" SelectedValue="Binding Path=SelectedDictation,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay">
          <ListView.Template>
          <ControlTemplate>
          <ScrollViewer>
          <ItemsPresenter VerticalAlignment="Stretch"></ItemsPresenter>
          </ScrollViewer>
          </ControlTemplate>
          </ListView.Template>
          <ListView.ItemTemplate>
          <DataTemplate>
          <TextBlock Text="Binding Path=DictationModel.Name" HorizontalAlignment="Center"
          VerticalAlignment="Center" FontSize="24" TextWrapping="Wrap"/>
          </DataTemplate>
          </ListView.ItemTemplate>
          </StackPanel>





          share|improve this answer



























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f38204584%2fhow-to-implement-auto-vertical-scrollbar-in-a-listview-with-datatemplate%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            A solution could be adding a ScrollViewer to your ListView Template:



             <ListView.Template>
            <ControlTemplate>
            <Border CornerRadius="4" BorderThickness="1" BorderBrush="#333333" Background="White">
            <ScrollViewer>
            <ItemsPresenter></ItemsPresenter>
            </ScrollViewer>
            </Border>
            </ControlTemplate>
            </ListView.Template>





            share|improve this answer


















            • 1





              thanks alot! this was the Sollution I was looking for!!

              – John Lloyd
              Jul 5 '16 at 13:43
















            0














            A solution could be adding a ScrollViewer to your ListView Template:



             <ListView.Template>
            <ControlTemplate>
            <Border CornerRadius="4" BorderThickness="1" BorderBrush="#333333" Background="White">
            <ScrollViewer>
            <ItemsPresenter></ItemsPresenter>
            </ScrollViewer>
            </Border>
            </ControlTemplate>
            </ListView.Template>





            share|improve this answer


















            • 1





              thanks alot! this was the Sollution I was looking for!!

              – John Lloyd
              Jul 5 '16 at 13:43














            0












            0








            0







            A solution could be adding a ScrollViewer to your ListView Template:



             <ListView.Template>
            <ControlTemplate>
            <Border CornerRadius="4" BorderThickness="1" BorderBrush="#333333" Background="White">
            <ScrollViewer>
            <ItemsPresenter></ItemsPresenter>
            </ScrollViewer>
            </Border>
            </ControlTemplate>
            </ListView.Template>





            share|improve this answer













            A solution could be adding a ScrollViewer to your ListView Template:



             <ListView.Template>
            <ControlTemplate>
            <Border CornerRadius="4" BorderThickness="1" BorderBrush="#333333" Background="White">
            <ScrollViewer>
            <ItemsPresenter></ItemsPresenter>
            </ScrollViewer>
            </Border>
            </ControlTemplate>
            </ListView.Template>






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jul 5 '16 at 13:33









            BabbillumpaBabbillumpa

            1,64211320




            1,64211320







            • 1





              thanks alot! this was the Sollution I was looking for!!

              – John Lloyd
              Jul 5 '16 at 13:43













            • 1





              thanks alot! this was the Sollution I was looking for!!

              – John Lloyd
              Jul 5 '16 at 13:43








            1




            1





            thanks alot! this was the Sollution I was looking for!!

            – John Lloyd
            Jul 5 '16 at 13:43






            thanks alot! this was the Sollution I was looking for!!

            – John Lloyd
            Jul 5 '16 at 13:43














            0














            You need to add a "ScrollViewer" as a parent of the objects you want to scroll, try this:



            <DataTemplate>
            <ScrollViewer>
            <WrapPanel>
            <CheckBox IsChecked="Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" />
            <TextBlock Text="Binding Typ" FontWeight="Bold" />
            </WrapPanel>
            </ScrollViewer>
            </DataTemplate>





            share|improve this answer























            • sadly this didnt work for me

              – John Lloyd
              Jul 5 '16 at 13:43















            0














            You need to add a "ScrollViewer" as a parent of the objects you want to scroll, try this:



            <DataTemplate>
            <ScrollViewer>
            <WrapPanel>
            <CheckBox IsChecked="Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" />
            <TextBlock Text="Binding Typ" FontWeight="Bold" />
            </WrapPanel>
            </ScrollViewer>
            </DataTemplate>





            share|improve this answer























            • sadly this didnt work for me

              – John Lloyd
              Jul 5 '16 at 13:43













            0












            0








            0







            You need to add a "ScrollViewer" as a parent of the objects you want to scroll, try this:



            <DataTemplate>
            <ScrollViewer>
            <WrapPanel>
            <CheckBox IsChecked="Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" />
            <TextBlock Text="Binding Typ" FontWeight="Bold" />
            </WrapPanel>
            </ScrollViewer>
            </DataTemplate>





            share|improve this answer













            You need to add a "ScrollViewer" as a parent of the objects you want to scroll, try this:



            <DataTemplate>
            <ScrollViewer>
            <WrapPanel>
            <CheckBox IsChecked="Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" />
            <TextBlock Text="Binding Typ" FontWeight="Bold" />
            </WrapPanel>
            </ScrollViewer>
            </DataTemplate>






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jul 5 '16 at 13:26









            Dark TemplarDark Templar

            76269




            76269












            • sadly this didnt work for me

              – John Lloyd
              Jul 5 '16 at 13:43

















            • sadly this didnt work for me

              – John Lloyd
              Jul 5 '16 at 13:43
















            sadly this didnt work for me

            – John Lloyd
            Jul 5 '16 at 13:43





            sadly this didnt work for me

            – John Lloyd
            Jul 5 '16 at 13:43











            0














            If you have StackPanel wrapping your listView. Like in this example.

            It will not work! Just change it to Grid, for example, and than it will work.



             <StackPanel>
            <ListView Grid.Row="1" ItemsSource="Binding Path=DictationVMs" ScrollViewer.VerticalScrollBarVisibility="Visible"
            Focusable="True" SelectedValue="Binding Path=SelectedDictation,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay">
            <ListView.Template>
            <ControlTemplate>
            <ScrollViewer>
            <ItemsPresenter VerticalAlignment="Stretch"></ItemsPresenter>
            </ScrollViewer>
            </ControlTemplate>
            </ListView.Template>
            <ListView.ItemTemplate>
            <DataTemplate>
            <TextBlock Text="Binding Path=DictationModel.Name" HorizontalAlignment="Center"
            VerticalAlignment="Center" FontSize="24" TextWrapping="Wrap"/>
            </DataTemplate>
            </ListView.ItemTemplate>
            </StackPanel>





            share|improve this answer





























              0














              If you have StackPanel wrapping your listView. Like in this example.

              It will not work! Just change it to Grid, for example, and than it will work.



               <StackPanel>
              <ListView Grid.Row="1" ItemsSource="Binding Path=DictationVMs" ScrollViewer.VerticalScrollBarVisibility="Visible"
              Focusable="True" SelectedValue="Binding Path=SelectedDictation,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay">
              <ListView.Template>
              <ControlTemplate>
              <ScrollViewer>
              <ItemsPresenter VerticalAlignment="Stretch"></ItemsPresenter>
              </ScrollViewer>
              </ControlTemplate>
              </ListView.Template>
              <ListView.ItemTemplate>
              <DataTemplate>
              <TextBlock Text="Binding Path=DictationModel.Name" HorizontalAlignment="Center"
              VerticalAlignment="Center" FontSize="24" TextWrapping="Wrap"/>
              </DataTemplate>
              </ListView.ItemTemplate>
              </StackPanel>





              share|improve this answer



























                0












                0








                0







                If you have StackPanel wrapping your listView. Like in this example.

                It will not work! Just change it to Grid, for example, and than it will work.



                 <StackPanel>
                <ListView Grid.Row="1" ItemsSource="Binding Path=DictationVMs" ScrollViewer.VerticalScrollBarVisibility="Visible"
                Focusable="True" SelectedValue="Binding Path=SelectedDictation,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay">
                <ListView.Template>
                <ControlTemplate>
                <ScrollViewer>
                <ItemsPresenter VerticalAlignment="Stretch"></ItemsPresenter>
                </ScrollViewer>
                </ControlTemplate>
                </ListView.Template>
                <ListView.ItemTemplate>
                <DataTemplate>
                <TextBlock Text="Binding Path=DictationModel.Name" HorizontalAlignment="Center"
                VerticalAlignment="Center" FontSize="24" TextWrapping="Wrap"/>
                </DataTemplate>
                </ListView.ItemTemplate>
                </StackPanel>





                share|improve this answer















                If you have StackPanel wrapping your listView. Like in this example.

                It will not work! Just change it to Grid, for example, and than it will work.



                 <StackPanel>
                <ListView Grid.Row="1" ItemsSource="Binding Path=DictationVMs" ScrollViewer.VerticalScrollBarVisibility="Visible"
                Focusable="True" SelectedValue="Binding Path=SelectedDictation,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay">
                <ListView.Template>
                <ControlTemplate>
                <ScrollViewer>
                <ItemsPresenter VerticalAlignment="Stretch"></ItemsPresenter>
                </ScrollViewer>
                </ControlTemplate>
                </ListView.Template>
                <ListView.ItemTemplate>
                <DataTemplate>
                <TextBlock Text="Binding Path=DictationModel.Name" HorizontalAlignment="Center"
                VerticalAlignment="Center" FontSize="24" TextWrapping="Wrap"/>
                </DataTemplate>
                </ListView.ItemTemplate>
                </StackPanel>






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 25 at 8:33

























                answered Mar 25 at 8:19









                R. CohenR. Cohen

                11




                11



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f38204584%2fhow-to-implement-auto-vertical-scrollbar-in-a-listview-with-datatemplate%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript