Programmatically highlight combobox item - wpf

Is there any way to highlight comboboxitem programmatically?
Property IsHighlighted has no setter((. Changing style is not enought.

If you goal is to select rather than highlight (the IsHighlighted property is used to indicate a selected item), you can just set the IsSelected property or the SelectedItem or SelectedValue of the parent ComboBox.

Related

Same ItemsSource in multiple ComboBox elements, SelectedIndex synced for all ComboBox elements, want separate

I have multiple ComboBox elements. Each ComboBox's ItemsSource is bound to the same property. That property is a ListCollectionView whose underlying list is an ObservableCollection. Each ComboBox's SelectedIndex is bound to a different property. My problem is that when the user changes one ComboBox all the others are changed to the same item.
How can I make the SelectedIndex properties independent? Do I need to use something other than ListCollectionView or ObservableCollection? Would binding to something other than SelectedIndex help?
After some poking around I found that the ComboBox property IsSynchronizedWithCurrentItem fixed my problem. When set to false my ComboBoxes became independent.

Telerik WPF - TreeMap Select item programatically

Is it possible to select an item programatically? After I bind the TreeMap control I would like to select a default item.
Sure. Set the IsSelectionEnabled property to true and then set or bind the SelectedItem or SelectedValue property to an item in the ItemsSource like you would do with any other ItemsControl.

WPF ComboBox: SelectedValuePath and IsEditable trouble

I've got a WPF ComboBox bound to an ObservableCollection. I set the SelectedValuePath to "Code.Value" and the DisplayMemberPath to "Name" properties. I would like to enable the ComboBox for allowing manual values that are not available through the popup. I have the following trouble:
using SelectedValue binding does not write the manual value into the bound property, because the text search does not find a match for any item's displaymemeberpath value
using Text binding sets the value in both cases, but when I select a value of of the popup, the displaymemberpath value is stored, not the value in the SelectedValuePath.
How can I enable the Combobox to use SelectedValuePath' value on selection AND text value when manually typing?
Thanks a lot for help!

How to get current item index of ItemsControls in viewmodel?

How to get current item index of ItemsControls in viewmodel?
We want to delete the selected textbox item using ctrl+D in the itemscontrol from the viewmodel
As #metacircle has mentioned, you should use a ListBox, which has this functionality built in, instead of your ItemsControl. Using a ListBox, you have a number of options for accessing the selected item:
SelectedIndex Property
SelectedItem Property
SelectedValue Property
You can find code examples on these pages on MSDN and further examples in the ListBox Class page.
ItemsControl does not have the concept of "current item" nor "current index".
You're looking for a Selector-derived control, such as ListBox

WPF DataGrid Hide selected row?

Is there a way to "hide" the SelectedItem of the DataGrid ?
dataGrid.SelectedItem.Visibility = Visibility.Hidden
Setting the Visibility of "SelectedItem", as you have, would not change the grid - it would be changing the "SelectedItem" property value of the bound object for that SelectedItem, which is not going to affect the grid at all.
In order to change the grid row's visibility, you'll need to change it directly. You can retemplate the DataGrid to change how the selected row is displayed.
For details, see DataGrid Styles and Templates.

Resources