Telerik Forums
UI for WPF Forum
6 answers
493 views
I've written some code that insert a line break and pads the new line to a specified position along the document X axis.

I needed this code as you cannot insert new lines with indent properties. Only paragraphs can have indent properties.

So why not use a paragraph you say? Well, I needed to be able to wrap custom annotations around multiple lines which cannot be done with Paragraphs.

Main Method: When inserting into the document you will need to change the Style that I have used (see inside the while loop). My style just highlights the blank padding so I can visually see what's going on.
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());
        }
}


Method Call:
//Pass - reference to RadDocument - Location to pad line out to
RadDocumentExtensions.InsertLineBreakWithSpacing(radRichTextBox.Document,radRichTextBox.Document.CaretPosition.Location);

Here's my Span Style to highlight the new line padding as I previously mentioned:
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;
}

I hope this helps you.

Please let me know if you know of a better way to achieve this.

Thanks,

Rob


Robert
Top achievements
Rank 1
 answered on 24 May 2012
1 answer
93 views
Is it possible to read KML from a background thread?
We have some rather large KML files and want the UI to remain responsive while we load the data.

We have been using KmlReader.Read(), is there a background thread friendly alternative to this that we can use?
Andrey
Telerik team
 answered on 24 May 2012
2 answers
171 views
Hello, 

I have a scenario where I must hide the column headers using ShowColumnHeaders="False" . Once the headers are hidden, I cannot resize the columns anymore.

Is it possible to show the "double-arrow" between grid cells to allow resizing the grid even when headers are hidden? Any other suggestion?

Many thanks,

Simon
Simon
Top achievements
Rank 1
 answered on 24 May 2012
6 answers
200 views
The RadTreeView seems to move the focus rectangle to child nodes as you expand parent nodes, which is not desirable because in long trees it means that there is a lot of scrolling going on.  

The attached images show the problem.  I start with a single parent node that has the focus rectangle on it.  As I expand nodes, the focus rectangle gets shifted to the child nodes as they are shown.  I want the focus rectangle to stay with the original node so that there is no scrolling.

Chris
Top achievements
Rank 1
 answered on 24 May 2012
2 answers
88 views
Hi,

can someone give me a hint now to hide one of the time bars of the timeline control? The vertical space is very limited where I'm trying to use it, so it should not be higher than about 50 pixels.

Any help is appreciated.

Regards,
Mathias
Mathias
Top achievements
Rank 1
 answered on 24 May 2012
2 answers
128 views

VS 2010 Pro (ver 4.0.3019 SP1Rel) crashes when I add the attribute DocumentSource="" to the XAML.

My steps are as follows:
  1. Create new Telerik > Windows > C# RadControls WPF Application (>net 3.5 or 4.0)
  2. Choose Telerik.Windows.Controls.FixedDocumentViewers
  3. Auto-Selects Telerik.Windows.Controls
  4. Auto-Selects Telerik.Windows.Documents.Fixed
  5. Click Finish
  6. Add <telerik:RadPdfViewer HorizontalAlignment="Stretch" VerticalAlignment="Stretch"></telerik:RadPdfViewer> to Window XAML

Then, as step 7, as soon as I add the attribute DocumentSource="", the ide crashes and restarts.  It can simply be empty quotes or I can add a reference to a pdf added as a resource, it doesn't matter.  As soon as the second quotation mark is added and the designer tries to update, it crashes.

Hope you can help!!!

UPDATE:

If I try to assign the DocumentSource in the codebehind, I get the error:

Locating source for 'c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Documents\Fixed\FixedDocumentViewers\UI\RadPdfViewer.cs'. Checksum: MD5 {9 32 c2 2f 18 c8 80 10 92 4e 2 a0 df da f3 e2}
The file 'c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Documents\Fixed\FixedDocumentViewers\UI\RadPdfViewer.cs' does not exist.
Looking in script documents for 'c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Documents\Fixed\FixedDocumentViewers\UI\RadPdfViewer.cs'...
Looking in the projects for 'c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Documents\Fixed\FixedDocumentViewers\UI\RadPdfViewer.cs'.
The file was not found in a project.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\'...
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Documents\Fixed\FixedDocumentViewers\UI\RadPdfViewer.cs.
The debugger could not locate the source file 'c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Documents\Fixed\FixedDocumentViewers\UI\RadPdfViewer.cs'.


James
Top achievements
Rank 1
 answered on 24 May 2012
3 answers
381 views
Hi,
why are Telerik brushes in XAML-Code not froozen? Potential memory leak?
More here: http://blogs.msdn.com/b/jgoldb/archive/2008/02/04/finding-memory-leaks-in-wpf-based-applications.aspx 
Ioan
Top achievements
Rank 1
 answered on 24 May 2012
0 answers
76 views
Is there a limit of the radpanes that can be contained in a single container.?
Or in a RadPaneGroup ?
RR
Top achievements
Rank 1
 asked on 24 May 2012
3 answers
486 views
Hi,

I noticed an issue with GridView.

I bind 88 rows to a grid and when I maximise the window you get a black canvas and the grid overlayed by the same grid for a second or so before the grid resizes to the maximised window width.

I have attached a screenshot which shows this behaviour (the white areas were sensitive data cut, it's not a graphical issue).

The machine is a pretty new quad core 3Ghz machine with 8GB RAM and 512MB DDR2 ram graphic card running Win7 x64.

Visual Studio 2010 SP1, Rad Controls 20112.01.320.0. I tried with an older sample of RadGrid 2011.1.0419.40 and it had the same issue.

Is there a way to make the grid resize a little less clunky? am I missing something in the XAML?

Any feedback would be appreciated,

Thanks.

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"
        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>
N Mackay
Top achievements
Rank 1
 answered on 24 May 2012
7 answers
367 views
I have tried to set the SelectionRectangleStyle of the Diagram control without any luck.  Below is the code I am using. I can see it at design time, when I run the app and load a saved diagram it seems to ignore the style.  I am modifying one of the Telerik examples.

<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}" />          
    


Miro Miroslavov
Telerik team
 answered on 24 May 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?