TableView.IsDetailButtonVisibleBinding Property

Gets or sets the binding that determines which rows display detail expand buttons.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v20.1.dll

Declaration

[DefaultValue(null)]
public BindingBase IsDetailButtonVisibleBinding { get; set; }
<DefaultValue(Nothing)>
Public Property IsDetailButtonVisibleBinding As BindingBase

Property Value

Type Default Description
BindingBase

null

A BindingBase object specifying which rows display detail expand buttons.

Remarks

Use this property if you want to selectively display detail expand buttons. By default, the DataContext for this binding is the master row, so you can make the necessary binding adjustments and/or specify a value converter and return whether a given row should display its button.

If a row's detail expand button is hidden, end-users won't be able to expand it via keyboard shortcuts too.

Examples

This sample shows how to use the TableView.IsDetailButtonVisibleBinding property to selectively hide detail expand buttons. The specified Binding transmits row field values to a value converter. The value converter then specifies if the row containing that value should display the detail expand button.

NOTE

A complete sample project is available at https://github.com/DevExpress-Examples/detail-buttons-visibility-e4050.

Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Imports System.Globalization

Namespace WpfApplication26
    Partial Public Class MainWindow
        Inherits Window
        Public Sub New()
            InitializeComponent()
            grid1.ItemsSource = New DataSource().Categories

        End Sub
    End Class

    <ValueConversion(GetType(Object), GetType(Boolean))> _
    Public Class MyConverter
        Implements IValueConverter
        Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
            ' Obtaining the value to be converted 
            Dim categoryValue As String = CStr(value)

            ' Specifying values for which to show expand buttons
            Dim categories() As String = { "First", "Third" }
            If categories.Contains(categoryValue) Then
                Return True
            End If

            ' Disable expand button if the value isn't in the list
            Return False
        End Function
        Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
            Return Nothing
        End Function
    End Class
End Namespace
See Also