I have a ListBox where the number of items is added based on and integer property set by a user. The items are created from a ControlTemplate resource that which is comprised of a Label and a TextBox inside of a DockPanel. The label is not data bound but I would like for it to have somewhat dynamic content based on the (index + 1) of the...
I would like to create a visual effect when an item in a listbox is double clicked. So far I have drag and drop functionality where the item is visually attached to the mouse and can be moved to a drop target. From that functionality I am able to animate the item using the same logic of getting the item container, however I am not able t...
Background:
I am creating a custom listbox that has radio buttons on each listbox item, so essentially it will be a RadioButtonList. The control is created entirely in code. As of right now the control renders and behaves correctly and supports 2 orientations (Horizontal/Vertical). The listbox uses an ItemTemplate that is a StackPanel wi...
NOTE I have asked the related question: How to combine DataTrigger and EventTrigger?
I have a list box containing several items. The item's class implements INotifyPropertyChanged and has a property IsAvailable. I use that property to indicate unavailable options in the list using a different colour.
However, if a selected item i...
I have a list box that contains items that are represented by a single textbox.
When the user clicks a button, I want to iterate thru all these text boxes and check if their binding expressions are clean of errors;
Should be something like:
Dim errCount = 0
For Each item In MyListBox.ListBoxItems 'There is no such thing ListBox...
I have a ListBox, that's bound to an ObservableCollection.
Each ListBoxItem is displayed with a DataTemplate. I have a button in my DataTemplate, that when clicked, needs a reference to the member of the ObservableCollection it's part of the DataTemplate for. I can't use the ListBox.SelectedItem property because the item does not become...
Hello,
I'm able to set ListView Inactive Selection Color
I used solution described in following question
http://stackoverflow.com/questions/382006/wpf-listview-inactive-selection-color
I need to change font color of selected inactive element, is there easy way to accomplish this?
Thank You
...
Sorry if this has been asked before, but I couldn't find a solution to what I'm looking for in the related questions that popped up, or on Google.
In my application I'm trying to recreate Words New Document dialog, list on the left of items and on the right an icon with text underneath. In Word it has the orange gradient when you mouse...
Hi,
I have a listbox whose ItemSource property is bound to a ViewModel. This ViewModel has an ICollectionView property which is a collection of custom objects. I am loading this collection view as a tree structure in the Listbox. My requirement is to use the arrow keys to navigate along the tree view. I wrote the code to collapse an ite...
If a listbox has many items, is there a way (programatically) to check if an item is visible on screen.
For example, the listbox has 100 items, but only first 24 are shown of the screen, is there a way to check if a specific (say list[75]) is currently displayed or one should scroll to see it?
...
I want to have the ListItems to extend with their orange background the full width of the Listbox.
Currently they are only as wide as the FirstName + LastName.
I've set every element I can to: HorizontalAlignment="Stretch".
I want the background of the ListboxItems to expand as the user stretches the Listbox so I don't want to put in ...
Something strange is going on with ObservableCollection.
I have the following code:
private readonly ObservableCollection<DisplayVerse> _display;
private readonly ListBox _box;
private void TransferToDisplay()
{
double elementsHeight = 0;
_display.Clear();
for (int i = 0; i < _source.Count; i++) {
DisplayVerse verse = ...
Hello,
I have TextBox and ListBox with bunch of elements.
TextBox has KeyDown event handler, the idea behind this is to allow user to press up and down keys to scroll inside ListBox while focus is on TextBox.
When user presses "down key" several times, selected element becomes last visible element on screen. If user has reached bottom...
I can't capture/trigger OnMouseEnter or OnMouseLeave events through C# code for list items. To be clear, I don't need an OnSelectedItem event.
What I want to do is to be able to handle the OnMouseEnter and OnMouseLeave events for ListBoxItem which will start the DoubleAnimation for that ListBoxItem - I want to enlarge its font on Mouse...
Hello,
I have animation on list box items. When the list box item is not visible, ie. scrolled past visible in the listbox the animation seems to stop. When it is scrolled back into view it appears to start where it left off.
Does anyone now how to keep the animation running?
Thanks
...
I have a trigger on a storyboard for my listboxitem where the trigger is 'Loaded'.
It appears that every time the listbox scrolls the item gets the 'Loaded' event.
I really only want the storyboard to run once, when the listboxitem gets displayed.
I assumed that the Loaded event would only get triggered once.
Any help would be great.
...
Hi, I have a databound multiselect listbox bound to a datatable. When I select a listboxitem I want some other listboxitems in the same listbox to be selected automatically. I want multiple items to be selected with a single click. How can i do that? I can't do it in SelectionChanged event because it leads to calling the same event again...
Hi,
I'm trying to setup a ListBox so that every item has a textblock and a combobox, split evenly across the width of the listbox but I can't seem to find the magic combination of ColumnDefinition properties to do it. Here's my DataTemplate for the listbox item. I've cleaned it up since it was wrong, anyhow.
<DataTemplate x:Key...
Hi !
I want to get notified when an item in a ListBox gets clicked by the mouse, whether it is already selected or not.
I searched and found this: (http://kevin-berridge.blogspot.com/2008/06/wpf-listboxitem-double-click.html see the comments)
private void AddDoubleClickEventStyle(ListBox listBox, MouseButtonEventHandler mouseButtonEve...
Hello!
First take a look at my code:
<ListBox ItemsSource="{Binding}" SelectionMode="Multiple"
ItemTemplate="{StaticResource ContactTemplate}">
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Name="mnuEdit" Header="_Edit" Click="MenuItem_Click" />
</ContextMenu>
</ListBox.ContextMenu>
</ListBox>
...