Ticket Q493232
Visible to All Users
Duplicate

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

How to hide the toolbar of a nested list view

Disable ToolBar From DetailPropertyEditor

created 12 years ago

How can I hide the toolbar that appears in the DetailPropertyEditor when it is used as the editor for a reference property?

Answers approved by DevExpress Support

created 12 years ago (modified 9 years ago)

Hello Kivash,
To accomplish this task, access the nested frame via the DetailPropertyEditor.Frame property, cast its template to the ISupportActionsToolbarVisibility interface and use the ISupportActionsToolbarVisibility.SetVisible method. Here is an example:

C#
public class HideToolbarsController : ViewController<DetailView> { protected override void OnActivated() { base.OnActivated(); foreach (DetailPropertyEditor detailPropertyEditor in View.GetItems<DetailPropertyEditor>()) { detailPropertyEditor.ControlCreated += new EventHandler<EventArgs>(detailPropertyEditor_ControlCreated); } } void detailPropertyEditor_ControlCreated(object sender, EventArgs e) { Frame nestedFrame = ((DetailPropertyEditor)sender).Frame; if (nestedFrame != null && nestedFrame.Template is ISupportActionsToolbarVisibility) { ((ISupportActionsToolbarVisibility)nestedFrame.Template).SetVisible(false); } } protected override void OnDeactivated() { base.OnDeactivated(); foreach (DetailPropertyEditor detailPropertyEditor in View.GetItems<DetailPropertyEditor>()) { detailPropertyEditor.ControlCreated -= new EventHandler<EventArgs>(detailPropertyEditor_ControlCreated); } } }
Visual Basic
Public Class HideToolbarsController Inherits ViewController(Of DetailView) Protected Overrides Sub OnActivated() MyBase.OnActivated() For Each detailPropertyEditor As DetailPropertyEditor In View.GetItems(Of DetailPropertyEditor)() AddHandler detailPropertyEditor.ControlCreated, AddressOf detailPropertyEditor_ControlCreated Next detailPropertyEditor End Sub Private Sub detailPropertyEditor_ControlCreated(ByVal sender As Object, ByVal e As EventArgs) Dim nestedFrame As Frame = (CType(sender, DetailPropertyEditor)).Frame If nestedFrame IsNot Nothing AndAlso TypeOf nestedFrame.Template Is ISupportActionsToolbarVisibility Then CType(nestedFrame.Template, ISupportActionsToolbarVisibility).SetVisible(True) End If End Sub Protected Overrides Sub OnDeactivated() MyBase.OnDeactivated() For Each detailPropertyEditor As DetailPropertyEditor In View.GetItems(Of DetailPropertyEditor)() RemoveHandler detailPropertyEditor.ControlCreated, AddressOf detailPropertyEditor_ControlCreated Next detailPropertyEditor End Sub End Class

    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.