Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Hello,


                                    How can I change TreeListControl background color (I don't need transparent)? I use DevEx v12.1.

                                    I've already tried solutions that you provided here, but it's not working.


                                    Here is my code:


                                    <navigation:Page x:Class="Client.OrderPage"
                                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                                    xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
                                    xmlns:dxgt="clr-namespace:DevExpress.Xpf.Grid.Themes;assembly=DevExpress.Xpf.Grid.v12.1"
                                    xmlns:dxght="clr-namespace:DevExpress.Xpf.Grid.HitTest;assembly=DevExpress.Xpf.Grid.v12.1"
                                    xmlns:dxgcore="http://schemas.devexpress.com/winfx/2008/xaml/grid"
                                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                                    mc:Ignorable="d"
                                    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                                    d:DesignWidth="820" d:DesignHeight="550"
                                    Title="Order Page" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol" MinHeight="550" MinWidth="820" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" HorizontalAlignment="Stretch" Loaded="Page_Loaded" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
                                    xmlns:Core="clr-namespace:DevExpress.Xpf.Core;assembly=DevExpress.Xpf.Core.v12.1" LayoutUpdated="Page_LayoutUpdated">

                                    <navigation:Page.Resources>

                                    <SolidColorBrush x:Key="ViewBackgroundBrush" Color="Red"/>

                                    <Core:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
                                    <Core:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverterInverted" Invert="True" />
                                    <dxgcore:NewItemRowPositionToVisibilityConverter x:Key="NewItemRowPositionToVisibilityConverter" />

                                    <ControlTemplate x:Key="{dxgt:TableViewThemeKey ResourceKey=ScrollViewerTemplate}">
                                    <Grid ClipToBounds="True" SnapsToDevicePixels="true">
                                    <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <Core:BestFitDecorator x:Name="PART_BestFitControlDecorator" Width="0" Height="0"
                                    dxgcore:GridControl.CurrentView="{Binding Path=(dxgcore:GridControl.CurrentView), RelativeSource={RelativeSource TemplatedParent}}">
                                    <dxgcore:GridControl.CurrentViewChangedListener>
                                    <dxgcore:BestFitControlDecoratorInitializer />
                                    </dxgcore:GridControl.CurrentViewChangedListener>
                                    </Core:BestFitDecorator>
                                    <dxgcore:GroupPanelControl x:Name="PART_GroupPanel" Grid.Row="0"
                                    dxgcore:GridPopupMenu.GridMenuType="GroupPanel" Visibility="Collapsed"
                                    dxb:BarManager.DXContextMenu="{Binding Path=(dxgcore:GridControl.CurrentView).DataControlMenu, RelativeSource={RelativeSource TemplatedParent}}"
                                    dxgcore:GridControl.CurrentView="{Binding Path=(dxgcore:GridControl.CurrentView), RelativeSource={RelativeSource TemplatedParent}}">
                                    <dxgcore:GridControl.CurrentViewChangedListener>
                                    <dxgcore:GroupPanelInitializer />
                                    </dxgcore:GridControl.CurrentViewChangedListener>
                                    <dxgcore:GridViewHitInfoBase.HitTestAcceptor>
                                    <dxght:GroupPanelTableViewHitTestAcceptor />
                                    </dxgcore:GridViewHitInfoBase.HitTestAcceptor>
                                    </dxgcore:GroupPanelControl>
                                    <ContentPresenter Name="PART_HeadersPanel" Grid.Row="1"
                                    MinWidth="{Binding Path=(dxgcore:GridControl.CurrentView).HeaderPanelMinWidth, RelativeSource={RelativeSource TemplatedParent}}"
                                    ContentTemplate="{Binding Path=(dxgcore:GridControl.CurrentView).HeaderTemplate, RelativeSource={RelativeSource TemplatedParent}}"
                                    Visibility="{Binding Path=(dxgcore:GridControl.CurrentView).ShowColumnHeaders, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}"
                                    dxgcore:GridControl.CurrentView="{Binding Path=(dxgcore:GridControl.CurrentView), RelativeSource={RelativeSource TemplatedParent}}">
                                    <dxgcore:GridControl.CurrentViewChangedListener>
                                    <dxgcore:HeadersPanelInitializer />
                                    </dxgcore:GridControl.CurrentViewChangedListener>
                                    <dxgcore:GridViewHitInfoBase.HitTestAcceptor>
                                    <dxght:ColumnHeaderPanelTableViewHitTestAcceptor />
                                    </dxgcore:GridViewHitInfoBase.HitTestAcceptor>
                                    </ContentPresenter>
                                    <dxgcore:AdditionalRowItemsControl Grid.Row="2" Margin="{DynamicResource {dxgt:TableViewThemeKey ResourceKey=RowPresenterGridMargin}}" dxgcore:GridControl.CurrentView="{Binding Path=(dxgcore:GridControl.CurrentView), RelativeSource={RelativeSource TemplatedParent}}">
                                    <dxgcore:AutoFilterRowControl x:Name="PART_FilterRow"
                                    DataContext="{Binding Path=(dxgcore:GridControl.CurrentView).AutoFilterRowData, RelativeSource={RelativeSource TemplatedParent}}"
                                    RowTemplate="{DynamicResource {dxgt:GridRowThemeKey ResourceKey=FilterRowTemplate}}"
                                    ItemTemplate="{DynamicResource {dxgt:GridRowThemeKey ResourceKey=AutoFilterRowItemTemplate}}"
                                    IndicatorWidth="{Binding Path=(dxgcore:GridControl.CurrentView).IndicatorWidth, RelativeSource={RelativeSource TemplatedParent}}"
                                    Visibility="{Binding Path=(dxgcore:GridControl.CurrentView).ShowAutoFilterRow, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}"
                                    dxgcore:GridControl.CurrentView="{Binding Path=(dxgcore:GridControl.CurrentView), RelativeSource={RelativeSource TemplatedParent}}"
                                    />
                                    <dxgcore:NewItemRowControl x:Name="PART_NewItemRow" Visibility="Collapsed"
                                    DataContext="{Binding Path=(dxgcore:GridControl.CurrentView).NewItemRowData, RelativeSource={RelativeSource TemplatedParent}}"
                                    RowTemplate="{DynamicResource {dxgt:GridRowThemeKey ResourceKey=NewItemRowTemplate}}"
                                    ItemTemplate="{DynamicResource {dxgt:GridRowThemeKey ResourceKey=NewItemRowItemTemplate}}"
                                    IndicatorWidth="{Binding Path=(dxgcore:GridControl.CurrentView).IndicatorWidth, RelativeSource={RelativeSource TemplatedParent}}"
                                    dxgcore:GridControl.CurrentView="{Binding Path=(dxgcore:GridControl.CurrentView), RelativeSource={RelativeSource TemplatedParent}}">
                                    <dxgcore:GridControl.CurrentViewChangedListener>
                                    <dxgcore:NewItemRowInitializer />
                                    </dxgcore:GridControl.CurrentViewChangedListener>
                                    </dxgcore:NewItemRowControl>
                                    </dxgcore:AdditionalRowItemsControl>
                                    <Grid Margin="{DynamicResource {dxgt:TableViewThemeKey ResourceKey=RowPresenterGridMargin}}" Grid.Row="3" x:Name="rowPresenterGrid">
                                    <Grid.RowDefinitions>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Core:DXDockPanel>
                                    <dxgcore:FilterPanelControl x:Name="PART_FilterPanel" Core:DXDockPanel.Dock="Bottom" DataContext="{Binding Path=(dxgcore:GridControl.CurrentView), RelativeSource={RelativeSource TemplatedParent}}"/>
                                    <ContentPresenter x:Name="PART_FootersPanel" Core:DXDockPanel.Dock="Bottom"
                                    ContentTemplate="{Binding Path=(dxgcore:GridControl.CurrentView).FooterTemplate, RelativeSource={RelativeSource TemplatedParent}}"
                                    dxgcore:GridControl.CurrentView="{Binding Path=(dxgcore:GridControl.CurrentView), RelativeSource={RelativeSource TemplatedParent}}"
                                    Visibility="{Binding Path=(dxgcore:GridControl.CurrentView).ShowTotalSummary, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}"
                                    >
                                    <dxgcore:GridViewHitInfoBase.HitTestAcceptor>
                                    <dxght:TotalSummaryPanelTableViewHitTestAcceptor/>
                                    </dxgcore:GridViewHitInfoBase.HitTestAcceptor>
                                    </ContentPresenter>
                                    <Grid Background="{StaticResource ViewBackgroundBrush}">
                                    <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <ContentControl Margin="{DynamicResource {dxgt:TableViewThemeKey ResourceKey=IndicatorMargin}}"
                                    Visibility="{Binding Path=(dxgcore:GridControl.CurrentView).ShowColumnHeaders, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverterInverted}}">

                                    </ContentControl>
                                    <ScrollContentPresenter Grid.Row="1" dxgcore:GridControl.CurrentView="{Binding Path=(dxgcore:GridControl.CurrentView), RelativeSource={RelativeSource TemplatedParent}}"
                                    MinWidth="{Binding Path=(dxgcore:GridControl.CurrentView).ScrollableAreaMinWidth, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}">
                                    <ScrollViewer.CanContentScroll>True</ScrollViewer.CanContentScroll>
                                    <ScrollContentPresenter.Name>PART_ScrollContentPresenter</ScrollContentPresenter.Name>
                                    <dxgcore:GridControl.CurrentViewChangedListener>
                                    <dxgcore:ScrollContentPresenterInitializer/>
                                    </dxgcore:GridControl.CurrentViewChangedListener>

                                    <ScrollContentPresenter.Content>
                                    <dxgcore:DataPresenter dxgcore:GridControl.CurrentView="{Binding Path=(dxgcore:GridControl.CurrentView), RelativeSource={RelativeSource TemplatedParent}}" Template="{DynamicResource {dxgt:TableViewThemeKey ResourceKey=DataPresenterTemplate}}">
                                    <dxgcore:GridViewHitInfoBase.HitTestAcceptor>
                                    <dxght:DataAreaTableViewHitTestAcceptor/>
                                    </dxgcore:GridViewHitInfoBase.HitTestAcceptor>
                                    </dxgcore:DataPresenter>
                                    </ScrollContentPresenter.Content>
                                    </ScrollContentPresenter>
                                    <ContentControl Grid.Row="1" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
                                    <ContentControl.Visibility>
                                    <Binding Path="(dxgcore:GridControl.CurrentView).WaitIndicatorType" RelativeSource="{RelativeSource TemplatedParent}">
                                    <Binding.Converter>
                                    <Core:EnumToObjectConverter DefaultValue="Collapsed">
                                    <Core:EnumToObjectConverter.Values>
                                    <Core:EnumObjectProvider x:Key="Panel" Value="Visible"/>
                                    </Core:EnumToObjectConverter.Values>
                                    </Core:EnumToObjectConverter>
                                    </Binding.Converter>
                                    </Binding>
                                    </ContentControl.Visibility>
                                    <Core:WaitIndicator DeferedVisibility="{Binding Path=(dxgcore:GridControl.CurrentView).IsWaitIndicatorVisible, RelativeSource={RelativeSource TemplatedParent}}"
                                    Style="{Binding Path=(dxgcore:GridControl.CurrentView).WaitIndicatorStyle, RelativeSource={RelativeSource TemplatedParent}}" />
                                    </ContentControl>
                                    </Grid>

                                    </Core:DXDockPanel>
                                    <ScrollBar Grid.Column="1"
                                    Value="{Binding VerticalOffset, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                                    Maximum="{Binding ScrollableHeight, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                                    ViewportSize="{Binding ViewportHeight, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                                    Visibility="{Binding ComputedVerticalScrollBarVisibility, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                                    dxgcore:GridControl.CurrentView="{Binding Path=(dxgcore:GridControl.CurrentView), RelativeSource={RelativeSource TemplatedParent}}"
                                    >
                                    <ScrollBar.Name>PART_VerticalScrollBar</ScrollBar.Name>

                                    <dxgcore:GridControl.CurrentViewChangedListener>
                                    <dxgcore:VerticalScrollBarBlendCustomizationExtension />
                                    </dxgcore:GridControl.CurrentViewChangedListener>
                                    <dxgcore:GridViewHitInfoBase.HitTestAcceptor>
                                    <dxght:VerticalScrollBarTableViewHitTestAcceptor />
                                    </dxgcore:GridViewHitInfoBase.HitTestAcceptor>
                                    </ScrollBar>
                                    <ScrollBar Grid.Row="1" Orientation="Horizontal" Margin="{DynamicResource {dxgt:TableViewThemeKey ResourceKey=HorizontalScrollbarMargin}}"
                                    Value="{Binding HorizontalOffset, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                                    Maximum="{Binding ScrollableWidth, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                                    ViewportSize="{Binding ViewportWidth, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                                    Visibility="{Binding ComputedHorizontalScrollBarVisibility, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                                    >

                                    <ScrollBar.Name>PART_HorizontalScrollBar</ScrollBar.Name>
                                    <dxgcore:GridViewHitInfoBase.HitTestAcceptor>
                                    <dxght:HorizontalScrollBarTableViewHitTestAcceptor />
                                    </dxgcore:GridViewHitInfoBase.HitTestAcceptor>
                                    </ScrollBar>
                                    <Border Grid.Row="1" Grid.Column="1" x:Name="PART_HorizontalScrollCorner" Style="{DynamicResource {dxgt:ScrollBarThemeKey ResourceKey=ScrollingCornerStyle}}">
                                    </Border>
                                    </Grid>
                                    <dxgcore:OuterBorderElement Grid.Row="2" Grid.RowSpan="2" x:Name="outerBorder" ShowColumnHeaders="{Binding Path=(dxgcore:GridControl.CurrentView).ShowColumnHeaders, RelativeSource={RelativeSource TemplatedParent}}" />
                                    </Grid>
                                    </ControlTemplate>
                                    </navigation:Page.Resources>


                                    ...


                                    <dxg:TreeListControl IsFilterEnabled="False" Name="tlInvoice" Margin="2,0,0,0" Grid.Row="1" Opacity="1" Background="Yellow">
                                    <dxg:TreeListControl.Columns>
                                    <dxg:TreeListColumn FieldName="f1" Header="ID" Width="20" HorizontalHeaderContentAlignment="Right" AllowEditing="False" HorizontalAlignment="Right" FixedWidth="True" />
                                    <dxg:TreeListColumn AllowEditing="False" FieldName="f2" Header="Service" Width="70" FixedWidth="True" />
                                    <dxg:TreeListColumn FieldName="f3" AllowEditing="False" Header="Type" />
                                    <dxg:TreeListColumn FieldName="f4" Header="Carpet Name" Width="90" AllowEditing="False" FixedWidth="True" />
                                    <dxg:TreeListColumn FieldName="f5" Header="Carpet Size" Width="80" AllowEditing="False" HorizontalAlignment="Center" HorizontalHeaderContentAlignment="Center" FixedWidth="True"></dxg:TreeListColumn>
                                    <dxg:TreeListColumn FieldName="f6" Header="Discount" AllowEditing="True" HorizontalHeaderContentAlignment="Center" HorizontalAlignment="Center" Width="60">
                                    <dxg:TreeListColumn.EditSettings>
                                    <dxe:ComboBoxEditSettings Name="cbInvoiceDiscount" DisplayMember="Name" ValueMember="Id" IsTextEditable="False" DataContextChanged="cbInvoiceDiscount_DataContextChanged" />
                                    </dxg:TreeListColumn.EditSettings>
                                    </dxg:TreeListColumn>
                                    <dxg:TreeListColumn FieldName="f7" Header="Unit Price" Name="colInvoiceUnitPrice" AllowEditing="True" HorizontalAlignment="Right" HorizontalHeaderContentAlignment="Right" AllowBestFit="Default" Width="65">
                                    <dxg:TreeListColumn.EditSettings>
                                    <dxe:TextEditSettings Name="tbInvoiceUnitPrice" DisplayFormat="c" DataContextChanged="cbInvoiceDiscount_DataContextChanged" Mask="c" MaskType="Numeric" MaskUseAsDisplayFormat="True" MaskBeepOnError="True" />
                                    </dxg:TreeListColumn.EditSettings>
                                    </dxg:TreeListColumn>
                                    <dxg:TreeListColumn FieldName="f8" Header="Your Price" Width="65" Name="colInvoiceYourPrice" AllowEditing="False" HorizontalHeaderContentAlignment="Right" HorizontalAlignment="Right" FixedWidth="True" ReadOnly="True">
                                    <dxg:TreeListColumn.EditSettings>
                                    <dxe:TextEditSettings DisplayFormat="c" Mask="c" MaskType="Numeric" MaskUseAsDisplayFormat="True" MaskBeepOnError="True" />
                                    </dxg:TreeListColumn.EditSettings>
                                    </dxg:TreeListColumn>
                                    </dxg:TreeListControl.Columns>
                                    <dxg:TreeListControl.View>
                                    <dxg:TreeListView AllowColumnFiltering="False" AllowFilterEditor="False" AllowMoving="False" AllowSorting="False" AutoExpandAllNodes="True" KeyFieldName="Id" Name="treeListView1" ParentFieldName="ParentId" ShowHorizontalLines="True" ShowVerticalLines="False" ShowIndicator="False" CellValueChanged="treeListView1_CellValueChanged" CellValueChanging="treeListView1_CellValueChanged" KeyUp="treeListView1_KeyUp" FadeSelectionOnLostFocus="False" />
                                    </dxg:TreeListControl.View>
                                    </dxg:TreeListControl>


                                    ...


                                    Thanks

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hello Julia,

                                Thank you for your inquiry and for providing the code snippet. These resources are not applied for your control because they are used for WPF. I suggest you review the How to make TreeListControl transparent thread where you can find a sample project demonstrating how to override the grid's templates in Silverlight.
                                If you face difficulties accomplishing this task, feel free to contact us.

                                Thanks

                                • Julia Skvortsova 08.31.2012

                                  I can't view this question (Q286060) because it is marked as private.

                                • I apologize for the misunderstanding, I have mixed up thread ID's. Please review the How to make TreeListControl transparent thread to know how this can be done.

                                  Thanks

                                • Julia Skvortsova 08.31.2012

                                  When I change background color to orange, rows are getting orange as well, I don't need it. Could you help me?

                                  <ControlTemplate x:Key="TableViewThemeKey_DataPresenterTemplate" TargetType="dxg:DataPresenter">
                                          <Border Background="Orange">
                                              <ContentPresenter />
                                          </Border>
                                      </ControlTemplate>

                                • This behavior is caused by the fact that grid rows are transparent by default. To avoid this issue, I suggest you make them non-transparent using the TreeListView.RowDecorationTemplate property. Please review the Focus row color change thread that demonstrates this approach.

                                  Thanks

                                • Julia Skvortsova 09.03.2012

                                  Thanks a lot! It works.

                                You must  log in  or  register  to leave comments

                                To start a chat you should create a support ticket


                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners