WPF: How to keep ListBox SelectedItem visible after resizing?
In our current C#
MVVM
project we use a ListBox
to display items.
There is another container that can be expanded below the ListBox.
Everything is working fine. When the container expands, the ListBox
contracts and the ScrollBar
appears.
However if an element is selected at the bottom of the ListBox and the container is expanded the item disappears at the end of the ListBox
.
Example:
Before container expansion:
+--------------+
| Item 1 |
+--------------+
| Item 2 |
+--------------+
| Item 3 |
+--------------+
| Item 4 |
+--------------+
| SelectedItem |
+--------------+
| Item 6 |
+--------------+
| Item 7 |
+--------------+
+------------------+
| Container |
+------------------+
After container expansion:
+--------------+---+
| Item 1 | S |
+--------------+ c |
| Item 2 | r |
+--------------+ o |
| Item 3 | l |
+--------------+ l |
| Item 4 | |
+--------------+---+
+------------------+
| |
| |
| Container |
| |
| |
+------------------+
What I would like to achieve is keeping visible SelectedItem
without having to scroll to it.
Like so:
+--------------+---+
| Item 2 | S |
+--------------+ c |
| Item 3 | r |
+--------------+ o |
| Item 4 | l |
+--------------+ l |
| SelectedItem | |
+--------------+---+
+------------------+
| |
| |
| Container |
| |
| |
+------------------+
What is the best way to achieve this?
I couldn't find anything about it here on SO or anything else.
I have seen that it was possible to scroll programmatically:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/a9116965-b1e9-411c-b153-b868e0a730cf/how-to-programmatically-scroll-a-scrollviewer?forum=wpf
https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.scrollviewer.scrolltohorizontaloffset?redirectedfrom=MSDN&view=netframework-4.7.2#System_Windows_Controls_ScrollViewer_ScrollToHorizontalOffset_System_Double_
https://wpf.2000things.com/2013/08/21/889-scrolling-a-scrollviewer-from-code/
I have also seen it was possible to know when a ListBoxItem
comes into view (here and there) but as my items are already loaded then hidden I don't think this will work.
I don't want to have code-behind that I must copy in every view where I need this functionnality. I have thought about implementing this in a Behavior attached to the ListBox
but I highly doubt this would be the best solution.
I have also thought about writing a custom ListBox
control but I think this is too much for such a small functionality.
Can someone tell me the best way to achieve this kind of behavior?
Thanks in advance.
c# wpf xaml scroll listbox
add a comment |
In our current C#
MVVM
project we use a ListBox
to display items.
There is another container that can be expanded below the ListBox.
Everything is working fine. When the container expands, the ListBox
contracts and the ScrollBar
appears.
However if an element is selected at the bottom of the ListBox and the container is expanded the item disappears at the end of the ListBox
.
Example:
Before container expansion:
+--------------+
| Item 1 |
+--------------+
| Item 2 |
+--------------+
| Item 3 |
+--------------+
| Item 4 |
+--------------+
| SelectedItem |
+--------------+
| Item 6 |
+--------------+
| Item 7 |
+--------------+
+------------------+
| Container |
+------------------+
After container expansion:
+--------------+---+
| Item 1 | S |
+--------------+ c |
| Item 2 | r |
+--------------+ o |
| Item 3 | l |
+--------------+ l |
| Item 4 | |
+--------------+---+
+------------------+
| |
| |
| Container |
| |
| |
+------------------+
What I would like to achieve is keeping visible SelectedItem
without having to scroll to it.
Like so:
+--------------+---+
| Item 2 | S |
+--------------+ c |
| Item 3 | r |
+--------------+ o |
| Item 4 | l |
+--------------+ l |
| SelectedItem | |
+--------------+---+
+------------------+
| |
| |
| Container |
| |
| |
+------------------+
What is the best way to achieve this?
I couldn't find anything about it here on SO or anything else.
I have seen that it was possible to scroll programmatically:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/a9116965-b1e9-411c-b153-b868e0a730cf/how-to-programmatically-scroll-a-scrollviewer?forum=wpf
https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.scrollviewer.scrolltohorizontaloffset?redirectedfrom=MSDN&view=netframework-4.7.2#System_Windows_Controls_ScrollViewer_ScrollToHorizontalOffset_System_Double_
https://wpf.2000things.com/2013/08/21/889-scrolling-a-scrollviewer-from-code/
I have also seen it was possible to know when a ListBoxItem
comes into view (here and there) but as my items are already loaded then hidden I don't think this will work.
I don't want to have code-behind that I must copy in every view where I need this functionnality. I have thought about implementing this in a Behavior attached to the ListBox
but I highly doubt this would be the best solution.
I have also thought about writing a custom ListBox
control but I think this is too much for such a small functionality.
Can someone tell me the best way to achieve this kind of behavior?
Thanks in advance.
c# wpf xaml scroll listbox
add a comment |
In our current C#
MVVM
project we use a ListBox
to display items.
There is another container that can be expanded below the ListBox.
Everything is working fine. When the container expands, the ListBox
contracts and the ScrollBar
appears.
However if an element is selected at the bottom of the ListBox and the container is expanded the item disappears at the end of the ListBox
.
Example:
Before container expansion:
+--------------+
| Item 1 |
+--------------+
| Item 2 |
+--------------+
| Item 3 |
+--------------+
| Item 4 |
+--------------+
| SelectedItem |
+--------------+
| Item 6 |
+--------------+
| Item 7 |
+--------------+
+------------------+
| Container |
+------------------+
After container expansion:
+--------------+---+
| Item 1 | S |
+--------------+ c |
| Item 2 | r |
+--------------+ o |
| Item 3 | l |
+--------------+ l |
| Item 4 | |
+--------------+---+
+------------------+
| |
| |
| Container |
| |
| |
+------------------+
What I would like to achieve is keeping visible SelectedItem
without having to scroll to it.
Like so:
+--------------+---+
| Item 2 | S |
+--------------+ c |
| Item 3 | r |
+--------------+ o |
| Item 4 | l |
+--------------+ l |
| SelectedItem | |
+--------------+---+
+------------------+
| |
| |
| Container |
| |
| |
+------------------+
What is the best way to achieve this?
I couldn't find anything about it here on SO or anything else.
I have seen that it was possible to scroll programmatically:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/a9116965-b1e9-411c-b153-b868e0a730cf/how-to-programmatically-scroll-a-scrollviewer?forum=wpf
https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.scrollviewer.scrolltohorizontaloffset?redirectedfrom=MSDN&view=netframework-4.7.2#System_Windows_Controls_ScrollViewer_ScrollToHorizontalOffset_System_Double_
https://wpf.2000things.com/2013/08/21/889-scrolling-a-scrollviewer-from-code/
I have also seen it was possible to know when a ListBoxItem
comes into view (here and there) but as my items are already loaded then hidden I don't think this will work.
I don't want to have code-behind that I must copy in every view where I need this functionnality. I have thought about implementing this in a Behavior attached to the ListBox
but I highly doubt this would be the best solution.
I have also thought about writing a custom ListBox
control but I think this is too much for such a small functionality.
Can someone tell me the best way to achieve this kind of behavior?
Thanks in advance.
c# wpf xaml scroll listbox
In our current C#
MVVM
project we use a ListBox
to display items.
There is another container that can be expanded below the ListBox.
Everything is working fine. When the container expands, the ListBox
contracts and the ScrollBar
appears.
However if an element is selected at the bottom of the ListBox and the container is expanded the item disappears at the end of the ListBox
.
Example:
Before container expansion:
+--------------+
| Item 1 |
+--------------+
| Item 2 |
+--------------+
| Item 3 |
+--------------+
| Item 4 |
+--------------+
| SelectedItem |
+--------------+
| Item 6 |
+--------------+
| Item 7 |
+--------------+
+------------------+
| Container |
+------------------+
After container expansion:
+--------------+---+
| Item 1 | S |
+--------------+ c |
| Item 2 | r |
+--------------+ o |
| Item 3 | l |
+--------------+ l |
| Item 4 | |
+--------------+---+
+------------------+
| |
| |
| Container |
| |
| |
+------------------+
What I would like to achieve is keeping visible SelectedItem
without having to scroll to it.
Like so:
+--------------+---+
| Item 2 | S |
+--------------+ c |
| Item 3 | r |
+--------------+ o |
| Item 4 | l |
+--------------+ l |
| SelectedItem | |
+--------------+---+
+------------------+
| |
| |
| Container |
| |
| |
+------------------+
What is the best way to achieve this?
I couldn't find anything about it here on SO or anything else.
I have seen that it was possible to scroll programmatically:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/a9116965-b1e9-411c-b153-b868e0a730cf/how-to-programmatically-scroll-a-scrollviewer?forum=wpf
https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.scrollviewer.scrolltohorizontaloffset?redirectedfrom=MSDN&view=netframework-4.7.2#System_Windows_Controls_ScrollViewer_ScrollToHorizontalOffset_System_Double_
https://wpf.2000things.com/2013/08/21/889-scrolling-a-scrollviewer-from-code/
I have also seen it was possible to know when a ListBoxItem
comes into view (here and there) but as my items are already loaded then hidden I don't think this will work.
I don't want to have code-behind that I must copy in every view where I need this functionnality. I have thought about implementing this in a Behavior attached to the ListBox
but I highly doubt this would be the best solution.
I have also thought about writing a custom ListBox
control but I think this is too much for such a small functionality.
Can someone tell me the best way to achieve this kind of behavior?
Thanks in advance.
c# wpf xaml scroll listbox
c# wpf xaml scroll listbox
asked Nov 21 '18 at 13:51


Maël PedrettiMaël Pedretti
37713
37713
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
A Behavior
is the ideal way to add this functionality to a control. The code below will scroll the ListBox's SelectedItem into view after a selection changed or resize.
public class perListBoxHelper : Behavior<ListBox>
{
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.SelectionChanged += AssociatedObject_SelectionChanged;
AssociatedObject.SizeChanged += AssociatedObject_SizeChanged;
}
protected override void OnDetaching()
{
AssociatedObject.SelectionChanged -= AssociatedObject_SelectionChanged;
AssociatedObject.SizeChanged -= AssociatedObject_SizeChanged;
base.OnDetaching();
}
private static void AssociatedObject_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ScrollSelectionIntoView(sender as ListBox);
}
private static void AssociatedObject_SizeChanged(object sender, SizeChangedEventArgs e)
{
ScrollSelectionIntoView(sender as ListBox);
}
private static void ScrollSelectionIntoView(ListBox listBox)
{
if (listBox?.SelectedItem == null)
return;
Action action = () =>
{
listBox.UpdateLayout();
listBox.ScrollIntoView(listBox.SelectedItem);
};
listBox.Dispatcher.BeginInvoke(action, DispatcherPriority.ContextIdle);
}
}
Usage
<ListBox ... >
<i:Interaction.Behaviors>
<vhelp:perListBoxHelper />
</i:Interaction.Behaviors>
</ListBox>
More discussion about behaviors on my recent blog post.
Thank you very much! This is exactly what I needed! I just don't understand why you also listen to selectionChanged and had to remove this part because we allow multiple selection. But once again, thank you. I will give a good look at your blog!
– Maël Pedretti
Nov 22 '18 at 6:50
1
SelectionChanged is what this behavior was originally designed to handle - when you select an item from code behind or through binding, it will be scrolled into view.
– Peregrine
Nov 22 '18 at 7:05
Oh I see, thanks! I don't need this part because it will not happen in my case but it might be useful someday. Thank you again
– Maël Pedretti
Nov 22 '18 at 7:06
1
Maybe it would be better to make two distinct behaviors then - one for each event. You could then add whichever are appropriate for each specific Listbox instance.
– Peregrine
Nov 22 '18 at 7:07
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%2f53413590%2fwpf-how-to-keep-listbox-selecteditem-visible-after-resizing%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
A Behavior
is the ideal way to add this functionality to a control. The code below will scroll the ListBox's SelectedItem into view after a selection changed or resize.
public class perListBoxHelper : Behavior<ListBox>
{
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.SelectionChanged += AssociatedObject_SelectionChanged;
AssociatedObject.SizeChanged += AssociatedObject_SizeChanged;
}
protected override void OnDetaching()
{
AssociatedObject.SelectionChanged -= AssociatedObject_SelectionChanged;
AssociatedObject.SizeChanged -= AssociatedObject_SizeChanged;
base.OnDetaching();
}
private static void AssociatedObject_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ScrollSelectionIntoView(sender as ListBox);
}
private static void AssociatedObject_SizeChanged(object sender, SizeChangedEventArgs e)
{
ScrollSelectionIntoView(sender as ListBox);
}
private static void ScrollSelectionIntoView(ListBox listBox)
{
if (listBox?.SelectedItem == null)
return;
Action action = () =>
{
listBox.UpdateLayout();
listBox.ScrollIntoView(listBox.SelectedItem);
};
listBox.Dispatcher.BeginInvoke(action, DispatcherPriority.ContextIdle);
}
}
Usage
<ListBox ... >
<i:Interaction.Behaviors>
<vhelp:perListBoxHelper />
</i:Interaction.Behaviors>
</ListBox>
More discussion about behaviors on my recent blog post.
Thank you very much! This is exactly what I needed! I just don't understand why you also listen to selectionChanged and had to remove this part because we allow multiple selection. But once again, thank you. I will give a good look at your blog!
– Maël Pedretti
Nov 22 '18 at 6:50
1
SelectionChanged is what this behavior was originally designed to handle - when you select an item from code behind or through binding, it will be scrolled into view.
– Peregrine
Nov 22 '18 at 7:05
Oh I see, thanks! I don't need this part because it will not happen in my case but it might be useful someday. Thank you again
– Maël Pedretti
Nov 22 '18 at 7:06
1
Maybe it would be better to make two distinct behaviors then - one for each event. You could then add whichever are appropriate for each specific Listbox instance.
– Peregrine
Nov 22 '18 at 7:07
add a comment |
A Behavior
is the ideal way to add this functionality to a control. The code below will scroll the ListBox's SelectedItem into view after a selection changed or resize.
public class perListBoxHelper : Behavior<ListBox>
{
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.SelectionChanged += AssociatedObject_SelectionChanged;
AssociatedObject.SizeChanged += AssociatedObject_SizeChanged;
}
protected override void OnDetaching()
{
AssociatedObject.SelectionChanged -= AssociatedObject_SelectionChanged;
AssociatedObject.SizeChanged -= AssociatedObject_SizeChanged;
base.OnDetaching();
}
private static void AssociatedObject_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ScrollSelectionIntoView(sender as ListBox);
}
private static void AssociatedObject_SizeChanged(object sender, SizeChangedEventArgs e)
{
ScrollSelectionIntoView(sender as ListBox);
}
private static void ScrollSelectionIntoView(ListBox listBox)
{
if (listBox?.SelectedItem == null)
return;
Action action = () =>
{
listBox.UpdateLayout();
listBox.ScrollIntoView(listBox.SelectedItem);
};
listBox.Dispatcher.BeginInvoke(action, DispatcherPriority.ContextIdle);
}
}
Usage
<ListBox ... >
<i:Interaction.Behaviors>
<vhelp:perListBoxHelper />
</i:Interaction.Behaviors>
</ListBox>
More discussion about behaviors on my recent blog post.
Thank you very much! This is exactly what I needed! I just don't understand why you also listen to selectionChanged and had to remove this part because we allow multiple selection. But once again, thank you. I will give a good look at your blog!
– Maël Pedretti
Nov 22 '18 at 6:50
1
SelectionChanged is what this behavior was originally designed to handle - when you select an item from code behind or through binding, it will be scrolled into view.
– Peregrine
Nov 22 '18 at 7:05
Oh I see, thanks! I don't need this part because it will not happen in my case but it might be useful someday. Thank you again
– Maël Pedretti
Nov 22 '18 at 7:06
1
Maybe it would be better to make two distinct behaviors then - one for each event. You could then add whichever are appropriate for each specific Listbox instance.
– Peregrine
Nov 22 '18 at 7:07
add a comment |
A Behavior
is the ideal way to add this functionality to a control. The code below will scroll the ListBox's SelectedItem into view after a selection changed or resize.
public class perListBoxHelper : Behavior<ListBox>
{
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.SelectionChanged += AssociatedObject_SelectionChanged;
AssociatedObject.SizeChanged += AssociatedObject_SizeChanged;
}
protected override void OnDetaching()
{
AssociatedObject.SelectionChanged -= AssociatedObject_SelectionChanged;
AssociatedObject.SizeChanged -= AssociatedObject_SizeChanged;
base.OnDetaching();
}
private static void AssociatedObject_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ScrollSelectionIntoView(sender as ListBox);
}
private static void AssociatedObject_SizeChanged(object sender, SizeChangedEventArgs e)
{
ScrollSelectionIntoView(sender as ListBox);
}
private static void ScrollSelectionIntoView(ListBox listBox)
{
if (listBox?.SelectedItem == null)
return;
Action action = () =>
{
listBox.UpdateLayout();
listBox.ScrollIntoView(listBox.SelectedItem);
};
listBox.Dispatcher.BeginInvoke(action, DispatcherPriority.ContextIdle);
}
}
Usage
<ListBox ... >
<i:Interaction.Behaviors>
<vhelp:perListBoxHelper />
</i:Interaction.Behaviors>
</ListBox>
More discussion about behaviors on my recent blog post.
A Behavior
is the ideal way to add this functionality to a control. The code below will scroll the ListBox's SelectedItem into view after a selection changed or resize.
public class perListBoxHelper : Behavior<ListBox>
{
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.SelectionChanged += AssociatedObject_SelectionChanged;
AssociatedObject.SizeChanged += AssociatedObject_SizeChanged;
}
protected override void OnDetaching()
{
AssociatedObject.SelectionChanged -= AssociatedObject_SelectionChanged;
AssociatedObject.SizeChanged -= AssociatedObject_SizeChanged;
base.OnDetaching();
}
private static void AssociatedObject_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ScrollSelectionIntoView(sender as ListBox);
}
private static void AssociatedObject_SizeChanged(object sender, SizeChangedEventArgs e)
{
ScrollSelectionIntoView(sender as ListBox);
}
private static void ScrollSelectionIntoView(ListBox listBox)
{
if (listBox?.SelectedItem == null)
return;
Action action = () =>
{
listBox.UpdateLayout();
listBox.ScrollIntoView(listBox.SelectedItem);
};
listBox.Dispatcher.BeginInvoke(action, DispatcherPriority.ContextIdle);
}
}
Usage
<ListBox ... >
<i:Interaction.Behaviors>
<vhelp:perListBoxHelper />
</i:Interaction.Behaviors>
</ListBox>
More discussion about behaviors on my recent blog post.
answered Nov 21 '18 at 14:10
PeregrinePeregrine
2,38721230
2,38721230
Thank you very much! This is exactly what I needed! I just don't understand why you also listen to selectionChanged and had to remove this part because we allow multiple selection. But once again, thank you. I will give a good look at your blog!
– Maël Pedretti
Nov 22 '18 at 6:50
1
SelectionChanged is what this behavior was originally designed to handle - when you select an item from code behind or through binding, it will be scrolled into view.
– Peregrine
Nov 22 '18 at 7:05
Oh I see, thanks! I don't need this part because it will not happen in my case but it might be useful someday. Thank you again
– Maël Pedretti
Nov 22 '18 at 7:06
1
Maybe it would be better to make two distinct behaviors then - one for each event. You could then add whichever are appropriate for each specific Listbox instance.
– Peregrine
Nov 22 '18 at 7:07
add a comment |
Thank you very much! This is exactly what I needed! I just don't understand why you also listen to selectionChanged and had to remove this part because we allow multiple selection. But once again, thank you. I will give a good look at your blog!
– Maël Pedretti
Nov 22 '18 at 6:50
1
SelectionChanged is what this behavior was originally designed to handle - when you select an item from code behind or through binding, it will be scrolled into view.
– Peregrine
Nov 22 '18 at 7:05
Oh I see, thanks! I don't need this part because it will not happen in my case but it might be useful someday. Thank you again
– Maël Pedretti
Nov 22 '18 at 7:06
1
Maybe it would be better to make two distinct behaviors then - one for each event. You could then add whichever are appropriate for each specific Listbox instance.
– Peregrine
Nov 22 '18 at 7:07
Thank you very much! This is exactly what I needed! I just don't understand why you also listen to selectionChanged and had to remove this part because we allow multiple selection. But once again, thank you. I will give a good look at your blog!
– Maël Pedretti
Nov 22 '18 at 6:50
Thank you very much! This is exactly what I needed! I just don't understand why you also listen to selectionChanged and had to remove this part because we allow multiple selection. But once again, thank you. I will give a good look at your blog!
– Maël Pedretti
Nov 22 '18 at 6:50
1
1
SelectionChanged is what this behavior was originally designed to handle - when you select an item from code behind or through binding, it will be scrolled into view.
– Peregrine
Nov 22 '18 at 7:05
SelectionChanged is what this behavior was originally designed to handle - when you select an item from code behind or through binding, it will be scrolled into view.
– Peregrine
Nov 22 '18 at 7:05
Oh I see, thanks! I don't need this part because it will not happen in my case but it might be useful someday. Thank you again
– Maël Pedretti
Nov 22 '18 at 7:06
Oh I see, thanks! I don't need this part because it will not happen in my case but it might be useful someday. Thank you again
– Maël Pedretti
Nov 22 '18 at 7:06
1
1
Maybe it would be better to make two distinct behaviors then - one for each event. You could then add whichever are appropriate for each specific Listbox instance.
– Peregrine
Nov 22 '18 at 7:07
Maybe it would be better to make two distinct behaviors then - one for each event. You could then add whichever are appropriate for each specific Listbox instance.
– Peregrine
Nov 22 '18 at 7:07
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%2f53413590%2fwpf-how-to-keep-listbox-selecteditem-visible-after-resizing%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