Silverlight TreeView doesnt have KeepSelected method as in Winforms.
When TreeView loses focus - the selection isnt visible however the items is still selected..
I'd like to preserve selection visual even if TreeView lost its focus.
Anyone tryied to work around this?
You can write a custom style or template for the treeview node, so that it would display the color of selected item as per your choice even when it is out of focus.
Related
I'am developing a windows store application, I have used WinRT XAML Toolkit tree view control for display hierarchical data.
Tree view is populate and working correctly. But I need to do small change, in the treeview it has expander button. I need that functionality into heading item. When user click on heading it should work like expander button. I want to expand the node if user click that heading also. How can i do this? Thanks
You can put a Button or ToggleButton as an item or in ItemTemplate (depending on whether you are using ItemsSource to populate the TreeView with nodes) and handle a Click event on the Button to toggle the node's expansion state.
I've got a TreeView with a bunch of child nodes in it, all of which have child nodes of their own.
A user asked me to provide auto-completion when editing any of the "grandchild" TreeNodes, so I had to implement a floating TextBox that sits directly over the TreeNode.
Problem is, if the user scrolls the TreeView with her middle mouse button while editing the TextBox, she sees the TreeView scroll while the TextBox stays put. This, despite the fact that I have parented the TextBox to the TreeView.
So, what property or event of the TreeView can I access to make the TextBox follow all the other nodes of the TreeView when the user scrolls it?
Note: I am not using WPF. (Normally I would, but I'm modifying a pre-exisitng project.)
It might be easiest to derive from TreeView and override the OnMouseWheel function. There you can either hide the TextBox or move it to keep up with your moving TreeNode. This article does something similar to what you're trying to do but with a DropDown. It hides the control in OnMouseWheel.
I'm having issues using a GridView as a ListView's View, what I want to do is fire an event when a user makes a selection from a combobox within the Gridview and pass the selected item within the event.
My first issue is that when the user clicks the combobox within a row, the row isnt selected (meaning the selecteditem stays null unless they click elsewhere first). Is there a clean way to do this without trying to catch mouse clicks or anything?
Secondly theres no selectionchangecommited event on a WPF combobox, is there a cleaner way to check if a user has manually selected an option other than checking if the combobox is enabled?
Thanks
I am seeing a similar behavior. My hypothesis is that one or more layers of the DataTemplate of each item in the list is swallowing the RoutedEvent that should have resulted in a new selection. Is it possible to, in a generic way, tell the items in the DataTemplate that they should never stop the event from bubbeling or tunneling further, without having to override every focus-triggering event handler in code behind?
I 'solved' my issue by using the WPF Toolkit grid (http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29117) and a series of selected items, which is probably a cleaner solution anyway.
Doesn't explain the behavior of the GridView, which is to me unusual
Original link has died, believe this to be the one https://github.com/xceedsoftware/wpftoolkit/wiki/DataGrid
I just built a WPF form that contains a ListBox. The ListBox has bound to it a list of TextBox controls. I need to make each TextBox control a TabStop so that a user can hit tab, type in a number, hit tab again and type in the next number, etc.
Problem is, the ListBox itself catches the tab then the next tab skips to following control after the ListBox.
Is there a way to make each TextBox inside the ListBox be tabbable (or perhaps another type of databound control that would work)?
Thanks
Well we don't really have enough information to answer the question (this depends on what Templates and Style the ListBox is using) but you'll potentially need to play with the KeyboardNavigation.TabNavigation property to change how to cycle through the items and set IsTabStop on the ListBox to false.
Something like:
<ListBox DataSource={Binding} IsTabStop="False" KeyboardNavigation.TabNavigation="Cycle" />
I created a ListView programmatically. I set the FullRowSelect option as true. After adding the elements to the ListView, if I start selecting the items, the row which is
currently selected is highlighted with a blue color. How can I disable the highlighting? I want to stop the highlighting of an item on its selection, but want FullRowSelect to be true.
Also, if I select an item, I want to change the color of the item so that anyone can easily identify which item is selected.
The only way to really control the display of items in a list is to use ownerdraw. This approach is not exposed in .NET, so will mean overriding the creation and WinProc of the list (at least).
Another option might be WPF, much of the styling of controls being overridable.