or
public
User SelectedCreatedBy
{
get
{
if
(_SelectedCreatedBy !=
null
)
_SelectedCreatedBy =
new
User();
return
_SelectedCreatedBy;
}
set
{
if
(_SelectedCreatedBy != value)
{
_SelectedCreatedBy = value;
RaisePropertyChanged(() => SelectedCreatedBy);
}
}
}
public
User SelectedCreatedBy
{
get
{
return
_SelectedCreatedBy;
}
set
{
if
(_SelectedCreatedBy != value)
{
_SelectedCreatedBy = value;
RaisePropertyChanged(() => SelectedCreatedBy);
}
}
}
private
void
ItemsList_SizeChanged(
object
sender, SizeChangedEventArgs e)
{
if
(e.HeightChanged && ItemsList.ActualHeight > 0)
{
var pageSize = (
int
)(ItemsList.ActualHeight / ItemsList.RowHeight);
if
(ItemsList.ShowColumnHeaders)
pageSize--;
if
(pageSize > 0)
ItemPager.PageSize = pageSize;
}
}
<
Window.Resources
>
<
DataTemplate
x:Key
=
"AETemplate"
>
<
Rectangle
>
<
Rectangle.Fill
>
<
RadialGradientBrush
>
<
GradientStop
Color
=
"#FF6DA7B6"
/>
<
GradientStop
Color
=
"#FF077085"
Offset
=
"1"
/>
</
RadialGradientBrush
>
</
Rectangle.Fill
>
</
Rectangle
>
</
DataTemplate
>
<
DataTemplate
x:Key
=
"STPTemplate"
>
<
Rectangle
>
<
Rectangle.Fill
>
<
RadialGradientBrush
>
<
GradientStop
Color
=
"#FFE0DFDA"
/>
<
GradientStop
Color
=
"#FFC2BE57"
Offset
=
"1"
/>
</
RadialGradientBrush
>
</
Rectangle.Fill
>
</
Rectangle
>
</
DataTemplate
>
<
Style
TargetType
=
"{x:Type telerik:BarSeries}"
x:Key
=
"AEStyle"
>
<
Setter
Property
=
"Background"
>
<
Setter.Value
>
<
RadialGradientBrush
>
<
GradientStop
Color
=
"#FF6DA7B6"
/>
<
GradientStop
Color
=
"#FF077085"
Offset
=
"1"
/>
</
RadialGradientBrush
>
</
Setter.Value
>
</
Setter
>
</
Style
>
<
Style
TargetType
=
"Border"
x:Key
=
"STPStyle"
>
<
Setter
Property
=
"Background"
>
<
Setter.Value
>
<
RadialGradientBrush
>
<
GradientStop
Color
=
"#FFE0DFDA"
/>
<
GradientStop
Color
=
"#FFC2BE57"
Offset
=
"1"
/>
</
RadialGradientBrush
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
Window.Resources
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
></
RowDefinition
>
<
RowDefinition
></
RowDefinition
>
</
Grid.RowDefinitions
>
<
chart:RadCartesianChart
x:Name
=
"theChart"
>
<
chart:RadCartesianChart.HorizontalAxis
>
<
chartView:CategoricalAxis
FontFamily
=
"Segoe UI"
FontSize
=
"12"
/>
</
chart:RadCartesianChart.HorizontalAxis
>
<
chart:RadCartesianChart.VerticalAxis
>
<
chartView:LinearAxis
FontFamily
=
"Segoe UI"
FontSize
=
"12"
Title
=
"The Chart"
Minimum
=
"0"
Maximum
=
"150"
/>
</
chart:RadCartesianChart.VerticalAxis
>
<
chart:RadCartesianChart.Grid
>
<
chartView:CartesianChartGrid
MajorLinesVisibility
=
"XY"
/>
</
chart:RadCartesianChart.Grid
>
</
chart:RadCartesianChart
>
<
StackPanel
Orientation
=
"Horizontal"
Grid.Row
=
"1"
>
<
TextBox
x:Name
=
"tb"
Height
=
"30"
Width
=
"100"
></
TextBox
>
<
Button
Content
=
"Click"
Click
=
"Button_Click"
Height
=
"30"
Width
=
"150"
></
Button
>
</
StackPanel
>
</
Grid
>
</
Window
>
private
void
AddSeries(
string
tag)
{
if
(GroupedDataGroups ==
null
)
GroupedDataGroups = GroupedData.Groups.Cast<GroupingImpl<
string
, LoadStatistic>>();
Style style;
DataTemplate template;
if
(theChart.Series.Count == 0)
{
style = FindResource(
"AEStyle"
)
as
Style;
template = FindResource(
"AETemplate"
)
as
DataTemplate;
}
else
if
(theChart.Series.Count == 1)
{
style = FindResource(
"STPStyle"
)
as
Style;
template = FindResource(
"STPTemplate"
)
as
DataTemplate;
}
else
{
style =
null
;
template =
null
;
}
var itemsSource = GroupedDataGroups.Where(x => x.Key.ToString() == tag).First().Items;
var series =
new
Telerik.Windows.Controls.ChartView.BarSeries
{
Tag = tag,
CombineMode = ChartSeriesCombineMode.Stack,
CategoryBinding =
new
PropertyNameDataPointBinding(
"PeriodEnding"
),
ValueBinding =
new
PropertyNameDataPointBinding(
"TradeCount"
),
ItemsSource = itemsSource,
//, DefaultVisualStyle = style
};
series.PointTemplates.Add(template);
theChart.Series.Add(series);
}
InitDataCell(...)
private
void
InsertDynamicTable(DynamicTableViewModel dynamicTableViewModel)
{
var table =
new
Table();
TableRow r1 =
new
TableRow();
r1.Cells.Add(
new
TableCell());
r1.Cells.Add(
new
TableCell());
r1.Cells.Add(
new
TableCell());
table.Rows.Add(r1);
TableRow r2 =
new
TableRow();
r2.Cells.Add(
new
TableCell());
r2.Cells.Add(
new
TableCell());
r2.Cells.Add(
new
TableCell());
table.Rows.Add(r2);
TableRow r3 =
new
TableRow();
r3.Cells.Add(
new
TableCell());
r3.Cells.Add(
new
TableCell());
r3.Cells.Add(
new
TableCell());
table.Rows.Add(r3);
table.Tag = dynamicTableViewModel.ID.ToString();
table.Borders =
new
TableBorders(
new
Border(dynamicTableViewModel.BorderThikness, BorderStyle.Single, dynamicTableViewModel.BorderColor));
table.PreferredWidth =
new
TableWidthUnit(TableWidthUnitType.Fixed, dynamicTableViewModel.Width);
table.LayoutMode = TableLayoutMode.Fixed;
TableRow dataRow = table.Rows.ToArray().ToList()[1];
List<TableCell> dataCells = dataRow.Cells.ToArray().ToList();
List<
double
> dataCellHeights =
new
List<
double
>();
for
(
int
i = 0; i < dynamicTableViewModel.DynamicColumns.Count; i++)
{
TableCell dataCell = dataCells[i];
InitHeaderCell(headerCell, dynamicTableViewModel.DynamicColumns[i]);
//Initialize existant TableCell
double
dataCellHeight = InitDataCell(dataCell, dynamicTableViewModel.DynamicColumns[i]);
dataCellHeights.Add(dataCellHeight);
}
UpdateRowHeight(dataRow, dataCellHeights);
this
.richEditor.InsertTable(table);
this
.richEditor.UpdateEditorLayout();
this
.richEditor.Document.UpdateAllFields();
this
.richEditor.Document.UpdateLayout();
}
private
double
InitDataCell(TableCell dataCell, DynamicColumnViewModel columnVm)
{
double
cellHeight = 0;
dataCell.PreferredWidth =
new
TableWidthUnit(TableWidthUnitType.Fixed, columnVm.Width);
dataCell.TextAlignment = RadTextAlignment.Left;
dataCell.VerticalAlignment = RadVerticalAlignment.Center;
var paragraph =
new
Paragraph();
paragraph.TextAlignment = RadTextAlignment.Right;
dataCell.Blocks.Add(paragraph);
dataCell.Background = columnVm.DynamicCellData.Background;
Grid grid =
new
Grid();
var tb =
new
TextBlock
{
Text = columnVm.DbColumnName,
HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
Tag = columnVm.DbColumnName,
FontSize = columnVm.DynamicCellData.FontSize,
Background =
new
SolidColorBrush(columnVm.DynamicCellData.Background),
Foreground =
new
SolidColorBrush(columnVm.DynamicCellData.Foreground),
FontFamily = columnVm.DynamicCellData.FontFamily,
FontWeight = columnVm.DynamicCellData.FontWeight,
FontStyle = columnVm.DynamicCellData.FontStyle,
TextDecorations = columnVm.DynamicCellData.TextDecoration
};
tb.VerticalAlignment = VerticalAlignment.Bottom;
tb.HorizontalAlignment = HorizontalAlignment.Right;
System.Windows.Controls.Border border =
new
System.Windows.Controls.Border();
border.BorderThickness =
new
Thickness(0);
border.BorderBrush = Brushes.Transparent;
border.Background =
new
SolidColorBrush(columnVm.DynamicCellData.Background);
border.VerticalAlignment = VerticalAlignment.Center;
border.HorizontalAlignment = HorizontalAlignment.Center;
border.Child = tb;
border.Measure(
new
Size(Double.PositiveInfinity, Double.PositiveInfinity));
Size s =
new
Size(border.DesiredSize.Width + 1, tb.DesiredSize.Height - 1);
var uic =
new
InlineUIContainer(border, s);
paragraph.Inlines.Add(uic);
cellHeight = uic.Height + 5;
return
cellHeight;
}