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

LinkButton in GridViewDataColumn does not appear when you Sort

1 Answer 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Karlo
Top achievements
Rank 1
Karlo asked on 11 Jan 2017, 05:53 AM

 

I have two controls in a GridViewDataColumn (LinkButton and Texblock) and only one control is visible at a time.

 

<Controls:GridViewDataColumn DataMemberBinding="{Binding Id, Mode=OneWay}"
                                  Header="{x:Static lr:TransactionHistoryRes.Id_Header_Text}"
                                  UniqueName="TransactionHistoryModelId" Width="130">
                         <Controls:GridViewDataColumn.CellTemplate>
                           <DataTemplate>
                             <Grid>
                               <max:LinkButton HorizontalAlignment="Right"
                                       Command="{Binding DataContext.OpenDocumentCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=Views:TransactionHistoryView}}"
                                       CommandParameter="{Binding Path=.}"
                                       Content="{Binding Path=Id}"
                                       Visibility="{Binding Path=CanCreateOrViewDocument, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}">
                               </max:LinkButton>
 
                               <TextBlock HorizontalAlignment="Right"
                                          Text="{Binding Path=Id}"
                                          ToolTip="{Binding Path=Information}"
                                          Visibility="{Binding Path=CanCreateOrViewDocument, Converter={StaticResource ReverseBooleanToVisibilityCollapsedConverter}}"/>
                             </Grid>
                           </DataTemplate>
                         </Controls:GridViewDataColumn.CellTemplate>
                       </Controls:GridViewDataColumn>

 

When the grid initially load, it works fine. 

However, there's a wierd behavior that if you SORT the column, initially - the LinkButtons wont show even if it's visibility = true

When you try to sort the column again, the LinkButtons are shown "gradually". (see video link below)

https://youtu.be/GI5G-WaPy-k

When I tried to remove the <Texblock> and just retain the LinkButton, its not behaving like this so I think its something about putting two controls in the cell template. I tried separating the two controls by stackpanel but sill the same behaviour.

 

Thanks,
Karlo

 

1 Answer, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 13 Jan 2017, 03:08 PM
Hi Karlo,

I could not replicate the scenario in a sample from my end. I have added a standard button and a TextBlock and sorting works fine. Is it possible to provide a sample application? I have added one for your reference,

Furthermore, I suggest you check the Hyperlink Column implementation as it might be viable in your case.

Regards,
Stefan Nenchev
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Karlo
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Share this question
or