Ticket Q535768
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

ASPxTreeList - Add hot-tracked style for Nodes

TreeList MVC Selected Node Back Color

created 11 years ago

I am having tree list where i want to set some back color of my choice.

settings.Styles.SelectedNode.BackColor = System.Drawing.Color.FromArgb(0, 170, 198);

But even though i have set this property when i select node by default i am having different color as dark blue.

I dont know why this is happening. Please find the code snippet below of my treelist.

HTML
@Html.DevExpress().TreeList( settings => { settings.Name = "treeList"; settings.CallbackRouteValues = new { Controller = "Home", Action = "treePartial" }; settings.ControlStyle.Border.BorderWidth = 0; settings.Styles.Cell.Paddings.PaddingLeft = System.Web.UI.WebControls.Unit.Pixel(1); settings.SettingsLoadingPanel.Enabled = false; settings.Columns.Add( column => { column.FieldName = "NodeDescription"; column.PropertiesEdit.EncodeHtml = false; } ); settings.SettingsEditing.AllowNodeDragDrop = true; settings.SettingsEditing.NodeDragDropRouteValues = new { Controller = "Home", Action = "treePartial" }; settings.AutoGenerateColumns = false; settings.KeyFieldName = "Key"; settings.ParentFieldName = "ParentKey"; settings.RootValue = "0"; settings.SettingsBehavior.AllowFocusedNode = true; settings.Styles.FocusedNode.BackColor = System.Drawing.Color.FromArgb(0, 170, 198); settings.Styles.SelectionCell.BackColor = System.Drawing.Color.FromArgb(0, 170, 198); settings.Styles.SelectedNode.BackColor = System.Drawing.Color.FromArgb(0, 170, 198); settings.SettingsBehavior.FocusNodeOnLoad = false; settings.HtmlRowPrepared = (s, e) => { e.Row.Attributes.Add("onmouseover", "this.setAttribute('bgColor', this.style.backgroundColor); this.style.backgroundColor = '#00AAC6';"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor = this.getAttribute('bgColor');"); }; settings.Settings.ShowColumnHeaders = false; settings.ClientSideEvents.StartDragNode = "DragDropHelper.StartDragNode"; settings.ClientSideEvents.EndDragNode = "DragDropHelper.EndDragNode"; } ).Bind(Model).GetHtml()

Answers approved by DevExpress Support

created 11 years ago (modified 11 years ago)

Hi.
I've created a sample project based on your code, however, I did not notice any wrong behavior in it. Would you please clarify what appearance you want to achieve? Some screenshots with the actual and expected results, and a screencast illustrating the issue will be helpful.
In addition, I suggest you use the recommendations from the ASPxTreeList - Add hot-tracked style for Nodes ticket to implement hot-tracking behavior in the TreeList.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.