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

Unselected row when focus is lost

1 Answer 95 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ADM-IT Denis Pujdak
Top achievements
Rank 1
ADM-IT Denis Pujdak asked on 19 Jun 2012, 10:23 PM
Telerik Silverlight version: 2012.2.607.1050

Please see attachments

1 Answer, 1 is accepted

Sort by
0
ADM-IT Denis Pujdak
Top achievements
Rank 1
answered on 07 Jul 2012, 10:42 AM
I'm Sorry. I thought it an error.

I found the solution of this problem (VisualState x:Name="SelectedUnfocused"):

<Style x:Key="AttachmentsGridTemplateStyle" TargetType="telerik:GridViewRow">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="telerik:GridViewRow">
                <Border BorderBrush="Silver" BorderThickness="1" Padding="3">
                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="CommonStates">
                            <VisualState x:Name="Normal"/>
                        </VisualStateGroup>
                        <VisualStateGroup x:Name="SelectionStates">
                            <VisualState x:Name="Unselected"/>
                            <VisualState x:Name="Selected">
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="(UIElement.Background)" Storyboard.TargetName="Grid1">
                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ListView_GridViewRow_Background_Selected}"/>
                                    </ObjectAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="SelectedUnfocused">
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="(UIElement.Background)" Storyboard.TargetName="Grid1">
                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ListView_GridViewRow_Background_SelectedUnfocused}"/>
                                    </ObjectAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <Grid Background="{StaticResource ListView_GridViewRow_Background}" x:Name="Grid1" Height="64">
                        <i:Interaction.Behaviors>
                            <addons:DoubleClickBehavior DoubleClickCommand="{Binding EditItemCommand.Command}"/>
                        </i:Interaction.Behaviors>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                         
                        <telerik:DataCellsPresenter x:Name="PART_DataCellsPresenter" Grid.ColumnSpan="3" Canvas.ZIndex="-999" Opacity="0"/>
 
                        <StackPanel Grid.Column="0" Grid.RowSpan="2" Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,5,0">
                            <Image Width="64" Height="64" Source="{Binding ImageThumbnail}" Stretch="Uniform" />
                        </StackPanel>
 
                        <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding attName}" FontSize="11" FontWeight="Bold" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Stretch" TextWrapping="Wrap"/>
 
                        <Image Grid.Column="2" Grid.Row="0" Width="24" Height="24" Source="/ReState.Res;component/Images/button_ok_24x24.png" Visibility="{Binding IsRelated, Converter={StaticResource VisibilityConverter}}" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="3"/>
 
                        <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding attFileName}" FontSize="10" Margin="3" />
 
                        <TextBlock Grid.Column="2" Grid.Row="1" Text="{Binding attSize, Converter={StaticResource FileSizeConverter}}" FontSize="10" Margin="3" HorizontalAlignment="Right" />
 
                    </Grid>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

This post can be closed.
Good luck!!!
Tags
GridView
Asked by
ADM-IT Denis Pujdak
Top achievements
Rank 1
Answers by
ADM-IT Denis Pujdak
Top achievements
Rank 1
Share this question
or