or
Hi,
I had a separate radpane xaml class, it would dynamically generated radpane if it needs.
My problem is when I bound HeaderName to Header without HeaderTemplate code(where I commented), it is working fine to show headername only. But if I uncommented HeaderTemplate code, I only got image show in the UI, no text.
Below is my code:
<telerik:RadPane x:Class="TemplatorWPF.LoadSource" x:Name="RadPaneSource" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:local="clr-namespace:_ViewModel;assembly=_ViewModel" mc:Ignorable="d" Header="{Binding HeaderName}" d:DesignHeight="300" d:DesignWidth="300"> <!--<telerik:RadPane.HeaderTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Image Source="../Resources/templator - level 1.png" /> <TextBlock Text="{Binding HeaderName}"/> </StackPanel> </DataTemplate> </telerik:RadPane.HeaderTemplate>--> <telerik:RadPane.Resources>
private void handleArrows(object sender, KeyEventArgs e){ RadGridView rgv = (RadGridView)sender; if (e.Key == Key.Down) { RadGridViewCommands.MoveDown.Execute(null); rgv.BeginEdit(); e.Handled = true; } if (e.Key == Key.Up) { RadGridViewCommands.MoveUp.Execute(null); rgv.BeginEdit(); e.Handled = true; }}01.private void Button_OnClick(object sender, RoutedEventArgs e)02. {03. Random rnd = new Random();04. int curChannel = rnd.Next(1, 1000);05. 06. CartesianGridLineAnnotation myLineAnnotation = new CartesianGridLineAnnotation();07. myLineAnnotation.Axis = radCartesianChart1.HorizontalAxis;08. myLineAnnotation.Value = curChannel;09. 10. myLineAnnotation.Stroke = System.Windows.Media.Brushes.Fuchsia;11. radCartesianChart1.Annotations.Add(myLineAnnotation);12. 13. var newKLMLabel = new CartesianCustomAnnotation();14. newKLMLabel.HorizontalAxis = radCartesianChart1.HorizontalAxis;15. newKLMLabel.VerticalAxis = radCartesianChart1.VerticalAxis;16. 17. var border = new Border();18. border.CornerRadius = new CornerRadius(4);19. border.Background = Brushes.Gray;20. border.Opacity = 0.9;21. 22. //var content = new TextBlock();23. var content = new Label();24. content.Content = "Channel " + curChannel.ToString();25. border.Child = content;26. 27. newKLMLabel.Content = border;28. newKLMLabel.HorizontalValue = curChannel;29. newKLMLabel.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;30. newKLMLabel.VerticalValue = _chartVM.ParticleEdsSpectrum[curChannel].Counts;31. 32. newKLMLabel.Tag = "klmlabel";33. 34. newKLMLabel.Visibility = Visibility.Visible;35. 36. radCartesianChart1.Annotations.Add(newKLMLabel);37. 38. }<UserControl xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="MyAppNameHere.Desktop.View.UsersControl" xmlns:viewModel="clr-namespace:Toto.Desktop.ViewModel" mc:Ignorable="d" d:DataContext="{d:DesignInstance Type=viewModel:UsersVm}" d:DesignHeight="300" d:DesignWidth="600"> <Grid x:Name="LayoutRoot" Background="White"> <telerik:RadGridView x:Name="radGridView" /> </Grid></UserControl>