We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How do I display the ValueMemberPath without using the Tooltip?


Ultimately my ideal solution would be to show the ValueMemberPath in the Legend along with the Category name itself, but if that's not possible, then I would like to have a way to display the selected value (and hierarchical children below it if possible).

Can someone help me figure this out?

1 Reply

BK Bharathiraja K Syncfusion Team September 26, 2019 11:35 AM UTC

Hi Matthew, 
 
Greetings from Syncfusion.  You can show the ValueMemberPath in label using the SelectionChanged event. This event occurs whenever you select the segment and get the SelectedSegment details (ValueMemberPath) as argument. Please find the code snippet below, 
 
[XAML]: 
<sunburst:SfSunburstChart x:Name="sunburstChart" ItemsSource="{Binding DataSource}" 
                                  ValueMemberPath="EmployeesCount" SelectionChanged="SunburstChart_SelectionChanged"> 
</sunburst:SfSunburstChart> 
 
 
[C#] 
private void SunburstChart_SelectionChanged(object sender, Syncfusion.SfSunburstChart.XForms.SelectionChangedEventArgs e) 
        { 
            if (e.SelectedSegment != null) 
            { 
                stackLayout.IsVisible = true; 
 
                if (!e.IsSelected) 
                { 
                    stackLayout.IsVisible = false; 
                } 
 
                if (e.SelectedSegment.CurrentLevel == 0) 
                { 
                    countryLabel.Text = "Continent: " + e.SelectedSegment.Category; 
                    populationLabel.Text = "Employee Count: " + e.SelectedSegment.Value; 
                } 
                else if (e.SelectedSegment.CurrentLevel == 1) 
                { 
                    countryLabel.Text = "Category: " + e.SelectedSegment.Category; 
                    populationLabel.Text = "Employee Count: " + e.SelectedSegment.Value; 
                } 
                else if (e.SelectedSegment.CurrentLevel == 2) 
                { 
                    countryLabel.Text = "Designation: " + e.SelectedSegment.Category; 
                    populationLabel.Text = "Employee Count: " + e.SelectedSegment.Value; 
                } 
                else  
                { 
                    countryLabel.Text = "Platform: " + e.SelectedSegment.Category; 
                    populationLabel.Text = "Employee Count: " + e.SelectedSegment.Value; 
                } 
            } 
        } 
 
 
Please download the sample from the below link.  
 
UG document link: 
 
Please find the attached sample. 
 
Regards, 
Bharathi.  


Loader.
Live Chat Icon For mobile
Up arrow icon