This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
How can I highlight the grid row when the treeview node is selected? Currently, when I select a node in the treeview, the cells in the same row as the treeview node are not highlighted. |
|
|
Set the ItemContainerStyle. For example: <Style x:Key="TreeListViewItemStyle" TargetType="ms:MulticolumnTreeViewItem" <ms:MulticolumnTreeView ItemContainerStyle="{StaticResource TreeListViewItemStyle}" /> |
|
|
The highlighting does not work when a cell template (textbox) is used in the gridview column. It does work with DisplayMemberBinding. The highlighted row does not follow mouse clicks in the gridview. If I click on a row in the grid, I would like the entire row (treeview and grid) to be highlighted. Is there a similar trigger that must be used for the grid?
|
|
|
The default WPF TextBox style sets the background colour. To have the colour of the containing control -- in this case the MulticolumnTreeViewItem -- show through instead, just set the TextBox background to Transparent: <TextBox Text="{Binding Path=LatinName}" Background="Transparent" /> In this case you may also want to look at the BorderBrush and BorderThickness settings. Also I think TextBox highlighting always uses the system highlight colours so if the user selects text within the text box it may not be too clear. To have selection track mouse clicks within text boxes, add the following trigger to the item container style: <Trigger Property="IsKeyboardFocusWithin" Value="True"> |
|
|
Thanks, Ivan. The row highlighting is working, however the row above the textbox is highlighted. I have some read-only rows where the "IsTabStop" property is set to "false". These rows contain numeric totals for child items. I have the value set to false so that tab navigation skips these cells. Setting the "IsTabStop" property to "false" causes the incorrect row to be highlighted. |
|
|
The quickest fix for this may be to change the IsKeyboardFocusWithin trigger to a MultiTrigger with two conditions: IsKeyboardFocusWithin="True" and IsTabStop="True". It's not a terrifically elegant solution but should address the issue you're seeing (you may need to tinker a bit with the specific conditions depending on the exact behaviour you want; in particular you may also need to look at the IsFocused property). |
|