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;
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
add a comment |
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
add a comment |
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
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
wpf
edited Jul 5 '16 at 13:29
ASh
22.2k43261
22.2k43261
asked Jul 5 '16 at 13:21
John LloydJohn Lloyd
106
106
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
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>
1
thanks alot! this was the Sollution I was looking for!!
– John Lloyd
Jul 5 '16 at 13:43
add a comment |
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>
sadly this didnt work for me
– John Lloyd
Jul 5 '16 at 13:43
add a comment |
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>
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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>
1
thanks alot! this was the Sollution I was looking for!!
– John Lloyd
Jul 5 '16 at 13:43
add a comment |
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>
1
thanks alot! this was the Sollution I was looking for!!
– John Lloyd
Jul 5 '16 at 13:43
add a comment |
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>
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>
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
add a comment |
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
add a comment |
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>
sadly this didnt work for me
– John Lloyd
Jul 5 '16 at 13:43
add a comment |
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>
sadly this didnt work for me
– John Lloyd
Jul 5 '16 at 13:43
add a comment |
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>
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>
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
add a comment |
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
add a comment |
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>
add a comment |
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>
add a comment |
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>
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>
edited Mar 25 at 8:33
answered Mar 25 at 8:19
R. CohenR. Cohen
11
11
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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