Quantcast
Channel: wpftoolkit Discussions Rss Feed
Viewing all articles
Browse latest Browse all 2157

New Post: Hep with Rogue UI Element

$
0
0
Hello, I am having a problem figuring out why this element is overlaid on top of the column headers. I have used snoop and the live visual tree in visual studio to try and identify this translucent gray element, to no avail. The image below shows this element being rendered.
Image

I have no idea where this is coming from, so I have attached the XAML in the hopes someone may help me figure this out. I appreciate it much. Thanks. -John.
<Color x:Key="GridAlternatingColor">#FF2C292A</Color>
    <Color x:Key="GridForegroundColor">#FFFFFFFF</Color>
    <Color x:Key="GridLineColor">#FF5C5C5C</Color>
    <Color x:Key="GridPrimaryColor">#FF231F20</Color>

    <SolidColorBrush x:Key="GridAlternatingColorBrush" Color="{StaticResource GridAlternatingColor}"/>
    <SolidColorBrush x:Key="GridForegroundColorBrush" Color="{StaticResource GridForegroundColor}"/>
    <SolidColorBrush x:Key="GridLineColorBrush" Color="{StaticResource GridLineColor}"/>
    <SolidColorBrush x:Key="GridPrimaryColorBrush" Color="{StaticResource GridPrimaryColor}"/>
    
    <!-- New Data Templates -->
    <DataTemplate x:Key="StandardGridCellTemplate">
        <TextBlock Margin="65,0,0,0" Text="{Binding}" VerticalAlignment="Center"/>
    </DataTemplate>

    <DataTemplate x:Key="StandardGridCellRightAlignmentTemplate">
        <TextBlock HorizontalAlignment="Right" Margin="0,0,17,0" Text="{Binding}" VerticalAlignment="Center"/>
    </DataTemplate>

    <!-- New Styles -->
    <system:Double x:Key="DataGridRowHeight">48.0</system:Double>

    <Style TargetType="{x:Type xceed:DataCell}">
    </Style>

    <Style TargetType="{x:Type xceed:ColumnManagerCell}">
        <Setter Property="Background" Value="{DynamicResource GridPrimaryColorBrush}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource GridLineColorBrush}"/>
        <Setter Property="BorderThickness" Value="0,0,0,0"/>
        <Setter Property="Foreground" Value="{DynamicResource GridForegroundColorBrush}"/>
        <Setter Property="Height" Value="{DynamicResource DataGridRowHeight}"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="xceed:ColumnManagerCell">
                    <!-- This Grid is used to position the resizer Thumb over the ColumnManagerCell -->
                    <Grid>
                        <!-- Thumb that is used to resize the Column. -->
                        <Thumb x:Name="PART_ColumnResizerThumbLeft" Visibility="Collapsed"/>
                        <!-- Thumb that is used to resize the Column. -->
                        <Thumb x:Name="PART_ColumnResizerThumb" Visibility="Collapsed" />
                        <Border Background="{TemplateBinding Background}" BorderBrush="White" BorderThickness="0,1,0,1" SnapsToDevicePixels="True" UseLayoutRounding="True">
                            <Grid>
                                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" UseLayoutRounding="True">
                                    <!-- This Grid is used to layout the delimiter lines on top of the ContentPresenter -->
                                    <Grid>
                                        <Border Padding="{TemplateBinding Padding}">
                                            <Grid x:Name="contentPanel" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="*" />
                                                    <ColumnDefinition Width="Auto" />
                                                    <ColumnDefinition Width="Auto" />
                                                </Grid.ColumnDefinitions>
                                                <!-- Same ContentPresenter as in the base Cell Template. -->
                                                <xceed:CellContentPresenter x:Name="PART_CellContentPresenter" Grid.Column="0" />
                                                <!-- ContentPresenter that is used to display the sort glyph.
                                                We explicitely set its Content property to Null to prevent the XAML parser
                                                from implicitely setting it to its TemplatedParent's Content. -->
                                                <ContentPresenter Grid.Column="1" x:Name="sortGlyphPresenter" Content="{x:Null}" ContentTemplate="{x:Null}"/>
                                            </Grid>
                                        </Border>
                                    </Grid>
                                </Border>
                            </Grid>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <!-- The following triggers allows the content to correctly align to the center when the mouse is over the ColumnManagerCell and the HorizontalContentAlignment is Center -->
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Value="Visible" Binding="{Binding ElementName=toggleButton, Path=Visibility}" />
                                <Condition Value="Center" Binding="{Binding RelativeSource={RelativeSource Self}, Path=HorizontalContentAlignment}" />
                            </MultiDataTrigger.Conditions>
                            <Setter TargetName="PART_CellContentPresenter" Property="Margin" Value="16,0,0,0" />
                        </MultiDataTrigger>
                        <!-- The following 2 triggers allow the appropriate Sort Glyph to be displayed depending on the ParentColumn's SortDirection. -->
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.SortDirection}" Value="Ascending">
                            <Setter TargetName="sortGlyphPresenter" Property="ContentPresenter.ContentTemplate" Value="{Binding RelativeSource={RelativeSource Self}, Path=(xceed:DataGridControl.DataGridContext).AscendingSortGlyph}" />
                            <Setter TargetName="sortGlyphPresenter" Property="Margin" Value="6,0,0,0" />
                        </DataTrigger>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.SortDirection}" Value="Descending">
                            <Setter TargetName="sortGlyphPresenter" Property="ContentPresenter.ContentTemplate" Value="{Binding RelativeSource={RelativeSource Self}, Path=(xceed:DataGridControl.DataGridContext).DescendingSortGlyph}" />
                            <Setter TargetName="sortGlyphPresenter" Property="Margin" Value="6,0,0,0" />
                        </DataTrigger>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.Visible}" Value="False">
                            <Setter Property="Visibility" Value="Collapsed" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type xceed:ColumnManagerRow}">
        <Setter Property="BorderThickness" Value="0"/>
    </Style>

    <Style TargetType="{x:Type xceed:DataRow}">
        <Setter Property="Height" Value="{StaticResource DataGridRowHeight}"/>
        <Style.Resources>
            <xceed:IndexToOddConverter x:Key="IndexToOddConverter"/>
        </Style.Resources>
        <Style.Triggers>
            <DataTrigger Binding="{Binding (xceed:DataGridVirtualizingPanel.ItemIndex), Converter={StaticResource IndexToOddConverter}, RelativeSource={RelativeSource Self}}" Value="True">
                <Setter Property="Background" Value="{DynamicResource GridAlternatingColorBrush}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type xceed:Row}">
        <Setter Property="Margin" Value="0"/>
    </Style>
    
    <Style TargetType="{x:Type xceed:GroupLevelIndicatorPane}">
        <Setter Property="Visibility" Value="Collapsed"/>
    </Style>

    <Style TargetType="{x:Type xceed:HierarchicalGroupByControl}">
        <Setter Property="Visibility" Value="Collapsed"/>
    </Style>

    <Style TargetType="{x:Type xceed:TableView}">
        <Setter Property="HorizontalGridLineBrush" Value="{DynamicResource GridLineColorBrush}"/>
        <Setter Property="ShowRowSelectorPane" Value="False"/>
        <Setter Property="VerticalGridLineBrush" Value="{DynamicResource GridLineColorBrush}"/>
    </Style>

    <Style x:Key="StandardGridStyle" TargetType="{x:Type xceed:DataGridControl}">
        <Setter Property="AlternationCount" Value="2"/>
        <Setter Property="AutoCreateColumns" Value="False"/>
        <Setter Property="Background" Value="{DynamicResource GridPrimaryColorBrush}"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="{DynamicResource GridForegroundColorBrush}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="UseLayoutRounding" Value="True"/>
    </Style>
Just set the style of your grid to StandardGridStyle as seen in this paste:

TEXT

Viewing all articles
Browse latest Browse all 2157

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>