TableView.IsDetailButtonVisibleBinding Property
Gets or sets the binding that determines which rows display detail expand buttons.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v19.1.dll
Declaration
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.
Example
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
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the IsDetailButtonVisibleBinding property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.