Is there an easy way to turn off full row selection highlighting?

5 posts, 0 answers
  1. Chris
    Chris avatar
    30 posts
    Member since:
    Oct 2010

    Posted 07 Jun 2012 Link to this post

    The problem that we're having is that we have context menus for individual tree items and a context menu for the tree itself.

    A right-click on the empty highlighted area next to a selected item in the tree brings up the tree view context menu instead of the item context menu, which is a bit confusing to the user.

    We'd prefer to be able to have the selection highlight only cover the actual item contents, not the empty space to the right of the item.

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 08 Jun 2012 Link to this post

    Hello Chris,

    The ContextMenu of RadTreeViewItem opens when the Mouse is over the item's Header. It does not rely on the dashed selection rectangle's position. The way to configure this is to use the HorizontalHeaderAlignment property. For example, if it is set to Stretch the ContextMenu will open when you right click almost everywhere on the RadTreeViewItem. 
    However, we think that having a two ContextMenus - one for the item and one for the tree might be confusing too. What kind of settings/operations do you need to support in the menus ?

    All the best,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Jason D
    Jason D avatar
    72 posts
    Member since:
    Jan 2011

    Posted 13 Oct Link to this post

    How do you set HorizontalHeaderAlignment? It's not a property of the TreeView.
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 14 Oct Link to this post

    Hello Jason,

    This was a mistake. The correct property you need to set is HorizontalContentAlignment of the RadTreeViewItem. You can set it via style.
    <telerik:RadTreeView>
    <telerik:RadTreeView.ItemContainerStyle>
                                <Style TargetType="telerik:RadTreeViewItem">
                                    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                                </Style>
                            </telerik:RadTreeView.ItemContainerStyle>


    Regards,
    Petar Mladenov
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  6. Jason D
    Jason D avatar
    72 posts
    Member since:
    Jan 2011

    Posted 14 Oct in reply to Petar Mladenov Link to this post

    Thank you, that worked. I did need to change it to:

    <Style TargetType="telerik:RadTreeViewItem" BasedOn="{StaticResource RadTreeViewItemStyle}">

     

Back to Top
UI for WPF is Visual Studio 2017 Ready