Telerik Forums
UI for WPF Forum
1 answer
272 views
01.HyperlinkRangeStart hyperlinkStart = new HyperlinkRangeStart();
02. HyperlinkRangeEnd hyperlinkEnd = new HyperlinkRangeEnd();
03. hyperlinkEnd.PairWithStart(hyperlinkStart);
04. HyperlinkInfo hyperlinkInfo = new HyperlinkInfo() { NavigateUri = hrefURL, Target = HyperlinkTargets.Blank };
05. hyperlinkStart.HyperlinkInfo = hyperlinkInfo;
06. 
07. ImageInline image = new ImageInline();
08. image.UriSource = new Uri(linkFormatter.FormatAllImageHyperlink(link));
09. image.Size = new Size(16, 16);
10.  
11. Telerik.Windows.Documents.Model.Paragraph activeParagraph = Document.CaretPosition.GetCurrentParagraphBox().AssociatedParagraph;
12. DocumentElementCollection docElemColl = new DocumentElementCollection(activeParagraph);
13. docElemColl.Add(hyperlinkStart);
14. docElemColl.Add(image);
15. docElemColl.Add(hyperlinkEnd);
16. radRichTextBox.InsertHyperlink(hyperlinkStart.HyperlinkInfo, new Telerik.Windows.Documents.Model.InlineCollection(docElemColl));
17. 
18. //activeParagraph.Inlines.Add(hyperlinkStart);
19. //activeParagraph.Inlines.Add(image);
20. //activeParagraph.Inlines.Add(hyperlinkEnd);
21. 
22. //Telerik.Windows.Documents.Model.Inline inline = Document.CaretPosition.GetCurrentInline();
23. //inline.Children.Add(hyperlinkStart);
24. //inline.Children.Add(image);
25. //inline.Children.Add(hyperlinkEnd);
Everything that I've tried results in a crash, with the exception being: Unable to cast object of type 'Telerik.Windows.Documents.Model.HyperlinkRangeEnd' to type 'Telerik.Windows.Documents.Model.Span'.  The two commented out sections were previous attempts at adding the hyperlinked image to the document at the current caret position.

Missing User
 answered on 26 Mar 2014
1 answer
127 views
I want to print two pages per sheet .Because I have one GridView and only three columns are available in the GridView. So remaining part of the page are unuseful.
so that I set  PrintDialog.PrintTicket.PagesPerSheet = 2 and PrintDialog.PrintQueue.DefaultPrintTicket.PagesPerSheet = 2. But its not working. And I am using following code for the Printing.


public static void Print(this GridViewDataControl source, bool showDialog, bool p_IsLandscape = true)
        {
            try
            {
                PrintDialog _PrintDialog = new PrintDialog();
                _PrintDialog.PrintQueue = LocalPrintServer.GetDefaultPrintQueue();
                _PrintDialog.PrintTicket = _PrintDialog.PrintQueue.DefaultPrintTicket;


                // Updated By Bharat Mendapara | Date : 11/03/2014
                //Reason SDPLAN-58 (DPA022 - Diagram Objects printing).
                if (p_IsLandscape)
                    _PrintDialog.PrintTicket.PageOrientation = PageOrientation.Landscape;
                else
                {
                    _PrintDialog.PrintTicket.PageOrientation = PageOrientation.Portrait;
                    _PrintDialog.PrintTicket.PagesPerSheet = 2;
                    _PrintDialog.PrintQueue.DefaultPrintTicket.PagesPerSheet = 2;
                }

                bool? dialogResult = showDialog ? _PrintDialog.ShowDialog() : true;

                if (dialogResult == true)
                {
                    DocumentViewer viewer = new DocumentViewer();
                    viewer.Document = ToFixedDocument(ToPrintFriendlyGrid(source), _PrintDialog);
                    _PrintDialog.PrintDocument(viewer.Document.DocumentPaginator, null);
                }
            }
            catch
            {
            }
        }


static FixedDocument ToFixedDocument(FrameworkElement element, PrintDialog dialog)
        {
            PrintCapabilities capabilities = dialog.PrintQueue.GetPrintCapabilities(dialog.PrintTicket);
            FixedDocument fixedDocument = new FixedDocument();

            element.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

            Size pageSize = new Size(element.DesiredSize.Width, dialog.PrintableAreaHeight);
            Size extentSize = new Size(element.DesiredSize.Width, capabilities.PageImageableArea.ExtentHeight);

            double totalHeight = element.DesiredSize.Height;
            double totalWidth = element.DesiredSize.Width;
            double yOffset = 0d;

            if (totalWidth < dialog.PrintableAreaWidth)
            {
                Size _Size = new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight);
                element.Arrange(new Rect(new Point(0, 0), _Size));
            }
            else
            {
                element.Arrange(new Rect(new Point(0, 0), element.DesiredSize));
            }

            while (yOffset < totalHeight)
            {
                VisualBrush brush = new VisualBrush(element);
                brush.Stretch = Stretch.None;
                brush.AlignmentX = AlignmentX.Left;
                brush.AlignmentY = AlignmentY.Top;
                brush.ViewboxUnits = BrushMappingMode.Absolute;
                brush.TileMode = TileMode.None;
                if (totalWidth < dialog.PrintableAreaWidth)
                    brush.Viewbox = new Rect(0, yOffset, dialog.PrintableAreaWidth, extentSize.Height);
                else
                    brush.Viewbox = new Rect(0, yOffset, extentSize.Width, extentSize.Height);

                PageContent pageContent = new PageContent();
                FixedPage page = new FixedPage();
                ((IAddChild)pageContent).AddChild(page);

                fixedDocument.Pages.Add(pageContent);

                if (totalWidth < dialog.PrintableAreaWidth)
                    page.Width = dialog.PrintableAreaWidth;
                else
                    page.Width = totalWidth;

                page.Height = pageSize.Height;

                Canvas canvas = new Canvas();
                FixedPage.SetLeft(canvas, capabilities.PageImageableArea.OriginWidth);
                FixedPage.SetTop(canvas, capabilities.PageImageableArea.OriginHeight);

                if (totalWidth < dialog.PrintableAreaWidth)
                    canvas.Width = dialog.PrintableAreaWidth;
                else
                    canvas.Width = extentSize.Width;

                canvas.Height = extentSize.Height;
                canvas.Background = brush;

                page.Children.Add(canvas);

                yOffset += extentSize.Height;
            }
            return fixedDocument;
        }

Can you help

Thaks
Dimitrina
Telerik team
 answered on 26 Mar 2014
8 answers
368 views
Hello,

I am trying to put a RadHeatMap into my RadMap. Is it possible to put a RadHeatMap in an information layer? Is that the best way to do it, or is there a better way? How would I put a RadHeatMap inside of my RadMap so that it moves and zooms as if it were part of the map? I don't want labels or anything fancy on my RadHeatMap. I'm just looking to put a very simple, square, grid-like heat map on my RadMap.

I have MapPinPoints in an information layer already and I would like to be able to tell which "cell" of my RadHeatMap each PinPoint is from. Is there any way to do this?

Thanks in advance,
Liam
Andrey
Telerik team
 answered on 26 Mar 2014
2 answers
875 views
Hello,

I'm working on an app which needs to list many items (kind of 50 000 sometimes) with a custom items template.
Everything is working fine while controlling with the mouse, but it's buggy with a touch screen. In order to be able to click on a button or a checkbox inside any of the items, you need to swipe somewhere on the main list before.

Here is a part of my code : (scj: controls are derived from telerik: controls with only one or two more properties)

my XAML :
<scj:scjListBox Visibility="Visible" Grid.Column="2" x:Name="lstItemsSmall" ItemsSource="{Binding Path=Modeles}" Style="{DynamicResource ModelesStyleSmall}" Background="#FF525252">
                <scj:scjListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <scj:scjVirtualizingWrapPanel ItemWidth="300" ItemHeight="300"></scj:scjVirtualizingWrapPanel>
                    </ItemsPanelTemplate>
                </scj:scjListBox.ItemsPanel>
            </scj:scjListBox>

resource file - style :
<Style TargetType="scj:scjListBox" x:Key="ModelesStyleSmall">
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="telerik:RadListBoxItem">
                    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                    <Setter Property="VerticalContentAlignment" Value="Stretch" />
                    <Setter Property="Background" Value="Transparent" />
                    <Setter Property="BorderBrush" Value="Transparent" />
                    <Setter Property="BorderThickness" Value="0" />
                    <Setter Property="Foreground" Value="White" />
                    <Setter Property="FontSize" Value="12" />
                    <Setter Property="Padding" Value="0" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="telerik:RadListBoxItem">
                                <Border CornerRadius="5" BorderBrush="#FF565656" BorderThickness="1" Margin="5" Padding="5" Background="#FF606060">
                                    <Grid>
                                        <ContentPresenter x:Name="HeaderElement" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0"
                                            ContentTemplate="{StaticResource ProduitsDataTemplateSmall}"/>
                                    </Grid>
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
    </Style>

resource file - data template :
<DataTemplate x:Key="ProduitsDataTemplateSmall">
        <scj:scjGrid Height="280" Width="280">
            <scj:scjGrid.RowDefinitions>
                <RowDefinition Height="200"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="50"></RowDefinition>
            </scj:scjGrid.RowDefinitions>
            <scj:scjGrid.ColumnDefinitions>
                <ColumnDefinition Width="1*"></ColumnDefinition>
                <ColumnDefinition Width="1*"></ColumnDefinition>
                <ColumnDefinition Width="1*"></ColumnDefinition>
            </scj:scjGrid.ColumnDefinitions>
            <Image Grid.Row="0" Grid.ColumnSpan="3" Source="{Binding Path=ImagePhoto}"></Image>
            <scj:scjTextBlock Grid.Row="1" Grid.ColumnSpan="3" NoTranslate="True" Text="{Binding Path=DisplayCodeName}" TextWrapping="Wrap" HorizontalAlignment="Left"></scj:scjTextBlock>
            <scj:scjButton Grid.Row="2" Grid.Column="0" NoTranslate="True" Style="{StaticResource ButtonStyle}" Click="btnPanier_Click" Tag="{Binding Path=sIdModele, Mode=OneWay}">
                <Image Source="Images/panier_ajout.png" Width="32" Height="32"></Image>
            </scj:scjButton>
            <scj:scjButton Grid.Row="2" Grid.Column="1" NoTranslate="True" Style="{StaticResource ButtonStyle}" Click="btnLoupe_Click" Tag="{Binding Path=sIdModele, Mode=OneWay}">
                <Image Source="Images/loupe.png" Height="32" Width="32"></Image>
            </scj:scjButton>
            <scj:scjCheckBox Grid.Row="2" Grid.Column="2" x:Name="chkStatut" NoTranslate="True" BorderBrush="Black" BorderThickness="0.3" Checked="chkStatut_Checked" Unchecked="chkStatut_Checked" HorizontalAlignment="Center" VerticalAlignment="Center">
                <scj:scjCheckBox.LayoutTransform>
                    <ScaleTransform ScaleX="3" ScaleY="3"></ScaleTransform>
                </scj:scjCheckBox.LayoutTransform>
            </scj:scjCheckBox>
        </scj:scjGrid>
    </DataTemplate>

I have tried on a :
-Win7 with mouse, everything is OK (smooth scrolling, clicking on the buttons, on the checkbox...)
-Win7 with touch, impossible to click on any button nor checkbox of an item (button gets focused but no event raised, checkbox get focused but not checked, but smooth scolling the list works fine)
-Win8 with touch, I need to swipe before clicking, or checking a box on an item (but smooth scolling works fine)

I haven't modified any touch behavior  at all. I need virtualization because of the number of items to load (from 15 to 50 000), and I need the control to act like an android app with touch smooth scrolling.

The screencapture shows the final window. Each light gray item contains a picture, 2 buttons and a checkbox.

My question is, is there a way to make it work with a touch screen, and how ?

Thank you for reading :)
Nicolas
Top achievements
Rank 1
 answered on 26 Mar 2014
1 answer
124 views
Hello sir/madam
I have tow questions. First, is there any solution to change duration of time interval? Now default value is half hour and I want to change it to 15 minuts.
Second question is : where can I find the place of date style?
if i want to use another type of .Net calender date where can I change it?
thank you for your attention
best regards, Mirzargar
Kalin
Telerik team
 answered on 26 Mar 2014
5 answers
295 views
Hello.

I need to implement a chart with vertical lines and labels, as I understand it can be implemented using annotations.
As I can see from examples, it should look lile this:
<telerik:RadCartesianChart.Annotations>
    <telerik:CartesianGridLineAnnotation Axis="{Binding ElementName=horizontalAxis}" Value="3000" Label="label1">
        <telerik:CartesianGridLineAnnotation.LabelDefinition>
            <telerik:ChartAnnotationLabelDefinition Location="Right" VerticalAlignment="Top" HorizontalOffset="4" DefaultVisualStyle="{StaticResource annotationLabelStyle}">
            </telerik:ChartAnnotationLabelDefinition>
        </telerik:CartesianGridLineAnnotation.LabelDefinition>
    </telerik:CartesianGridLineAnnotation>
    <telerik:CartesianGridLineAnnotation Axis="{Binding ElementName=horizontalAxis}" Value="3200" Label="label2">
        <telerik:CartesianGridLineAnnotation.LabelDefinition>
            <telerik:ChartAnnotationLabelDefinition Location="Right" VerticalAlignment="Top" HorizontalOffset="4" DefaultVisualStyle="{StaticResource annotationLabelStyle}">
            </telerik:ChartAnnotationLabelDefinition>
        </telerik:CartesianGridLineAnnotation.LabelDefinition>
    </telerik:CartesianGridLineAnnotation>
</telerik:RadCartesianChart.Annotations>

But information for annotations I get from ViewModel. And I don't see a way how to bind my collections from ViewModel to Annotations collection. Is it possible? I mean something like this:
<telerik:AnnotationSeries  ItemsSource="{Binding AnnotationsItems}" />

I found a workaround, to add annotations in a code-behind class of the view:
foreach (var item in ViewModel.AnnotationsItems)
{
    Chart1.Annotations.Add(new CartesianGridLineAnnotation { Label = item.Name, Value = item .Coordinate, Axis = Chart1.HorizontalAxis });
}
But seems it is not a true way.


Best regards,
Dimitr


Peshito
Telerik team
 answered on 26 Mar 2014
7 answers
539 views
I'm upgrading my telerik version, I need to find the index of the first visible row.  I used to do this:

this.ItemsControl.VirtualizingPanel.FirstVisibleChildIndex;

But this code no longer compiles, and I can't find an alternative.  Does this functionality still exists in the newer versions of the product?
Dimitrina
Telerik team
 answered on 26 Mar 2014
1 answer
173 views
Hi there, 
I need to place button into PropertyDefinition, and bind Command on click this button, which opening window,
How  can I do that?
Hristo
Telerik team
 answered on 26 Mar 2014
2 answers
303 views
Hi,

I'm trying to hide the top row (where the group button, sort button and search box are located).

I have set both the SearchBoxVisibility and SortAndGroupButtonsVisibility to false so all the above controls are hidden.

The result I have is an empty grey row with nothing inside it.

I want to hide that row and recover that real-estate for the grid itself.

I wasn't able to locate a property that does that and couldn't find an answer searching this forum (and google).

I would appreciate your help on this matter.

Thanks in advance.
Maor
Top achievements
Rank 1
 answered on 26 Mar 2014
4 answers
659 views
Hi,

I have an application in which we haven't defined width and height for the windows or controls, instead we used Auto and * mostly for control size. To make the screen design fluid and support multiple display sizes.

I am facing an issue in showing a horizontal scroll bar for my RadGridView which is placed inside panel with no width and height defined.  I have defined Auto and * as the Column's width in gridview. 

My requirement is that a scroll bar should appear when the content of the grid take more space than the space available on the screen. But currently the content is clipped and no scrollbar appears (see screenshot attached).

The code I am using is:

<Grid x:Name="LayoutRoot">
    <telerik:RadExpander IsExpanded="True">
        <DockPanel>
            <telerik:RadDataPager DockPanel.Dock="Bottom"/>
            <telerik:RadGridView x:Name="billDataGrid" AutoGenerateColumns="False">
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn Header="Ship To Bill To ID" Width="Auto" TextWrapping="Wrap" DataMemberBinding="{Binding BillToID}"/>
                    <telerik:GridViewDataColumn Header="Ship To ID" Width="Auto" TextWrapping="Wrap" DataMemberBinding="{Binding ShipToID}"/>
                    <telerik:GridViewDataColumn Header="Bill TO ID" Width="Auto" TextWrapping="Wrap" DataMemberBinding="{Binding ID}"/>
                    <telerik:GridViewDataColumn Header="Bill To Name" Width="Auto" TextWrapping="Wrap" DataMemberBinding="{Binding Name}"/>
                    <telerik:GridViewDataColumn Header="Bill To Address1" Width="Auto" TextWrapping="Wrap" DataMemberBinding="{Binding Address1}"/>
                    <telerik:GridViewDataColumn Header="Bill To Address2" Width="Auto" TextWrapping="Wrap" DataMemberBinding="{Binding Address2}"/>
                    <telerik:GridViewDataColumn Header="Bill To Address3" Width="Auto" TextWrapping="Wrap" DataMemberBinding="{Binding Address3}"/>
                    <telerik:GridViewDataColumn Header="Bill To Address4" Width="Auto" TextWrapping="Wrap" DataMemberBinding="{Binding Address4}"/>
                    <telerik:GridViewDataColumn Header="Bill To Address5" Width="Auto" TextWrapping="Wrap" DataMemberBinding="{Binding Address5}"/>
                    <telerik:GridViewDataColumn Header="Bill To Address6" Width="Auto" TextWrapping="Wrap" DataMemberBinding="{Binding Address6}"/>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
        </DockPanel>
    </telerik:RadExpander>
</Grid>


Please help me getting a scroll bar.
Thanks.
Dipti
Top achievements
Rank 1
 answered on 26 Mar 2014
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?