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

Tooltip for Sort and Filter icon

11 Answers 194 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Balsuyambu
Top achievements
Rank 1
Balsuyambu asked on 03 May 2011, 06:11 AM
Hi

I need to provide the tooltips for Sort and Filter icon in Rad Silverlight grid with localization.

Please let me know how can achieve this.

Thanks
Balsuyambu S.

11 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 03 May 2011, 08:11 AM
Hello Balsuyambu,

In order to define a ToolTip for the sorting and filtering indicators, you have to edit the template of the GridViewHeaderCell and set the corresponding ToolTip for each of them. I am sending you a sample project with the required Style and the ToolTips defined. In case you want to localize them, you may bind it to the corresponding localized property.
 

Kind regards,
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
Balsuyambu
Top achievements
Rank 1
answered on 03 May 2011, 08:30 AM

Hi Maya,

Thank you for clarification.

As per my requirement, if sorted column is in Ascending order, i need assign tooltip as "Sort by descending" and if its decending order then tooltip as "Sort by Ascending".

Please update me how can i achieve this and also let me know the Localization property name to apply both the tooltips

Thanks
Balsuyambu S.

0
Maya
Telerik team
answered on 03 May 2011, 03:52 PM
Hello Balsuyambu,

You may bind the ToolTip to a property in your ViewModel for example and update during the Sorting event. For example:

XAML:
<Path x:Name="PART_SortIndicator"
                ToolTipService.ToolTip="{Binding MySortingToolTip, Source={StaticResource MyViewModel}, Mode=TwoWay}" >
 
C#:
private void clubsGrid_Sorting(object sender, GridViewSortingEventArgs e)
        {
            if(e.NewSortingState == SortingState.Ascending)
            {
                model.MySortingToolTip = "Sort by ascending";
            }
            else if(e.NewSortingState == SortingState.Descending)
            {
                model.MySortingToolTip = "Sort by descending";
            }
            else
            {
                model.MySortingToolTip = "";
            }
        }

I am sending you an updated version of the sample attached previously demonstrating the suggested approach. 
As for localizing the Resources, you may take a look at this and this articles 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
Balsuyambu
Top achievements
Rank 1
answered on 13 Jun 2011, 01:03 PM
Hi Maya,

Your solution is working fine. But i am facing another issue.

I want to have a default sort column on page load using sortDescriptor. In this case Tooltip is not displayed for sort state which given in the code behind. but if i click on the column, Tooltip is displayed. Please find the code below

 

 

GridViewColumn objColumn = (GridViewColumn)clubsGrid.Columns[1];

 

 

 

 

SortDescriptor objSort = new SortDescriptor();

 

 

objColumn.SortingState =

 

SortingState.Descending;

 

 

objSort.Member =

 

"Stadium";

 

 

clubsGrid.SortDescriptors.Add(objSort);

Please let me know how can i solve this issue.

0
Maya
Telerik team
answered on 13 Jun 2011, 01:18 PM
Hello Balsuyambu,

This would be the expected behavior since Sorting event is not called when define a SortDescriptor or ColumnSortDescriptor initially. What you may do is to set the content of this ToolTip during the definition of the sort descriptor:

SortDescriptor objSort = new SortDescriptor();
objSort.SortDirection = System.ComponentModel.ListSortDirection.Descending;
objSort.Member = "StadiumCapacity";        
model.MySortingToolTip = "Sort by descending";
this.clubsGrid.SortDescriptors.Add(objSort);
 


Regards,
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
Balsuyambu
Top achievements
Rank 1
answered on 13 Jun 2011, 01:30 PM
Hi Maya

Thanks for your response.

I tried to set the content of this ToolTip during the definition of the sort descriptor but tooltip still is not displayed.

is there any alternate way to fix this issue

Thanks
Balsuyambu

0
Maya
Telerik team
answered on 13 Jun 2011, 01:38 PM
Hello Balsuyambu,

I have tested the behavior and everything works correctly on my side. I am sending you the sample project I used for the test. Please take a look at it and let me know in case of any misunderstandings.
 

Greetings,
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
Balsuyambu
Top achievements
Rank 1
answered on 13 Jun 2011, 02:24 PM
Hi Maya,

Thanks for your immediate response.

Yes, it is working the test project which you have sent.

In your test project, Control Template of GridViewHeaderCell has been mentioned through UserControl.Resources.  But we have implemented the MergedDictionaries. (<ResourceDictionary.MergedDictionaries>).

It is giving null value in constructor of GridView

model =

 

this.Resources["MyViewModel"] as MyViewModel;

model is null value

We need to do any other implementation to get the tooltip which has been implemented via MergedDictionaries.

Thanks
Balsuyambu

 

0
Balsuyambu
Top achievements
Rank 1
answered on 13 Jun 2011, 02:24 PM
Hi Maya,

Thanks for your immediate response.

Yes, it is working the test project which you have sent.

In your test project, Control Template of GridViewHeaderCell has been mentioned through UserControl.Resources.  But we have implemented the MergedDictionaries. (<ResourceDictionary.MergedDictionaries>).

It is giving null value in constructor of GridView

model =

 

this.Resources["MyViewModel"] as MyViewModel;

model is null value

We need to do any other implementation to get the tooltip which has been implemented via MergedDictionaries.

Thanks
Balsuyambu

 

0
Maya
Telerik team
answered on 13 Jun 2011, 02:29 PM
Hi Balsuyambu,

Generally, the correct implementation depends entirely on the settings and structure of your application. However, the idea should be similar - you have to get access to the place where this particular property - MySortingToolTip in this case - is defined and set it to the value you want. It is not necessary your structure to be as the one of the sample project - the important thing is to update the required property. 
 

Regards,
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
Balsuyambu
Top achievements
Rank 1
answered on 15 Jun 2011, 02:36 PM
Hi Maya,

Thanks for your clarification and found alternate way to solve this issue.

Thanks
Balsuyambu
Tags
GridView
Asked by
Balsuyambu
Top achievements
Rank 1
Answers by
Maya
Telerik team
Balsuyambu
Top achievements
Rank 1
Share this question
or