Skip to content

Commit

Permalink
Examples update
Browse files Browse the repository at this point in the history
  • Loading branch information
martinivanoff committed Aug 5, 2016
1 parent f1424f8 commit 543a834
Show file tree
Hide file tree
Showing 26 changed files with 166 additions and 64 deletions.
4 changes: 3 additions & 1 deletion BusyIndicator/RestoreFocus/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
##Restore Focus##
The example demonstrates how to restore the focus when the RadBusyIndicator is shown and then hidden for Silverlight and WPF.
The example demonstrates how to restore the focus when the RadBusyIndicator is shown and then hidden for Silverlight and WPF.

<keywords:hidden, shown, isbusy>
4 changes: 3 additions & 1 deletion DateTimePicker/AllowedDates/Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
##Allowed Dates##
This example demonstrates how to use the SelectableDateStart, SelectableDateEnd and BlackoutDates in order to create a selectable range of dates for Silverlight and WPF.

In the example only the current weekdays (Monday-Friday) are selectable.
In the example only the current weekdays (Monday-Friday) are selectable.

<keywords: SelectableDateStart, SelectableDateEnd, BlackoutDates, selectable, days, raddatetimepicker, raddatepicker>
4 changes: 3 additions & 1 deletion DateTimePicker/ClearButton/Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
##Clear Button##
This example demonstrates how to customize the Template of the RadDateTimePicker Style in order to add a 'Clear selection' button to it.
The example is available for both Silverlight and WPF.
The example is available for both Silverlight and WPF.

<keywords: datetimepicker, style, customize, template, selection>
4 changes: 3 additions & 1 deletion DateTimePicker/CustomHeaderTemplate/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
##Custom HeaderTemplate##
This example demonstrates how to customize the Header and HeaderTemplate of the RadTimePicker control in Silverlight and WPF.
This example demonstrates how to customize the Header and HeaderTemplate of the RadTimePicker control in Silverlight and WPF.

<keywords: datetimepicker, timepicker, header, cuztomize, radtimepicker>
4 changes: 3 additions & 1 deletion DateTimePicker/ReadonlyInputField/Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
##Readonly Input Field##
This example demonstrates how to make the input field of the DateTimePicker/DatePicker controls read-only while the drop down calendar
remains active for Silverlight and WPF.
remains active for Silverlight and WPF.

<keywords: datetimepicker, datepicker, calendar>
4 changes: 3 additions & 1 deletion DateTimePicker/RestrictTheEnteredDate/Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
##Restrict The Entered Date##
This example demonstrates how you can restrict the date that a user can type in the input field by implementing the ParseDateTimeValue event.
The example is available for Silverlight and WPF.
The example is available for Silverlight and WPF.

<keywords: datetimepicker, timepicker, ParseDateTimeValue>
4 changes: 3 additions & 1 deletion DateTimePicker/StringFormatMVVM/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
##String format in MVVM##
This example demonstrates how to set the Date/Time patterns using an attached behavior (i.e. in a MVVM-friendly manner).
This example demonstrates how to set the Date/Time patterns using an attached behavior (i.e. in a MVVM-friendly manner).

<keywords: attached, behavior, set, patterns>
4 changes: 3 additions & 1 deletion DateTimePicker/TimeIntervalsScrollViewer/Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
##Time Intervals Scroll Viewer##
This example demonstrates how to add a scrollbar to the time intervals portion of the control. When setting a small TimeInterval this
would help in not stretching the controls Tempalte for Silverlight and WPF.
would help in not stretching the controls Tempalte for Silverlight and WPF.

<keywords: scrollbar, datetimepicker, timepicker, TimeInterval, template, scrollviewer>
4 changes: 3 additions & 1 deletion DateTimePicker/TodayButton/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ IMPORTANT:

With the release of Telerik UI for WPF Q1 2016 there is a built-in functionality for adding a Today button inside RadDateTimePicker:
- For WPF here: http://docs.telerik.com/devtools/wpf/controls/raddatetimepicker/features/todaybutton
- For Silverlight here: http://docs.telerik.com/devtools/silverlight/controls/raddatetimepicker/features/todaybutton
- For Silverlight here: http://docs.telerik.com/devtools/silverlight/controls/raddatetimepicker/features/todaybutton

<keywords: customize, style, datetimepicker, datepicker>
2 changes: 2 additions & 0 deletions PdfProcessing/ExportUIElement/ExportUIElement_SL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
<Compile Include="PdfExport\ConcreteRenderers\PathRenderer.cs" />
<Compile Include="PdfExport\ConcreteRenderers\RectangleRenderer.cs" />
<Compile Include="PdfExport\ConcreteRenderers\TextBlockRenderer.cs" />
<Compile Include="PdfExport\ConcreteRenderers\TextBoxRenderer.cs" />
<Compile Include="PdfExport\ConcreteRenderers\TextRenderer.cs" />
<Compile Include="PdfExport\ConcreteRenderers\UIElementRendererBase.cs" />
<Compile Include="PdfExport\ExportHelper.cs" />
<Compile Include="PdfExport\Miscellaneous\CompositeDisposableObject.cs" />
Expand Down
4 changes: 3 additions & 1 deletion PdfProcessing/ExportUIElement/ExportUIElement_WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@
<DependentUpon>Example.xaml</DependentUpon>
</Compile>
<Compile Include="PdfExport\ConcreteRenderers\BorderRenderer.cs" />
<Compile Include="PdfExport\ConcreteRenderers\TextBoxRenderer.cs" />
<Compile Include="PdfExport\ConcreteRenderers\TextRenderer.cs" />
<Compile Include="PdfExport\ConcreteRenderers\EllipseRenderer.cs" />
<Compile Include="PdfExport\ConcreteRenderers\FrameworkElementRenderer.cs" />
<Compile Include="PdfExport\ConcreteRenderers\ImageRenderer.cs" />
Expand Down Expand Up @@ -151,4 +153,4 @@
<Resource Include="Readme.md" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Windows;
using System.Windows;
using System.Windows.Controls;
using Telerik.Windows.Documents.Fixed.Model.Editing;
using System.Windows.Media;

namespace ExportUIElement
{
Expand All @@ -15,49 +14,16 @@ internal override bool Render(UIElement element, PdfRenderContext context)
return false;
}

if (!string.IsNullOrEmpty(textBlock.Text))
{
using (context.drawingSurface.SaveProperties())
{
SetFill(context, textBlock.Foreground, textBlock.ActualWidth, textBlock.ActualHeight);
SetFontFamily(context.drawingSurface, textBlock.FontFamily);
context.drawingSurface.TextProperties.FontSize = textBlock.FontSize;

Block block = new Block();
block.TextProperties.CopyFrom(context.drawingSurface.TextProperties);
block.GraphicProperties.CopyFrom(context.drawingSurface.GraphicProperties);
string[] textLines = textBlock.Text.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
string text = textBlock.Text;
Brush foreground = textBlock.Foreground;
double width = textBlock.ActualWidth;
double height = textBlock.ActualHeight;
var fontFamily = textBlock.FontFamily;
double fontSize = textBlock.FontSize;

foreach (string textLine in textLines)
{
block.InsertText(textLine);
block.InsertLineBreak();
}

context.drawingSurface.DrawBlock(block);
}
}
TextRenderer.DrawTextBlock(text, context, foreground, width, height, fontFamily, fontSize);

return true;
}

private void SetFontFamily(Telerik.Windows.Documents.Fixed.Model.Editing.FixedContentEditor drawingSurface, System.Windows.Media.FontFamily fontFamily)
{
#if WPF
if (!drawingSurface.TextProperties.TrySetFont(fontFamily))
{
throw new System.Exception("Unable to set font. Consider embedding the font.");
}
#elif SILVERLIGHT
if (fontFamily.Source == "Times New Roman")
{
drawingSurface.TextProperties.Font = Telerik.Windows.Documents.Fixed.Model.Fonts.FontsRepository.TimesRoman;
}
else
{
throw new System.Exception("Unable to set font. Please see the RegisterAndExportPdfFonts sdk sample here https://github.com/telerik/xaml-sdk/tree/master/SpreadProcessing/RegisterAndExportPdfFonts");
}
#endif
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace ExportUIElement
{
internal class TextBoxRenderer : UIElementRendererBase
{
internal override bool Render(UIElement element, PdfRenderContext context)
{
TextBox textBox = element as TextBox;
if (textBox == null)
{
return false;
}

string text = textBox.Text;
Brush foreground = textBox.Foreground;
double width = textBox.ActualWidth;
double height = textBox.ActualHeight;
var fontFamily = textBox.FontFamily;
double fontSize = textBox.FontSize;

using (SaveClip(context.drawingSurface, new Rect(0, 0, textBox.ActualWidth, textBox.ActualHeight)))
{
TextRenderer.DrawTextBlock(text, context, foreground, width, height, fontFamily, fontSize);
}

return true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;
using System.Windows.Media;
using Telerik.Windows.Documents.Fixed.Model.Editing;

namespace ExportUIElement
{
internal static class TextRenderer
{
public static void DrawTextBlock(string text, PdfRenderContext context, Brush foreground, double width, double height, FontFamily fontFamily, double fontSize)
{
if (!string.IsNullOrEmpty(text))
{
using (context.drawingSurface.SaveProperties())
{
UIElementRendererBase.SetFill(context, foreground, width, height);
SetFontFamily(context.drawingSurface, fontFamily);
context.drawingSurface.TextProperties.FontSize = fontSize;

Block block = new Block();
block.TextProperties.CopyFrom(context.drawingSurface.TextProperties);
block.GraphicProperties.CopyFrom(context.drawingSurface.GraphicProperties);
string[] textLines = text.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);

foreach (string textLine in textLines)
{
block.InsertText(textLine);
block.InsertLineBreak();
}

context.drawingSurface.DrawBlock(block);
}
}
}

private static void SetFontFamily(Telerik.Windows.Documents.Fixed.Model.Editing.FixedContentEditor drawingSurface, System.Windows.Media.FontFamily fontFamily)
{
#if WPF
if (!drawingSurface.TextProperties.TrySetFont(fontFamily))
{
throw new System.Exception("Unable to set font. Consider embedding the font.");
}
#elif SILVERLIGHT
if (fontFamily.Source == "Times New Roman")
{
drawingSurface.TextProperties.Font = Telerik.Windows.Documents.Fixed.Model.Fonts.FontsRepository.TimesRoman;
}
else
{
throw new System.Exception("Unable to set font. Please see the RegisterAndExportPdfFonts sdk sample here https://github.com/telerik/xaml-sdk/tree/master/SpreadProcessing/RegisterAndExportPdfFonts");
}
#endif
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ internal static IDisposable SaveClip(FixedContentEditor drawingSurface, UIElemen
return null;
}

PathGeometry geometry = MathHelper.TransformRectangle(drawingSurface.Position.Matrix, rectangleClip.Rect);
return SaveClip(drawingSurface, rectangleClip.Rect);
}

internal static IDisposable SaveClip(FixedContentEditor drawingSurface, Rect rectangle)
{
PathGeometry geometry = MathHelper.TransformRectangle(drawingSurface.Position.Matrix, rectangle);
var pdfGeometry = PdfGeometryHelper.ConvertPathGeometry(geometry);

return drawingSurface.PushClipping(pdfGeometry);
}

Expand All @@ -48,6 +54,7 @@ internal static IDisposable SaveMatrixPosition(FixedContentEditor drawingSurface
matrix = MathHelper.Multiply(matrix, drawingSurface.Position.Matrix);
IDisposable savePosition = drawingSurface.SavePosition();
drawingSurface.Position = new Telerik.Windows.Documents.Fixed.Model.Data.MatrixPosition(matrix);

return savePosition;
}

Expand Down
1 change: 1 addition & 0 deletions PdfProcessing/ExportUIElement/PdfExport/ExportHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static void ExportToPdf(UIElement element, FixedContentEditor drawingSurf
private static void SetUp(PdfRenderer renderer)
{
renderer.AddRenderer(new PanelRenderer());
renderer.AddRenderer(new TextBoxRenderer());
renderer.AddRenderer(new TextBlockRenderer());
renderer.AddRenderer(new BorderRenderer());
renderer.AddRenderer(new RectangleRenderer());
Expand Down
4 changes: 3 additions & 1 deletion RadialMenu/BindingItemsSource/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
##Binding ItemsSource##
This example demonstrates how to bind a collection of custom objects to the ItemsSource property of RadRadialMenu.
This example demonstrates how to bind a collection of custom objects to the ItemsSource property of RadRadialMenu.

<keywords: collection, custom, objects, radialmenu>
4 changes: 3 additions & 1 deletion RadialMenu/CustomRadialButtonContent/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
##Customizing the center button##
This example demonstrates how to customize the ContentTemplate and BackContentTemplate of the RadialMenuButton.
This example demonstrates how to customize the ContentTemplate and BackContentTemplate of the RadialMenuButton.

<keywords: ContentTemplate, BackContentTemplate, RadialMenuButton, customize>
4 changes: 3 additions & 1 deletion RadialMenu/CustomTooltip/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
##Custom ToolTip##
This example demonstrates how to customize the ToolTipContent and MenuToolTipStyle of the RadRadialMenuItem.
This example demonstrates how to customize the ToolTipContent and MenuToolTipStyle of the RadRadialMenuItem.

<keywords: customize, ToolTipContent, MenuToolTipStyle, RadRadialMenuItem, radialmenu>
4 changes: 3 additions & 1 deletion RadialMenu/ItemCommands/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
##How to add Commands to RadRadialMenuItems##
This example demonstrates how to add commands to the RadRadialMenuItems to a RadRadialMenu and RadRadialContextMenu which manipulate an Image's RenderTransform.
This example demonstrates how to add commands to the RadRadialMenuItems to a RadRadialMenu and RadRadialContextMenu which manipulate an Image's RenderTransform.

<keywords: RadRadialMenu, RadRadialContextMenu, RenderTransform>
4 changes: 3 additions & 1 deletion RadialMenu/MenuQuickMode/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
##Quick mode RadialMenu##
This example demonstrates the expected behavior when the RadRadialMenu.EnableQuickMode is set to True. The default value of that static Boolean property is False. By design when the RadRadialMenu is being shown or closed its animation will be triggered. While that animation is being animated if a different animation is triggered it will not be executed and the initial animation will complete fully. When the EnableQuickMode is set to True that initial animation will be interrupted and the new one will be executed.
This example demonstrates the expected behavior when the RadRadialMenu.EnableQuickMode is set to True. The default value of that static Boolean property is False. By design when the RadRadialMenu is being shown or closed its animation will be triggered. While that animation is being animated if a different animation is triggered it will not be executed and the initial animation will complete fully. When the EnableQuickMode is set to True that initial animation will be interrupted and the new one will be executed.

<keywords: EnableQuickMode, animation>
4 changes: 3 additions & 1 deletion RadialMenu/OpenMenuOnShow/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
##Open RadialMenu on show##
This example demonstrates how to achieve a behavior where the RadRadialMenu is directly shown in its opened state rather than the default one.
This example demonstrates how to achieve a behavior where the RadRadialMenu is directly shown in its opened state rather than the default one.

<keywords: directly>
4 changes: 3 additions & 1 deletion RadialMenu/Positioning/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
##RadRadialMenu positioning##
This example demonstrates how to set the postion where the RadRadialMenu would be placed when used a ContextMenu.
This example demonstrates how to set the postion where the RadRadialMenu would be placed when used a ContextMenu.

<keywords: set, position, contextmenu>
4 changes: 3 additions & 1 deletion RadialMenu/ShowHideAsContextMenu/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
##Show/Hide as ContextMenu##
This example demonstrates how to set different events in order to show and hide the RadRadialMenu when it is used as ContextMenu of an element. The events could be set via the ShowEventName and HideEventName properties of the control or via KeyBinding.
This example demonstrates how to set different events in order to show and hide the RadRadialMenu when it is used as ContextMenu of an element. The events could be set via the ShowEventName and HideEventName properties of the control or via KeyBinding.

<keywords: radialmenu, events, ShowEventName, HideEventName, KeyBinding >
4 changes: 3 additions & 1 deletion RadialMenu/SimpleRadialMenu/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
##Declaring standalone RadRadialMenu##
This example demonstrates how to declare the RadRadialMenu as a standalone menu.
This example demonstrates how to declare the RadRadialMenu as a standalone menu.

<keywords: declare, menu >
4 changes: 3 additions & 1 deletion TimeSpanPicker/TimeSpanPickerAsCustomFilterEditor/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
##TimeSpanPicker as custom FilterEditor##
This example demonstrates how to easily use RadTimeSpanPicker as a filter editor in order to filter the rows of RadGridView.
This example demonstrates how to easily use RadTimeSpanPicker as a filter editor in order to filter the rows of RadGridView.

<keywords: filter, rows, gridview>

0 comments on commit 543a834

Please sign in to comment.