Telerik Forums
UI for WPF Forum
133 answers
920 views

RadCalendar:

RadDiagram:

  • Create custom shapes in the RadDiagram with MVVM - The forum thread elaborates on how to create custom shapes in the RadDiagram following an MVVM approach.
  • Populate the RadDiagramToolbox with custom business data - In this forum thread you can find a sample solution and guidelines on how to populate the RadDiagramToolbox with custom business data and based on the data type drop different objects on the diagramming surface. The attached solution also demonstrates an approach for providing custom information in a SettingsPane tab.
RadGridView:
  • Unfocused state for the selected GridViewRow - With Q2 2012 we have introduced a new Unfocused state for the selected GridViewRow. It will be shown when the GridView is out of focus. If you want to revert to the previous behavior you can check this help article.
RadPivotGrid: RadRichTextBox:
  • Guidelines for Printing with RadDocument - As RadDocument is sometimes used independently of RadRichTextBox to layout content and export it, this article explains the basics of creating a document programmatically.
Dinko
Telerik team
 answered on 23 Feb 2018
0 answers
2 views

Hello,

 

I have a Word document in docx format and mail merge with Excel in xls format.

The following are mergefields that rendered properly in Word but not when I do mail merge in my code.

{ MERGEFIELD TODAY \@ “MM/dd/yy” }

{ MERGEFIELD BAL \# ####,0.00 }

The following code:


                    using (Stream stream = new FileStream(docxPath +docxFilename, FileMode.Open))
                    {
                        stream.Seek(0, SeekOrigin.Begin);
                        byte[] bytes = new byte[stream.Length];
                        stream.Read(bytes, 0, bytes.Length);

                        templateDocument = new DocxFormatProvider().Import(bytes);
                        IEnumerable mailMergeSource = this.GetMailMergeDataSource(worksheet);
                        mergeDocument = templateDocument.MailMerge(mailMergeSource);
                        this.SaveFile(mergeDocument);
                    }

Above is the main code that do mailmerge

The GetMailMergeDataSource is give below:


        private IEnumerable GetMailMergeDataSource(Worksheet worksheet)
        {
            List<DynamicDataObject> mailMergeSource = new List<DynamicDataObject>();
            string[] fieldNames = new string[worksheet.UsedCellRange.ColumnCount];
            int columnCount;
            int rowCount;
            CellSelection selection;

            for (columnCount = 0; columnCount < worksheet.UsedCellRange.ColumnCount; columnCount++)
            {
                selection = worksheet.Cells[0, columnCount];
                fieldNames[columnCount] = selection.GetValue().Value.RawValue.ToString();
            }

            for (rowCount = 1; rowCount < worksheet.UsedCellRange.RowCount; rowCount++)
            { 
                DynamicDataObject data = new DynamicDataObject();
                for (columnCount = 0; columnCount < worksheet.UsedCellRange.ColumnCount; columnCount++)
                {
                    selection = worksheet.Cells[rowCount, columnCount];
                    data.Set(fieldNames[columnCount], selection.GetValue().Value.RawValue);
                }

                if (columnCount > 0)
                    mailMergeSource.Add(data);
            }

            return mailMergeSource;
        }

DynamicDataaObject is derived from Telerik own's sample document-processing-sdk-master > WordsProcessing

the SaveFile is below:


        private void SaveFile(RadFlowDocument document)
        {
            using (Stream stream = File.OpenWrite(newDocxPath + newDocxFilename))
            {
                DocxFormatProvider formatProvider = new DocxFormatProvider();

                DocxExportSettings exportSettings = new DocxExportSettings
                {
                    AutoUpdateFields = true,
                    InvalidDocumentAction = InvalidDocumentAction.ThrowException
                };
                formatProvider.ExportSettings = exportSettings;
                formatProvider.Export(document, stream);

            }


        }

It works. It merged into another docx document but the Merge Field format failed.  But to do the same with Word merge, the resulting file shows proper format.

Let me know if you need full working sample that demo the problem.

 

Thank,

Coopbase
Top achievements
Rank 1
 asked on 09 May 2021
0 answers
2 views

Hi,

I have a scatter point series with chart track ball enabled and SnapMode set to ClosestPoint, but with multiple series added to the chart I see a point per series.

 

Each colour in above image is a separate series added from code. The chart itself is in XAML.


                    <telerik:RadCartesianChart Grid.Row="0"   BorderBrush="Transparent" Background="White"  x:Name="radChartView" HorizontalAlignment="Stretch" VerticalContentAlignment="Stretch" DockPanel.Dock="Top">
                        <telerik:RadCartesianChart.Behaviors>
                            <telerik:ChartTrackBallBehavior ShowIntersectionPoints="True" ShowTrackInfo="False" SnapMode="ClosestPoint" />
                        </telerik:RadCartesianChart.Behaviors>
                        <telerik:RadCartesianChart.TrackBallLineStyle>
                            <Style TargetType="Polyline">
                                <Setter Property="Visibility" Value="Collapsed" />
                            </Style>
                        </telerik:RadCartesianChart.TrackBallLineStyle>

                    </telerik:RadCartesianChart>

 

I've only seen examples of SnapMode=ClosestPoint on LineSeries plots. Should this work on ScatterPointSeries?

Thanks,

Neil

Neil
Top achievements
Rank 1
 asked on 09 May 2021
0 answers
3 views

I've used telerik rad diagram for creating a kind of blue-print system (flow system). In this flow-system we have a lot of nodes and connections. Is it possible to show connections like this?

 

At the moment it looks like this:

I've tried to work with the bezier-connection-type, but that didn't work as expected:

Thanks a lot!

Benedikt
Top achievements
Rank 1
 asked on 09 May 2021
0 answers
2 views

Hey. Is there anyway that I can deploy the application without ClickOnce or any Installation but just copy the compiled file to the client machine?

Our company has very complicated and tedious IT process. The best one to deploy the project is just to copy the app to the client machine and run it.

BTW, it is .net core 3.1 WPF APP.

gary
Top achievements
Rank 1
 updated question on 09 May 2021
2 answers
6 views

Hi,

I have a step line chart with the trackball enabled. The ChartTrackBallBehavior is like this.

<telerik:ChartTrackBallBehavior ShowIntersectionPoints="True" ShowTrackInfo="True" SnapMode="None" SnapSinglePointPerSeries="True"/>

 

My problem is that the closest point can be on the left or on the right of the trackball line. I need the closest point to be always the one on the left. Is there a way to change the default behavior so that I can programmatically set the closest point when trackball line moves? I have attached an image to better explain my problem.

 

 

Stefano
Top achievements
Rank 1
Iron
 answered on 07 May 2021
2 answers
5 views

Hello,

If we follow the WPF good practices, the `OnLostFocus` method must be called when the control loses focus and it's the job of this method to raise the `LostFocus` event.

In the case of the AutoCompleteBox, the event is raised, but the method is not called. So it's not possible to do some work before the event is raised.

Patrick
Top achievements
Rank 2
Iron
 answered on 07 May 2021
2 answers
8 views

 

Hello,

I have a problem to get the SelectedItems from my radcombobox. I have created an attached property "SelectedItemsHelper" to use the "SelectedItems" property. As a template for the attached property, I 've used this blog post.

My SelectedItemsHelper

using System.Collections;
using System.Windows;
using Telerik.Windows.Controls;

namespace WpfAutoQuery
{
    public class SelectedItemsHelper
    {
        
        public static readonly DependencyProperty SelectedItemsProperty =
            DependencyProperty.RegisterAttached("SelectedItems", typeof(IList), typeof(SelectedItemsHelper), new FrameworkPropertyMetadata((IList)null, new PropertyChangedCallback(OnSelectedItemsChanged)));
              
        public static IList GetSelectedItems(DependencyObject d)
        {
            return (IList)d.GetValue(SelectedItemsProperty);
        }

        public static void SetSelectedItems(DependencyObject d, IList value)
        {
            d.SetValue(SelectedItemsProperty, value);
        }

        private static void OnSelectedItemsChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var comboBox = sender as RadComboBox;
            if (comboBox != null)
            {                
                IList selectedItems = GetSelectedItems(comboBox);
                if(selectedItems != null)
                {
                    comboBox.SelectedItems.Clear();
                    foreach (var item in selectedItems)
                    {
                        comboBox.SelectedItems.Add(item);
                    }
                }
            }                               
        }
    }
}

My RadComboBox:

<telerik:RadComboBox Name="rcbSection" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="2" Margin="10" IsEditable="False"
                                       ItemsSource="{Binding Sections}" DisplayMemberPath="Line1" AllowMultipleSelection="True"  
                                       local:SelectedItemsHelper.SelectedItems="{Binding SelectedSections}">                                              
</telerik:RadComboBox>

My "SelectedSections" property in ViewModel

public ObservableCollection<Section> SelectedSections
            {
                get { return GetPropertyValue<ObservableCollection<Section>>(); }
                set { SetPropertyValue(value); }
            }

I have added a jpg, where you can see that i dont get my selected values... Does someone can help me? I dont know what i do wrong...

 

Vladimir Stoyanov
Telerik team
 answered on 07 May 2021
3 answers
13 views

Hello.

 

When we debug or Run the application it works fine but in output window so many lines are coming with warning 

 

 

 

System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='AlternativeBrush'; ResourceKey.HashCode='18573990'; ResourceKey.Type='Telerik.Windows.Controls.FluentResourceKey'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='AlternativeBrush'; ResourceKey.HashCode='18573990'; ResourceKey.Type='Telerik.Windows.Controls.FluentResourceKey'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='BasicBrush'; ResourceKey.HashCode='1723761'; ResourceKey.Type='Telerik.Windows.Controls.FluentResourceKey'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='MarkerBrush'; ResourceKey.HashCode='35310062'; ResourceKey.Type='Telerik.Windows.Controls.FluentResourceKey'

 

When an item is clicked on the parent grid view, the child grid view list is displayed.

Style is not used anywhere. This warning occurs at this time.

 

Implicit noxaml is in use and is version 2021.1.419.45. (Theme :Fluent)

 

 

Thanks.

Psyduck
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 07 May 2021
0 answers
3 views

I have recently been developing a radtreeview and needed the facility to only drop inside a folder, therefore eliminating the requirement for drop before and after. The link above resolved this issue, thank you, though I can still see the graphical orange indicator (line with circle) which is associated with the drop position.

Is it possible to disable this indicator as well?

As an aside issue, it appears that I get highlighted textblocks remaining behind after moving nodes around see the attached image. Do you have advice as to what could cause this?

tree-image

Matthew
Top achievements
Rank 1
 asked on 06 May 2021