This is a migrated thread and some comments may be shown as answers.

GridView mouse click doesn't make black border appear

3 Answers 48 Views
GridView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 24 Oct 2012, 09:34 PM
I have a GridView with EditTriggers set to TextInput and F2. When I click a cell it does not get bordered by a black border, but if I use the arrow keys the black border appears. I need a way to show that the mouse click did indeed select the cell the user clicked. Note: I don't mean enter edit mode but rather the cell that would be edited on the next keystroke/F2 press. 

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 25 Oct 2012, 10:27 AM
Hello,

 I have tested this locally and on our WPF Demos but every time when I clicked on a cell, the black cell border has appeared.

May I ask you to isolate the issue in a sample project which we could check at our side?

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
David
Top achievements
Rank 1
answered on 25 Oct 2012, 01:43 PM
Here is a sample of the xaml I am using. I will try and get a sample project to reproduce the error.

<
ResourceDictionary
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="GlobalResources.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    <Thickness x:Key="GridGapThickness" Bottom="1" Top="1" Right="1.5" Left="1.5" />
    <Style TargetType="{x:Type telerik:RadGridView}">
        <Setter Property="Background" Value="{StaticResource GridBackgroundBrush}" />
        <Setter Property="GridLinesVisibility" Value="None" />
    </Style>
    <Style x:Key="BaseTelerikCell" TargetType="{x:Type telerik:GridViewCell}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type telerik:GridViewCell}">
                    <Grid Background="{TemplateBinding Background}">
                        <Border VerticalAlignment="Stretch" BorderThickness="{StaticResource GridGapThickness}" BorderBrush="{StaticResource GridBackgroundBrush}">
                            <ContentPresenter x:Name="CellContentPresenter" VerticalAlignment="Center"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="NoTabStopTelerikCell" TargetType="{x:Type telerik:GridViewCell}" BasedOn="{StaticResource BaseTelerikCell}">
        <Setter Property="IsTabStop" Value="False" />
    </Style>
    <Style x:Key="ReadOnlyTelerikCell" TargetType="{x:Type telerik:GridViewCell}" BasedOn="{StaticResource NoTabStopTelerikCell}">
        <Setter Property="Foreground" Value="{StaticResource ReadOnlyCellForegroundBrush}" />
        <Setter Property="Background" Value="{StaticResource ReadOnlyCellBackgroundBrush}" />
    </Style>
     
    <DataTemplate x:Key="GroupCol1Template">
        <TextBlock FontFamily="{StaticResource MonospaceFont}" Text="{Binding GroupDelta, TargetNullValue=''}" Background="Transparent" />
    </DataTemplate>
 
    <DataTemplate x:Key="GroupCol2Template">
        <TextBlock FontFamily="{StaticResource MonospaceFont}" Background="Transparent">
            <TextBlock.Text>
                <Binding Path="TiePriceDisplay">
                    <Binding.ValidationRules>
                        <validation:RegularExpressionRule RegEx="{StaticResource DecimalOrFractionPriceRegEx}" />
                    </Binding.ValidationRules>
                </Binding>
            </TextBlock.Text>
        </TextBlock>
    </DataTemplate>
 
    <DataTemplate x:Key="GroupCol1EditorTemplate">
        <TextBox FontFamily="{StaticResource MonospaceFont}" Text="{Binding GroupDelta, TargetNullValue=''}" BorderBrush="{x:Null}" Background="Transparent" />
    </DataTemplate>
 
    <DataTemplate x:Key="GroupCol2EditorTemplate">
        <TextBox FontFamily="{StaticResource MonospaceFont}" BorderBrush="{x:Null}" Background="Transparent">
            <TextBox.Text>
                <Binding Path="TiePriceDisplay">
                    <Binding.ValidationRules>
                        <validation:RegularExpressionRule RegEx="{StaticResource DecimalOrFractionPriceRegEx}" />
                    </Binding.ValidationRules>
                </Binding>
            </TextBox.Text>
        </TextBox>
    </DataTemplate>
     
    <DataTemplate x:Key="Col1Template">
        <ItemsControl ItemsSource="{Binding LegGroupProxies}" ItemTemplate="{StaticResource GroupCol1Template}" Style="{StaticResource LegGroupItemsControl}" />
    </DataTemplate>
    <DataTemplate x:Key="Col2Template">
        <ItemsControl ItemsSource="{Binding LegGroupProxies}" ItemTemplate="{StaticResource GroupCol2Template}" Style="{StaticResource LegGroupItemsControl}" />
    </DataTemplate>
    <DataTemplate x:Key="Col1EditTemplate">
        <ItemsControl ItemsSource="{Binding LegGroupProxies}" ItemTemplate="{StaticResource GroupCol1EditorTemplate}" Style="{StaticResource LegGroupItemsControl}" />
    </DataTemplate>
    <DataTemplate x:Key="Col2EditTemplate">
        <ItemsControl ItemsSource="{Binding LegGroupProxies}" ItemTemplate="{StaticResource GroupCol2EditorTemplate}" Style="{StaticResource LegGroupItemsControl}" />
    </DataTemplate>
</ResourceDictionary>
         
<telerik:RadGridView Name="ContractProxyGridView"
                     ItemsSource="{Binding ContractProxies}"
                     EnableColumnVirtualization="True"
                     AutoGenerateColumns="False"
                     SelectionUnit="Cell"
                     SelectionMode="Single"
                     RowIndicatorVisibility="Hidden"
                     EditTriggers="TextInput, F2">
    <telerik:RadGridView.SortDescriptors>
        <telerik:ColumnSortDescriptor Column="{Binding Columns[\Updated\], ElementName=ContractProxyGridView}" SortDirection="Descending"/>
    </telerik:RadGridView.SortDescriptors>
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="MouseRightButtonDown">
            <mvvmcmd:EventToCommand Command="{Binding ItemClickedCommand}" CommandParameter="{Binding SelectedCells, ElementName=ContractProxyGridView}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
    <telerik:RadGridView.InputBindings>
        <KeyBinding Gesture="CTRL+T" Command="{Binding TouchSelectedContractCommand}" CommandParameter="{Binding SelectedItem, ElementName=ContractProxyGridView}"/>
        <KeyBinding Gesture="CTRL+F" Command="{Binding FlipSelectedContractCommand}" CommandParameter="{Binding SelectedItem, ElementName=ContractProxyGridView}"/>
        <KeyBinding Gesture="CTRL+E" Command="{Binding EditSelectedContractCommand}" CommandParameter="{Binding SelectedItem, ElementName=ContractProxyGridView}"/>
        <KeyBinding Gesture="CTRL+P" Command="{Binding PinSelectedContractCommand}" CommandParameter="{Binding SelectedItem, ElementName=ContractProxyGridView}"/>
    </telerik:RadGridView.InputBindings>
    <telerik:RadGridView.Columns>
        <telerik:GridViewColumn Header="Actions" CellTemplate="{StaticResource ActionButtonsTemplate}" IsReorderable="False" IsResizable="False" CellStyle="{StaticResource ReadOnlyTelerikCell}" />
        <telerik:GridViewDataColumn Header="Updated" DataMemberBinding="{Binding Updated, Mode=TwoWay, StringFormat=t}" CellStyle="{StaticResource ReadOnlyTelerikCell}" IsFilterable="False" />
        <telerik:GridViewDataColumn Header="Underlying" DataMemberBinding="{Binding Underlying}" CellTemplate="{StaticResource ContractUnderlyingTemplate}" CellStyle="{StaticResource ReadOnlyTelerikCell}" />
        <telerik:GridViewDataColumn Header="Description" DataMemberBinding="{Binding UniqueExpirationDates}" IsReadOnly="True" CellTemplate="{StaticResource ContractDescriptionTemplate}" Width="200" CellStyle="{StaticResource ReadOnlyTelerikCell}">
            <telerik:GridViewDataColumn.FilteringControl>
                <Controls:DescriptionExpiryFilteringControl />
            </telerik:GridViewDataColumn.FilteringControl>
        </telerik:GridViewDataColumn>
        <telerik:GridViewDataColumn Header="Col1" CellTemplate="{StaticResource Col1Template}" CellEditTemplate="{StaticResource Col1EditTemplate}" CellStyle="{StaticResource NoTabStopTelerikCell}" />
        <telerik:GridViewDataColumn Header="Col2" CellTemplate="{StaticResource Col2Template}" CellEditTemplate="{StaticResource Col2EditTemplate}" CellStyle="{StaticResource NoTabStopTelerikCell}" />
        <telerik:GridViewDataColumn Header="Col3" DataMemberBinding="{Binding Strategy}" IsReadOnly="True" CellStyle="{StaticResource ReadOnlyTelerikCell}" />
        <telerik:GridViewDataColumn Header="Col4" DataMemberBinding="{Binding Col4Data, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" CellStyle="{StaticResource BidCell}" IsFilterable="False" />
        <telerik:GridViewDataColumn Header="Col5" DataMemberBinding="{Binding Col5data, Mode=TwoWay, TargetNullValue='', UpdateSourceTrigger=LostFocus}" CellStyle="{StaticResource BidPriceCell}" IsFilterable="False" />
        <telerik:GridViewComboBoxColumn Header="Col6" EditTriggers="CellClick" ItemsSourceBinding="{Binding Col6Source}" DataMemberBinding="{Binding Col6Data}" CellStyle="{StaticResource BaseTelerikCell}" />
    </telerik:RadGridView.Columns>
</telerik:RadGridView>
0
David
Top achievements
Rank 1
answered on 25 Oct 2012, 04:11 PM
Please close this thread. We had a data trigger on the IsSelected property.
Tags
GridView
Asked by
David
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
David
Top achievements
Rank 1
Share this question
or