<
telerik:RadGridView x:Name="radGridViewList" Margin="5 0 5 5" Visibility="Visible" RowDetailsVisibilityMode="Collapsed" FrozenColumnCount="1"
RowIndicatorVisibility="Collapsed" IsReadOnly="True" AutoGenerateColumns="False" CanUserFreezeColumns="False" Grid.Row="3"
CanUserResizeColumns="True" ShowColumnFooters="True" ShowGroupFooters="True" SelectionMode="Extended" IsSynchronizedWithCurrentItem="True"> />
static public void SetColumns(RadGridView pGrid, ColumnDescriptor[] pColumnNames)
{
if (pColumnNames != null)
{
EnumerableAggregateFunctionBase aggFunc;
for (int iColumnIndex = 0; iColumnIndex < pColumnNames.Length; iColumnIndex++)
{
ColumnDescriptor oneName = pColumnNames[iColumnIndex];
GridViewDataColumn oneColumn = new Telerik.Windows.Controls.GridViewDataColumn();
oneColumn.Header = oneName.ColumnName;
//Apply proper column display format.
switch (oneName.Format.ToUpper())
{
case "$":
oneColumn.DataFormatString = "C2";
break;
case "D":
oneColumn.DataFormatString = "yyyy'-'MM'-'dd";
break;
case "H":
oneColumn.DataFormatString = "HH':'mm";
break;
case "DH":
oneColumn.DataFormatString = "yyyy'-'MM'-'dd' 'HH':'mm";
break;
}
oneColumn.Width = new GridViewLength(1, GridViewLengthUnitType.Star);
oneColumn.ShowFilterButton = true;
oneColumn.IsSortable = true;
oneColumn.IsFilterable = true;
oneColumn.DataMemberBinding = new Binding(string.Format("ElementCells[{0:D}]", iColumnIndex));
oneColumn.TextAlignment = (TextAlignment)oneName.TextAlignment;
oneColumn.HeaderTextAlignment = (TextAlignment)oneName.TextAlignment;
//Create proper aggregate functions.
if (oneName.Agregation != AgregationFunction.None)
{
aggFunc = null;
switch (oneName.Agregation)
{
case AgregationFunction.Average:
aggFunc = new AverageFunction()
{
Caption = LocGeneral.GetControlText("Average") + ": "
};
break;
case AgregationFunction.Count:
aggFunc = new CountFunction()
{
Caption = LocGeneral.GetControlText("Count") + ": "
};
break;
case AgregationFunction.FirstValue:
aggFunc = new FirstFunction()
{
Caption = LocGeneral.GetControlText("First") + ": "
};
break;
case AgregationFunction.LastValue:
aggFunc = new LastFunction()
{
Caption = LocGeneral.GetControlText("Last") + ": "
};
break;
case AgregationFunction.MaxValue:
aggFunc = new MaxFunction()
{
Caption = LocGeneral.GetControlText("Max") + ": "
};
break;
case AgregationFunction.MinValue:
aggFunc = new MinFunction()
{
Caption = LocGeneral.GetControlText("Min") + ": "
};
break;
case AgregationFunction.Sum:
aggFunc = new SumFunction()
{
Caption = LocGeneral.GetControlText("Sum") + ": ",
SourceFieldType = typeof(Decimal)
};
break;
}
//If aggregate function created, we add it to the column.
if (aggFunc != null)
{
oneColumn.AggregateFunctions.Add(aggFunc);
}
}
pGrid.Columns.Add(oneColumn);
}
}
}
using System;
using System.Diagnostics;
using System.Runtime.Serialization;
namespace com.christiegrp.Neuron.Client
{
[DataContract]
public class CompleteConfiguration : NeuronClientBase
{
#region Constructors.
public CompleteConfiguration(bool pReadFromDatabase)
: base(pReadFromDatabase)
{
}
#endregion
#region NeuronClientBase overrides.
protected override string getListBoxDisplay()
{
return Name;
}
protected override string[] getColumnNames()
{
switch (GuiLanguage)
{
case Languages.LanguageEn:
return new string[] { "Code", "Name", "Contents" };
case Languages.LanguageFr:
return new string[] { "Code", "Nom", "Contenu" };
}
return null;
}
protected override object[] getItems()
{
return new object[] { Code, Name, Contents };
}
protected override void copyFrom(NeuronClientBase pSource)
{
base.copyFrom(pSource);
CompleteConfiguration theSource = pSource as CompleteConfiguration;
if (theSource == null)
{
throw new ArgumentException(WrongArgumentType, "pSource");
}
Code = theSource.Code;
Name = theSource.Name;
Contents = theSource.Contents;
IsVisible = theSource.IsVisible;
}
#endregion
#region Properties from main table.
[DataMember]
public string Code
{
[DebuggerStepThrough]
get { return mCode; }
[DebuggerStepThrough]
set
{
if (mCode != value)
{
mCode = value;
NotifyOfPropertyChange("Code");
}
}
}
[DataMember]
public string Name
{
[DebuggerStepThrough]
get { return mName; }
[DebuggerStepThrough]
set
{
if (mName != value)
{
mName = value;
NotifyOfPropertyChange("Name");
}
}
}
[DataMember]
public string Contents
{
[DebuggerStepThrough]
get { return mContents; }
[DebuggerStepThrough]
set
{
if (mContents != value)
{
mContents = value;
NotifyOfPropertyChange("Contents");
}
}
}
[DataMember]
public bool IsVisible
{
[DebuggerStepThrough]
get { return mIsVisible; }
[DebuggerStepThrough]
set
{
if (mIsVisible != value)
{
mIsVisible = value;
NotifyOfPropertyChange("IsVisible");
}
}
}
#endregion
#region Private fields.
private string mCode;
private string mName;
private string mContents;
private bool mIsVisible;
#endregion
}
[DataContract]
public class ColumnDescriptor
{
[DataMember]
public string ColumnName { get; set; }
[DataMember]
public ColumnAlignment TextAlignment { get; set; }
[DataMember]
public AgregationFunction Agregation { get; set; }
[DataMember]
public int GroupingPosition { get; set; }
[DataMember]
public string Format { get; set; }
}
[DataContract]
public class ListElements
{
public ListElements()
{
ElementGuid = Guid.Empty;
ElementCells = null;
IsSelected = false;
}
[DataMember]
public Guid ElementGuid { get; set; }
[DataMember]
public object[] ElementCells { get; set; }
public bool IsSelected { get; set; }
}
public enum ListContext
{
PatientExams, ToBeBilledExamsPublic, NotTransmittedClaimsPublic, TransmittedClaimsPublic, PaidClaimsPublic, InErrorClaimsPublic, ToBeBilledExamsPrivate, NotTransmittedClaimsPrivate, TransmittedClaimsPrivate,
PaidClaimsPrivate, InErrorClaimsPrivate, NmbListContexts
}
public enum AgregationFunction
{
None, Average, MinValue, MaxValue, FirstValue, LastValue, Count, Sum, NmbAgregationFunction
}
public enum ColumnAlignment
{
Left, Right, Center
}
}
<telerik:RadToolBar Grid.Row="0" Grid.Column="0" FocusManager.IsFocusScope="False" ItemsSource="{TemplateBinding local:TBaseReadsWn.ExtToolbarButtons}" ItemTemplate="{StaticResource dtToolbarButton}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="30 4 0 4" > </telerik:RadToolBar><DataTemplate x:Key="dtToolbarButton" DataType="UICommandItem"> <Button Command="{Binding Command}" CommandParameter="{Binding CommandParameter}" Margin="{Binding Margins}" IsEnabled ="{Binding IsEnabled}" ToolTip="{Binding ToolTip}" Width = "22" Height= "20"> <Button.Content> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> </Grid.ColumnDefinitions> <Image Grid.Row="0" Grid.Column="0" Name="img" Style="{StaticResource stlImgBtnIm}" Source="{Binding Image}"></Image> <TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource stlImgBtnTb}" Text="{Binding Text}"></TextBlock> </Grid> </Button.Content> </Button> <DataTemplate.Triggers> <DataTrigger Binding="{Binding Image}" Value="{x:Null}"> <DataTrigger.Setters> <Setter TargetName="img" Property="Visibility" Value="Collapsed"></Setter> </DataTrigger.Setters> </DataTrigger> <DataTrigger Binding="{Binding Margins}" Value="0"> <DataTrigger.Setters> <Setter Property="Margin" Value="2 2 2 2"></Setter> </DataTrigger.Setters> </DataTrigger> </DataTemplate.Triggers> </DataTemplate><Window x:Class="TestTreeListView.MainWindow" xmlns:local="clr-namespace:TestTreeListView" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase" Name="mainWindow" Title="MainWindow" Height="350" Width="525"> <Window.CommandBindings> <CommandBinding Command="local:MainWindow.AddParentRow" Executed="AddParentRow_Executed" /> </Window.CommandBindings> <Window.Resources> <!-- The style of the expand button in the totally rad tree. --> <Style x:Key="ExpandButtonStyle" TargetType="{x:Type telerik:GridViewToggleButton}"> <Setter Property="PresentationMode" Value="PlusMinus"/> </Style> <!-- Context menu for adding a child row to a parent row. --> <ContextMenu x:Key="ParentRowContextMenu"> <ContextMenu.CommandBindings> <CommandBinding Command="local:MainWindow.AddChildRow" Executed="AddChildRow_Executed" /> </ContextMenu.CommandBindings> <MenuItem Command="local:MainWindow.AddChildRow" /> </ContextMenu> <!-- A sorted view of the totally rad tree items. --> <CollectionViewSource x:Key="TotallyRadItemsView" Source="{Binding ElementName=mainWindow, Path=ParentItems}"> <CollectionViewSource.SortDescriptions> <scm:SortDescription PropertyName="Name" /> </CollectionViewSource.SortDescriptions> </CollectionViewSource> </Window.Resources> <Grid> <telerik:RadTreeListView Name="totallyRadTreeListView" AutoGenerateColumns="True" GridLinesVisibility="None" RowIndicatorVisibility="Collapsed" IsFilteringAllowed="False" CanUserSortColumns="False" HierarchyExpandButtonStyle="{StaticResource ExpandButtonStyle}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding Source={StaticResource TotallyRadItemsView}}"> <telerik:RadTreeListView.ChildTableDefinitions> <telerik:TreeListViewTableDefinition ItemsSource="{Binding ChildItems}" /> </telerik:RadTreeListView.ChildTableDefinitions> <telerik:RadTreeListView.ContextMenu> <!-- Context menu for adding a parent row. --> <ContextMenu> <MenuItem Command="local:MainWindow.AddParentRow" CommandTarget="{Binding Path=PlacementTarget, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}" /> </ContextMenu> </telerik:RadTreeListView.ContextMenu> </telerik:RadTreeListView> </Grid></Window>using System;using System.Collections.Generic;using System.Collections.ObjectModel;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 Telerik.Windows.Controls.GridView; // for RowLoadedEventArgsusing Telerik.Windows.Controls.TreeListView; // for TreeListViewRownamespace TestTreeListView{ /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); // RadTreeListView doesn't select its items on right-click, so add // an event handler that accomplishes this. mTreeItemClickHandler = new MouseButtonEventHandler( TotallyRadTreeListViewRow_MouseRightButtonDown ); totallyRadTreeListView.RowLoaded += new EventHandler<RowLoadedEventArgs>( TotallyRadTreeListView_RowLoaded ); totallyRadTreeListView.RowUnloaded += new EventHandler<RowUnloadedEventArgs>( TotallyRadTreeListView_RowUnloaded ); } static MainWindow() { AddParentRow = new RoutedUICommand( "Add Parent Row", "AddParentRow", typeof( MainWindow ) ); AddChildRow = new RoutedUICommand( "Add Child Row", "AddChildRow", typeof( MainWindow ) ); } public static RoutedUICommand AddParentRow { get; set; } public static RoutedUICommand AddChildRow { get; set; } public ObservableCollection<ParentItem> ParentItems { get { return mParentItems; } } private void TotallyRadTreeListViewRow_MouseRightButtonDown( object sender, MouseButtonEventArgs e ) { TreeListViewRow row = sender as TreeListViewRow; row.IsSelected = true; // Throws an exception when right-clicking a child row. if ( row.ParentRow != null ) { // use row.ParentRow.Item here } // Show the context menu whenever a parent row is clicked. if ( row.Item is ParentItem ) { ContextMenu menu = FindResource( "ParentRowContextMenu" ) as ContextMenu; menu.IsOpen = true; } } private void TotallyRadTreeListView_RowLoaded( object sender, RowLoadedEventArgs e ) { if ( e.Row.Item != null ) { e.Row.MouseRightButtonDown += mTreeItemClickHandler; } } private void TotallyRadTreeListView_RowUnloaded( object sender, RowUnloadedEventArgs e ) { e.Row.MouseRightButtonDown -= mTreeItemClickHandler; } private void AddParentRow_Executed( object target, ExecutedRoutedEventArgs e ) { mParentItems.Add( new ParentItem() ); } private void AddChildRow_Executed( object target, ExecutedRoutedEventArgs e ) { ParentItem parentItem = totallyRadTreeListView.SelectedItem as ParentItem; parentItem.ChildItems.Add( new ChildItem() ); } private MouseButtonEventHandler mTreeItemClickHandler = null; ObservableCollection<ParentItem> mParentItems = new ObservableCollection<ParentItem>(); } public class ParentItem { public string Name { get { return name; } } public ObservableCollection<ChildItem> ChildItems { get { return mChildItems; } } private string name = "Parent" + i++; ObservableCollection<ChildItem> mChildItems = new ObservableCollection<ChildItem>(); private static int i = 0; } public class ChildItem { public string Name { get { return name; } } //public ObservableCollection<ChildItem> ChildItems { get { return mChildItems; } } private string name = "Child" + i++; //ObservableCollection<ChildItem> mChildItems = new ObservableCollection<ChildItem>(); private static int i = 0; }}<telerik:RadNumericUpDown Name="TopNSpinner" IsEditable="True" Minimum="1" ValueFormat="Numeric" Value="{Binding Result.TopNEventsCount, Mode=TwoWay}"/>TopNSpinner.NumberFormatInfo = new NumberFormatInfo() { NumberDecimalDigits = 0 };System.Threading.Thread.Sleep(xxxx);
RadRichTextBox textBox = new RadRichTextBox(); grid.Children.Add(textBox); textBox.ApplyTemplate(); textBox.UpdateEditorLayout(); textBox.Document = this.CreateDocument(); textBox.Print("MyDoc", PrintMode.Native); // It crash in here!