- I Have a Textblock in a grid column which have different values like 2,4,1,0,3 etc.
- The values shows the quantity of students who belong to a play group activity as Cricket,BaseBall,Chess, BasketBall,Carrom etc.
- On Mouse Over a ToolTip is shown.This Tooltip conatins The name of Student who will play in the Specific Group
PlayGroup.xaml File
<TextBlock TextAlignment="Center" VerticalAlignment="Center" Text="{Binding Path=RowData.Row.PlayGroup}" ToolTipService.ToolTip="{Binding Converter={StaticResource TooltipView}}"/>
<UserControl.Resources>
<innercontrols:ListToStringConverter x:Key="TooltipView"/>
</UserControl.Resources>
PlayGroup.CS File
public class ListToStringConverter : IValueConverter //List To String Converter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
List<string> lst = new List<string>();
string combindedString = "";
try
{
lst.Clear();
lst.Add("Cricket");
lst.Add("BaseBall");
lst.Add("Chess");
combindedString = string.Join("\n", lst.ToArray());
return combindedString;
}
catch (Exception ex)
{
} return combindedString;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value; // throw new NotImplementedException();
}
}
- How can I bind Dynamic List as Tooltip based on the number of Students? Should I use String Builder or List or Observable Collection?
- In the above I have given a list of 3 students ,but we require to show dynamic data as list .