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

Databinding gridview texts

4 Answers 93 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ludwig
Top achievements
Rank 1
Ludwig asked on 29 Apr 2011, 11:08 AM
Hi,

I would like to localize texts like "Drag a column header and drop it here to group by that column" and others. The standard approach as explained at http://www.telerik.com/help/silverlight/common-localization.html doesn't work for me, because I need instant translation if the culture changes. So I would like to bind these texts to viewmodel properties. How can I do that?

Thanks,
L

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 29 Apr 2011, 11:46 AM
Hello Ludwig,

You may take a look at this forum thread for further reference.
 

All the best,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ludwig
Top achievements
Rank 1
answered on 29 Apr 2011, 06:13 PM
I was hoping there was already a better solution, that is MVVM oriented. Are there plans for this for future versions?

Isn't there a way to edit the 'group by' header template?
0
Vlad
Telerik team
answered on 02 May 2011, 06:32 AM
Hi,

 Indeed you can edit any grid template using Blend. 

All the best,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ludwig
Top achievements
Rank 1
answered on 02 May 2011, 03:25 PM
Meanwhile I succeeded in applying the language change on the fly by using the followowing template:

<Style x:Key="GridViewGroupPanelStyle1" TargetType="{x:Type GridView:GridViewGroupPanel}">
        <Setter Property="Template">
        <Setter.Value>
        <ControlTemplate TargetType="{x:Type GridView:GridViewGroupPanel}">
        <Grid Background="Transparent">  
                            <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Opacity="0.6" /> 
                            <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" /> 
                            <WrapPanel Margin="-2,0,0,0">
                                <TextBlock x:Name="GroupedByArea" Text="{lex:LocText S3.ParametersUE.PatientManagement:UIStrings:PatientListView_GroupPanelGroupByText}" Margin="10, 0, 0, 0" IsHitTestVisible="False" VerticalAlignment="Center" />
                                <ItemsPresenter x:Name="itemsPresenter" Margin="0,10,10,10" /> 
                            </WrapPanel>
                            <StackPanel Orientation="Vertical" Margin="10,10,0,0" >
                                <TextBlock x:Name="DragArea" Text="{lex:LocText S3.ParametersUE.PatientManagement:UIStrings:PatientListView_GroupPanelDragHereText}" Opacity="0.5" FontFamily="Arial" FontSize="10" IsHitTestVisible="False" VerticalAlignment="Center" />                               
                            </StackPanel>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="HasItems" Value="True">
                                <Setter Property="Visibility" TargetName="GroupedByArea" Value="Visible"/>
                                <Setter Property="Visibility" TargetName="DragArea" Value="Collapsed"/>
                            </Trigger>
                            <Trigger Property="HasItems" Value="False">
                                <Setter Property="Visibility" TargetName="GroupedByArea" Value="Collapsed"/>
                                <Setter Property="Visibility" TargetName="DragArea" Value="Visible"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
        </Setter.Value>
        </Setter>
        </Style>     

Of course, it would be much better if we could databind properties to a viewmodel, in order to have these kind of texts translated, because there are still texts in the filter popups that need to be translated (select all, show rows with value that, is equal too etc...) and I really don't want to redesign these templates.

Will such a feature be available in a future version? Because of this we cannot completely localize the application.
            
Tags
GridView
Asked by
Ludwig
Top achievements
Rank 1
Answers by
Maya
Telerik team
Ludwig
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or