or
<Window x:Class="LabelTemplate_MultiBinding.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:local="clr-namespace:LabelTemplate_MultiBinding" Title="MainWindow" Height="768" Width="1024"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <telerik:RadCartesianChart x:Name="PropertyChart"> <telerik:RadCartesianChart.Resources> <local:ChartNumberFormatter x:Key="NumberFormatter"/> <DataTemplate x:Key="FormattedNumericAxisTemplate"> <TextBlock> <TextBlock.Text> <MultiBinding Converter="{StaticResource NumberFormatter}"> <Binding /> <Binding ElementName="PropertyChart" Path="DataContext.NumericFormat"/> </MultiBinding> </TextBlock.Text> </TextBlock> </DataTemplate> </telerik:RadCartesianChart.Resources> <telerik:RadCartesianChart.HorizontalAxis> <telerik:DateTimeCategoricalAxis/> </telerik:RadCartesianChart.HorizontalAxis> <telerik:RadCartesianChart.VerticalAxis> <telerik:LinearAxis LabelTemplate="{StaticResource FormattedNumericAxisTemplate}" /> </telerik:RadCartesianChart.VerticalAxis> <telerik:RadCartesianChart.Series> <telerik:LineSeries CategoryBinding="Date" ValueBinding="Value" ItemsSource="{Binding Path=Series1}"> </telerik:LineSeries> </telerik:RadCartesianChart.Series> </telerik:RadCartesianChart> <StackPanel Grid.Row="1" Orientation="Horizontal"> <Label>Y Axis Format:</Label> <TextBox Text="{Binding NumericFormat}" Width="200" /> </StackPanel> </Grid></Window>public class MyPoint{ public DateTime Date { get; set; } public Double Value { get; set; }}public partial class MainWindow : Window, INotifyPropertyChanged{ public List<MyPoint> Series1 { get; private set; } private string _NumericFormat; public string NumericFormat { get { return _NumericFormat; } set { if (_NumericFormat != value) { _NumericFormat = value; OnPropertyChanged("NumericFormat"); } } } public MainWindow() { Series1 = new List<MyPoint>(); for (int i = 0; i < 5; i++) { DateTime date = DateTime.Today.AddDays(i); Series1.Add(new MyPoint() { Date = date, Value = i * 1000 }); } InitializeComponent(); DataContext = this; } #region INotifyPropertyChanged public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName = "") { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } #endregion}public class ChartNumberFormatter : IMultiValueConverter{ public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { double number = System.Convert.ToDouble(values[0]); string format = values[1] as string; if (string.IsNullOrEmpty(format)) { return number.ToString(); } return number.ToString(format); } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); }}
public static void ShowInSeparateThread(Type windContent, string windowTitle, int width = 900, int height = 700) { var _viewerThread = new Thread(delegate() { var _eventAggregg = ServiceLocator.Current.GetInstance<IEventAggregator>(); _eventAggregg.GetEvent<ShowModalPopUp>().Publish(true); var _win = new Window { Title = windowTitle, DataContext = new WindowDataContext(), WindowStartupLocation = WindowStartupLocation.CenterScreen, WindowStyle = WindowStyle.None, Style = Application.Current.FindResource("PopUpWindowStyle") as Style, Padding = new Thickness(0), Margin = new Thickness(0), ResizeMode = ResizeMode.NoResize, Content = ServiceLocator.Current.GetInstance(windContent), Width = width, Height = height, ShowInTaskbar = false }; typeof(Window) .InvokeMember("_ownerHandle", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetField, null, _win, new object[] { Process.GetCurrentProcess().MainWindowHandle }); _win.ShowDialog(); _eventAggregg.GetEvent<ShowModalPopUp>().Publish(false); }) { IsBackground = true }; _viewerThread.SetApartmentState(ApartmentState.STA); _viewerThread.Start(); } }<telerik:RadTreeListView ItemsSource="{Binding Path=MyFirstList}" > <telerik:RadTreeListView.ChildTableDefinitions> <telerik:TreeListViewTableDefinition ItemsSource="{Binding ChildVMs}" /> </telerik:RadTreeListView.ChildTableDefinitions> <telerik:RadTreeListView.Columns> <telerik:GridViewDataColumn Header="Name" UniqueName="Name" IsSortable="True" SortingState="Ascending" IsReadOnly="True" DataMemberBinding="{Binding Name}" /> <telerik:GridViewDataColumn Header="Value" TextAlignment="Right" DataMemberBinding="{Binding CurrentValue, Mode=TwoWay}" > <telerik:GridViewDataColumn.Footer> <TextBlock FontSize="12" VerticalAlignment="Top" HorizontalAlignment="Right" Text="{Binding Path=SomeOtherNumber, Mode=OneWay}" /> </telerik:GridViewDataColumn.Footer> </telerik:GridViewDataColumn> <telerik:GridViewDataColumn Header="Timeline" Width="*" IsReadOnly="True" CellTemplateSelector="{StaticResource TimelineTemplateSelector}" CellStyle="{StaticResource TimelineCellStyle}" FooterCellStyle="{StaticResource TimelineFooterStyle}" > <telerik:GridViewDataColumn.Footer> <Grid > <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <telerik:RadHorizontalDataAxis Stroke="DarkRed" Foreground="Gray" ... /> </telerik:GridViewDataColumn.Footer> </telerik:GridViewDataColumn> </telerik:RadTreeListView.Columns></telerik:RadTreeListView><!-- some other content --><telerik:RadTreeListView ItemsSource="{Binding Path=MySecondList}" > <!-- similar to the first list --></telerik:RadTreeListView>public class BackstageViewModel : IViewModel { public RecentFileList RecentFiles { get; set; } // the property I want to point to public BackstageViewModel(ApplicationCommandProxy commandProxy, DataHolder data) { //random setup stuff } //and so on...}<ItemsControl Name="RecentItem" DataContext="{Binding ssm:BackstageViewModel}" ItemsSource="{Binding RecentFiles.RecentFiles}" Focusable="True" DisplayMemberPath="RecentFiles"> <ItemsControl.Template> <ControlTemplate> <telerik:RadRibbonButton Width="285" Command="{x:Static commands:ApplicationCommands.RecentDocumentCommand}"> <StackPanel Orientation="Horizontal"> <Image Source="Resources/Open_16.png" /> <StackPanel Margin="3 0 0 0" HorizontalAlignment="Left"> <TextBlock Margin="0 0 0 2" Text="Example Study" /> <TextBlock Foreground="DimGray" Text="{Binding Path}" /> </StackPanel> </StackPanel> </telerik:RadRibbonButton> </ControlTemplate> </ItemsControl.Template></ItemsControl>