WPF control similar to scroll bar - wpf

I have a string array. Each array element has some content. I need a horizontal scroll bar or anything similar below the window. On clicking next or previous button, array elements needs to be displayed in a textbox accordingly. Something like paging. But I am unable to find any such control. I need to perform this in WPF and MVVM pattern.
Else i'll have to put two buttons and implement the functionality on its click events. But I would not get the scroll bar effect.
Any help would be much appreciated!

Related

ToolStripControlHost selection on mouseover

I have a problem developing a custom menu item.
The menu item is hosted in a ToolStripControlHost, the rest are just ToolStripMenuItems.
What I want is that when the user hovers the mouse over the custom control, to be selected like an ordinary ToolStripMenuItem, like in the image below. Unfortunately, I did not manage to figure this out. Is this behavior possible?
Edit: 26.10.2015:
I have been playing around with the control and it seems that the ToolStripControlHost, when added to the ContextMenu it is shrinked in the list, like in the image below.
I made the background of the custom control red so it can be seen better. The control only receives MouseHover events only when the mouse is over the control, shown in red. If you point the mouse on the left or the right, the ContextMenu receives the events.
ContextMenu custom menuitem
It is an interesting behaviour, because also the ToolStripTextBox or ToolStripCombobox don't take the whole left to right space and are not highlighted when mouse is over.
Now I hope someone has an idea how to do that.

Panel with Next and Previous buttons

Hello pplwould like to know if we can do a panel like this in WPF.
Where I sent a list item for the usercontrol, and after that the control showed items that were possible, and if more it shows the next and previous buttons. In windows forms I have. Now wpf in that complicated. I can not show items as monitor size user even knowing how many are being presented, he puts her items and then can not do paging. Can you help me?
Cumps
You could have a horizontal StackPanel in the grid and scroll the StackPanel with two buttons.

ListView item highlighting

I am designing a code viewer using a virtualized ListView control to display code lines.
Now I want to create a highlight effect when the user clicks a link which takes them to a particular line. I want the target line to be highlighted.
The effect will be either an "underline" appearing (and disappearing) or a semi-transparent overlay (like a marker pen) appearing (and disappearing). The actual graphical effect itself is unimportant, that's not the problem.
What is the best approach to achieve this? I'm not quite sure where to start.
Some technical requirements might be that I need to:
find the right events to react to - or use databinding
obtain the absolute bounding rectangle of the virtualized target item (although when brought into view the item should be available)
absolutely position a canvas effect on top, fade in and fade out
...Ideally some state changes in a view model, a piece of XAML is animated via a triggered storyboard to appear (fade in) above the relevant ListViewItem and then animates away again (fade out). Of course before the fade in, the element must already be correctly positioned over the relevant ListViewItem...
I have worked on a search feature for a Listview where every ListViewItem had few textbocks. When the user types something in a search textbox, all the matches in the listview was supposed to get highlighted.
I created Run objects based on the search string (used Regex to find the match) and then set the Background to some color. Also, held the reference of the ListViewItem in the tag of the Run object which helped me to use call ScrollIntoView. Hope this will be of some help in your case.

Mouse Wheel in Nested Listboxes

I am currently working on a WPF project in C# using MVVM. In this project I have a list box that loads a user control for each row of data in my items source.
The user control that gets added for each item in my collection also contains a list box that is filled from a database. This second list box often grows and therefore makes each item larger than the view of the first listbox.
My question is, how to I make my listbox have smooth scrolling. Right now it jumps from the top of one item the the top of the next. Since each item is bigger than the view of the listbox I need to be able to scroll without jumping from the top of each item to the next.
I have used a scrollview to achieve this but the list box then intercepts the mouse wheel event and will not allow me to scroll without hovering over the scroll bar.
Is there a better way to do this?
UPDATE:
I can get smooth scrolling using the scrollview control but I cannot scroll while my mouse is inside the scrollview. I have to have my mouse over the scrollbar in order to scroll.
It is like something is intercepting my mousewheel event.
I was able to achieve what I was trying to do by using a ItemsControl rather than the ListBox. It loaded just like the ListBox control and pulled all of my data into it and let the ScrollView handle the scrolling. It did not intercept the mousewheel even like the listbox did.
If you do not need to be able to select an item, I highly recommend using the ItemsControl.
You can set on the Listbox the following Property ScrollViewer.CanContentScroll="False".

WPF Adorner Overlay Problem

I am trying to achieve functionality similar to that of a Popup, without using a Popup, but instead adorning my ContentControl with a basic adorner. Basically, I want the ContentControl to have an "overlay" effect, whereby it is the topmost object, above all other elements - similiar to that of the Popup control.
Here is the problem that I am running into, and I am hoping that someone can point out where I am going wrong:
I have a stand grid with two row definitions. The first row contains a UI element - for example, a rectangle. The second row contains a custom control that I have developed to emulate the functionality of a "drawer" sliding out. Basically, when I click on button, I am going to animate a TranslateTransform to "slide" my ContentControl "up". This works fine - except that it gets cropped underneath the rectange in the first row of the grid. If I remove the row definitions in the grid, then when the desired behavior is achieved - the ContentControl is moved "up" and partially "on top" of the rectangle. The rectangle is merely a place holder for what I am trying to achieve. I basically want to have a drawer type control that can slide out and be on top of all other controls.
I am somewhat new to using the Adorner class, so, I am hoping that someone can please point out where I am going wrong.
Thanks.
Chris
Change the parent of the adorner to the full grid, and not just your control. If you put a control in a grid row, and set the adorner to adorn the control, it will usually be clipped to that row because the control is.

Resources