or
public class AssetClassLevelViewModel
{
public string AssetClassName {get; set;}
public ObservableCollection<AssetClassLevelViewModel> ChildAssetClasses {get; set;}
public ObservableCollection<ProductHoldingsWithAllocationViewModel> ProductHoldings {get; set;}
}
The ProductHoldingsWithAllocationViewModel has properties such as ProductName etc., which are to be displayed in columns. Attached is a sample of what it should look like.AssetClassLevelViewModel, and each of the Products is represented by the ProductHoldingsWithAllocationViewModel.<Window x:Class="RadGridViewScrollingSample.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:local="clr-namespace:RadGridViewScrollingSample" x:Name="_this" Title="MainWindow" Height="350"> <Window.Resources> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/> </Window.Resources> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"> <TextBlock Text='Scroll down in the grid view below then move the mouse over "Place Mouse Here".'/> <TextBlock Text="You will see the grid view automatically scroll to the top."/> <TextBlock Text='Clicking in "Place Mouse Here" will scroll the last row of the grid view in to view, but'/> <TextBlock Text='the grid view will again scroll to the top when the mouse is moved outside "Place Mouse Here".'/> </StackPanel> <telerik:RadGridView x:Name="gridView" Grid.Row="1" Grid.Column="0" ScrollViewer.VerticalScrollBarVisibility="Visible" ItemsSource="{Binding Path=Things}"/> <TextBlock Grid.Row="1" Grid.Column="1" x:Name="placeholder" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center" Text="Place Mouse Here" FontSize="40" MouseUp="OnMouseUp"/> <DockPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"> <TextBlock Text="This is placeholder text. "/> <TextBlock Text='This text appears when the mouse is over "Place Mouse Here".' Visibility="{Binding ElementName=placeholder, Path=IsMouseOver, Converter={StaticResource BooleanToVisibilityConverter}}"/> </DockPanel> </Grid></Window>using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;using System.Collections.ObjectModel;using System.ComponentModel;namespace RadGridViewScrollingSample{ /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { private ObservableCollection<Thing> things = new ObservableCollection<Thing>(); private string[] colors = new string[] { "red", "green", "blue", "orange", "purple" }; private string[] sizes = new string[] { "small", "medium", "large" }; public MainWindow() { InitializeComponent(); DataContext = this; int i = 0; for (char c = 'A'; c <= 'Z'; c++, i++) { things.Add(new Thing(c.ToString(), colors[i % colors.Length], sizes[i % sizes.Length])); } } public ObservableCollection<Thing> Things { get { return things; } } private void OnMouseUp(object sender, MouseButtonEventArgs e) { gridView.ScrollIntoView(things.FirstOrDefault(t => t.Name == "Z")); } } public class Thing { private string name; private string color; private string size; public Thing(string name, string color, string size) { this.name = name; this.color = color; this.size = size; } public string Name { get { return name; } } public string Color { get { return color; } } public string Size { get { return size; } } }}
private void radDocking_ElementLoading( object sender, Telerik.Windows.Controls.LayoutSerializationLoadingEventArgs e ){ var pane = e.AffectedElement as RadPane; if ( pane != null ) { pane.Content = this.GetPaneContent( e.AffectedElementSerializationTag ); }}RadPaneGroup radPaneGroup = new RadPaneGroup { VerticalAlignment = VerticalAlignment.Top, VerticalContentAlignment = VerticalAlignment.Top }; this.view.splitContainer.Items.Add(radPaneGroup); RadPane radPane = new RadPane { Content = createdChartView, CanUserClose = true, Title = createdChartView.DisplayName, }; RadDocking.SetSerializationTag(radPane, chartConfiguration.Id.ToString()); RadDocking.SetSerializationTag(radPaneGroup, chartConfiguration.Id.ToString()); radPaneGroup.Items.Add(radPane); this.hostedCharts.Add(chartConfiguration.Id, createdChartView);private void RadDockingOnElementLoaded(object sender, LayoutSerializationEventArgs e) { RadPane newPane = e.AffectedElement as RadPane; if (newPane != null) { ChartView chartView = ((ChartHostViewModel)this.DataContext).GetPaneContent(e.AffectedElementSerializationTag); RadPane oldParentPane = (RadPane)chartView.Parent; if (oldParentPane != null) { RadPaneGroup oldParentGroup = (RadPaneGroup)oldParentPane.Parent; if (oldParentGroup != null) { RadSplitContainer oldSplitContainer = (RadSplitContainer)oldParentGroup.Parent; if (oldSplitContainer != null) { oldSplitContainer.Items.Remove(oldParentGroup); } oldParentGroup.Items.Remove(oldParentPane); } oldParentPane.Content = null; } newPane.Content = chartView; return; } RadPaneGroup newPaneGroup = e.AffectedElement as RadPaneGroup; if (newPaneGroup != null) { newPaneGroup.VerticalAlignment = VerticalAlignment.Top; newPaneGroup.VerticalContentAlignment = VerticalAlignment.Top; } }
FrameworkElementFactory factory = new FrameworkElementFactory(typeof(CheckBox));factory.AddHandler(CheckBox.CheckedEvent, new RoutedEventHandler(GridViewAll_HeaderCheckBox_Checked));factory.AddHandler(CheckBox.UncheckedEvent, new RoutedEventHandler(GridViewAll_HeaderCheckBox_Checked));factory.SetValue(CheckBox.ToolTipProperty, "(De)Select All");DataTemplate template = new DataTemplate();template.DataType = typeof(bool);template.VisualTree = factory;
GridViewCheckBoxColumn column = new GridViewCheckBoxColumn();column.DataMemberBinding = new Binding(prefix + property.Name);column.Header = template // <-- this does not work
var customerids = from c in customersQueryView select c.customerid;var customerids = from c in customersQueryView.AsQueryable() select c.customerid;