How can I set the horizontal scroll position of a list box in code? I have a list box with a wrap panel in the items template and I want to implement a 'page right' function that behaves like a page down down in a normal list but works sideways.
Thanks!
With some more searching around the site, I figured out the answer to my question.
Using the following function from Josh G's answer to this question
public static childItem FindVisualChild<childItem>(DependencyObject obj)
{
...
}
With that function to page left and right via code, this is all you have to do is the following (where listBox is the name of my ListBox control),
void PageRight()
{
ScrollViewer myScrollviewer = FindVisualChild<ScrollViewer>(listBox);
myScrollviewer.PageRight();
}
You can use the ScrollIntoView method to scroll a specific item into view
Related
I have a class called Note, that consists of Title,Content and a Date. And inside listview item template, I have some text blocks and buttons. For now, I can apply animations when edit/remove button clicked, because that buttons' tag are the Grid which I will animate. Since my class is not a framework element, it doesn't have transform and opacity property. How to do so?
Regards,
Talha
I had to use ItemContanerStyle
This Radmenu is dynamically created in code behind.Please let me know how to add scroll bar in this menu to limit the items in the submenu.
Check out this post from telerik forums.
Though it's in silverlight, I'm pretty sure you can use it as is.
Try explicitly setting the Height property of the Menu for that has a lot of menu items and that should add (Up/Down) button I believe
While not a scrollbar, you can set the DropDownHeight property of the RadMenuItem. It limits the height taken by the child menu items, and has up/down arrows to enable the scrolling.
In my WP7 application, I have pager at the end of the page, so people can navigate prev and next.
When I call 2nd page, Grid loads with new items fine but it stays wherever user left the scroll position.
When I was using ListBox element, I achieved this like this;
ListBox1.UpdateLayout();
ListBox1.ScrollIntoView(ListBoxEntries.Items[0]);
but Grid object does not contain ScrollIntoView function. Is there any workaround for this problem?
You can programmatically change the scroll offset of the ScrollViewer like this:
ScrollViewer scroll = myScrollViewer;
Double verticalOffset = 0; //0 for top, otherwise some calculated value.
scroll.ScrollToVerticalOffset(verticalOffset);
I am working on a site where I have an accordian control for the main content and in each is another accordian control. It worked fine so long as there were just a few items in there but once I got enough items in the child accordian they are clipped when expanding an item. It's not so bad for items near the top of the list but for items near the end you cannot see anything because it's completely clipped.
You can see them if you collapse the main accordian control and then expand it again. (see http://www.utahcodecamp.com/#Sessions/ to see what I mean)
Any suggestions? Can I force the parent accordian item to re-calculate the size?
It looks like you may have found a bug in the Accordian implementation. You should create a very small spike with just enough in it to reproduce the problem and post it to the issues section for the Silverlight Toolkit.
I found a work-around. It works perfectly!
"a" is the inner accordian.
void a_SizeChanged(object sender, SizeChangedEventArgs e)
{
var accordian = sender as AccordionItem;
var items = accordian.GetVisualAncestors();
foreach (DependencyObject obj in items)
{
if (obj is ExpandableContentControl)
{
ExpandableContentControl ctrl = obj as ExpandableContentControl;
ctrl.Height += e.NewSize.Height - e.PreviousSize.Height;
}
}
}
A combo's drop-down list gets the size of the Combo, and display of items with longer text just gets cropped.
I tried fiddling with Ext's CSS for combos with no luck.
Does anyone know how it can be done ?
Using ExtJS 3.2.0.
EDIT:
Alternative solutions to improve usability will also be appreciated, e.g. getting the list to expand with the content.
I don't know how you can add a scroll bar, but I know that you can change the list width with the well-named property :
listWidth : Number
The width (used as
a parameter to Ext.Element.setWidth)
of the dropdown list (defaults to the
width of the ComboBox field). See also
minListWidth
For an horizontal scroll, it would need lots of changes, because the list container width is forced, so "overflow" attributes in css are useless.
Edit : Another method
You can add this custom css, for me it seems to work well, as wrapping long lines.
.x-combo-list-item {
white-space:normal;
}
Of course, if you add this it will apply to all combos' lists.
You can set listClass : 'x-combo-list-wrap' on your Ext.form.ComboBox, and then apply the css only to these items :
x-combo-list-wrap .x-combo-list-item {
white-space:normal !important;
}
(I'm not sure the !important is useful here, not tested)