Click here to Skip to main content
15,119,637 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to change the predefined texts of the DataGrid for the controls x:Name="Form_LeerMas_LinkButton" and x:Name="Form_ContentCopy_LinkButton". These controls are inside <datagridtemplatecolumn x:name="Form_GridContent_DataGridTemplateColumn" that="" is="" inside="" <datagrid.columns="">.

In the first it says "Leer Más" and I want it to put "Read More" and in the second it says "Copiar" and I want it to put "Copy". I do not want to do it when displaying the columns after performing the search but directly in a function that is activated by clicking on the language button.

XML
<pre>
                                                                                           <Hyperlink x:Name="Form_LeerMas_LinkButton" CommandParameter="LeerMas" 
                                                                                                       Tag="{Binding ConverterParameter=RowIndex, Converter={StaticResource Converter_Buscar_DataGrid_Opciones}, 
                                                                                                       RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGridRow}}}" Click="Fcn_AppLinkButton_Click">
                                                                                                <Underline Foreground="#507CD1">
                                                                                                    <Run Text="Leer Más" FontSize="11"/>
                                                                                                </Underline>
                                                                                                <!-- <Image Source="{StaticResource leer_mas}" Width="10" Height="10" HorizontalAlignment="Right" VerticalAlignment="Center"/> -->
                                                                                            </Hyperlink>
                                                                                        </TextBlock>
                                                                                    </InlineUIContainer>
                                                                                    
                                                                                    <Run Text=" "/>
                                                                                    
                                                                                        
                                                                                        <TextBlock x:Name="Form_ContenidoCopy_TextBlock" Visibility="Hidden">
                                                                                            <Hyperlink x:Name="Form_ContenidoCopy_LinkButton" CommandParameter="ContenidoCopy" 
                                                                                                       Tag="{Binding ConverterParameter=RowIndex, Converter={StaticResource Converter_Buscar_DataGrid_Opciones}, 
                                                                                                       RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGridRow}}}" Click="Fcn_AppLinkButton_Click">
                                                                                                <Underline Foreground="#507CD1">
                                                                                                    <Run Text="Copiar" FontSize="11"/>


What I have tried:

in internet.in internet.in internet.in internet.
Posted
Updated 22-Oct-21 6:15am
v3

1 solution

Instead of hard-coding the text, bind to the CommandParameter.

See this CP article Passing Command Parameter for Buttons within an ItemTemplate using MVVM Pattern in a WPF Application[^] or this Visual Studio thread How to bind to a command during runtime with a parameter in mvvm?[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900