or
public
static
void
InsertLineBreakWithSpacing(
this
RadDocument document, PointF positionSpacing)
{
//Insert line break at caret position
document.InsertLineBreak();
//Insert line spaces for padding until position is found
while
(positionSpacing.X > document.CaretPosition.Location.X)
{
document.Insert(
" "
, RadDocumentStyles.LineBreakSpacing());
}
}
//Pass - reference to RadDocument - Location to pad line out to
RadDocumentExtensions.InsertLineBreakWithSpacing(radRichTextBox.Document,radRichTextBox.Document.CaretPosition.Location);
public
static
StyleDefinition LineBreakSpacing()
{
StyleDefinition lineBreak =
new
StyleDefinition();
lineBreak.Type = StyleType.Character;
lineBreak.SpanProperties.HighlightColor = Colors.LightGreen;
lineBreak.DisplayName =
"lineBreakSpacing"
;
lineBreak.Name =
"lineBreakSpacing"
;
return
lineBreak;
}
private
void
Window_Loaded(
object
sender, RoutedEventArgs e)
{
// Instantiate the DataServiceContext.
_context =
new
Vessel.Service.VesselService(_svcUri);
}
private
void
button_getvesselTypes_Click(
object
sender, RoutedEventArgs e)
{
try
{
StartStats();
var VTQuery = from v
in
_context.Vestype
select v;
DataServiceCollection<VestypeEntity> VesselTypes =
new
DataServiceCollection<VestypeEntity>(VTQuery);
this
._radgrid_output.DataContext = VesselTypes;
ShowStats();
}
catch
(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
<
Window
x:Class
=
"TestClient.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"WCF oData Test"
Width
=
"750"
Height
=
"600"
x:Name
=
"OutputWindow"
Loaded
=
"Window_Loaded"
>
<
Grid
x:Name
=
"grid_mainlayout"
>
<
Grid.RowDefinitions
>
<
RowDefinition
x:Name
=
"gridrow_detailsection"
Height
=
"*"
></
RowDefinition
>
<
RowDefinition
x:Name
=
"gridrow_footersection"
Height
=
"60"
></
RowDefinition
>
</
Grid.RowDefinitions
>
<
telerik:RadGridView
Name
=
"_radgrid_output"
Grid.Row
=
"0"
Margin
=
"2"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
DataContext
=
"{Binding}"
ItemsSource
=
"{Binding}"
EnableColumnVirtualization
=
"True"
EnableRowVirtualization
=
"True"
DataLoadMode
=
"Asynchronous"
IsReadOnly
=
"True"
ActionOnLostFocus
=
"None"
/>
<
StackPanel
x:Name
=
"stackpannel_buttons"
Grid.Row
=
"1"
Orientation
=
"Horizontal"
>
<
Button
x:Name
=
"button_Query1"
Margin
=
"2,10,10,10"
Width
=
"100"
Content
=
"Get 6000 rows"
Click
=
"button_getvessels_Click"
></
Button
>
<
Button
x:Name
=
"button_Query2"
Margin
=
"2,10,10,10"
Width
=
"100"
Content
=
"Get 80 rows"
Click
=
"button_getvesselTypes_Click"
></
Button
>
</
StackPanel
>
</
Grid
>
</
Window
>
<
UserControl.Resources
>
<
Style
x:Key
=
"Style1"
TargetType
=
"{x:Type Rectangle}"
>
<
Setter
Property
=
"StrokeThickness"
Value
=
"12"
/>
<
Setter
Property
=
"StrokeDashArray"
Value
=
"3 3"
/>
<
Setter
Property
=
"Stroke"
Value
=
"Red"
/>
<
Setter
Property
=
"Fill"
Value
=
"Transparent"
/>
</
Style
>
</
UserControl.Resources
>
<
telerik:RadDiagram
x:Name
=
"diagram"
SelectionRectangleStyle
=
"{DynamicResource Style1}"
/>