Telerik Forums
UI for WPF Forum
1 answer
137 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

Dinko | Tech Support Engineer
Telerik team
 answered on 12 May 2021
4 answers
311 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
Iron
Iron
 answered on 12 May 2021
2 answers
235 views

Hello,

I am using the ContentTemplateSelector-Property of the RadPathButton, but nothing happens. Is there some trick to activate this feature?

My xaml:

        <utils:MessageDirectionTemplateSelector x:Key="messageDirectionTemplateSelector">
            <utils:MessageDirectionTemplateSelector.DecEditDataTemplate>
                <DataTemplate>
                    <ContentControl ContentTemplate="{StaticResource icon:outMessage}"/>
                </DataTemplate>
            </utils:MessageDirectionTemplateSelector.DecEditDataTemplate>
            <utils:MessageDirectionTemplateSelector.HexEditDataTemplate>
                <DataTemplate>
                    <ContentControl ContentTemplate="{StaticResource icon:inMessage}"/>
                </DataTemplate>
            </utils:MessageDirectionTemplateSelector.HexEditDataTemplate>
        </utils:MessageDirectionTemplateSelector>


<telerik:RadPathButton Content="{Binding DataContext, RelativeSource={RelativeSource Self}}"
                                       ContentPlacement="Right"
                                       ContentTemplateSelector="{StaticResource messageDirectionTemplateSelector}"/>

 

The Selector-Class:

public class MessageDirectionTemplateSelector : DataTemplateSelector { public override DataTemplate SelectTemplate(object item, DependencyObject container) { if (item is MessageItem) { return Properties.Settings.Default.CanIdHex ? HexEditDataTemplate : DecEditDataTemplate; } if (item is MessageSignalItem) { return Properties.Settings.Default.MuxValueHex ? HexEditDataTemplate : DecEditDataTemplate; } if (item is EnumValueItem) { return Properties.Settings.Default.EnumValueHex ? HexEditDataTemplate : DecEditDataTemplate; }

return null; }

public DataTemplate HexEditDataTemplate { get; set; } public DataTemplate DecEditDataTemplate { get; set; } }

regards,

Tobias

Peter
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 12 May 2021
0 answers
137 views

Hi,

Getting this exception sometimes and not able to reproduce it.  Could you give scenario  where this exception is possible? So that we can try to reproduce and fix. Attached screen has busy indicator in each tile .  We couldn't get any clue from stack trace.

Thanks in advance.

Uma
Top achievements
Rank 1
 asked on 11 May 2021
1 answer
204 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,

Martin
Telerik team
 answered on 11 May 2021
1 answer
148 views

Is it possible to connect the dots on the attached image?

I have a chart where the x-axis is time span and the y-axis is double.

On the x-axis I want to show every hour between the stating time span 0h 0 min to the ending time span 23h 59min.

So what I have done is to create a list with all y-axis datapoints and all steps of the x-axis.

Where there are no datapoints on the y-axis I set the double to NaN.

So what I want is to draw a line between the values that are not set to NaN. Or ofcourse if there is another way to resolve this.

 


Items = new List<CurveItPlotInfo>(); for (int i = 0; i < 23; i++) { if (vats.Any(x => x.Time.Hours == i)) { foreach (var item in vats.Where(x => x.Time.Hours == i)) { Items.Add(new CurveItPlotInfo { TimeSpanValue = item.Time, Value = ConvertToDouble(item.Value), }); } } else if (i == 23) { Items.Add(new CurveItPlotInfo { TimeSpanValue = TimeSpan.FromMinutes(1439), Value = Double.NaN, }); } else { Items.Add(new CurveItPlotInfo { TimeSpanValue = TimeSpan.FromHours(i), Value = Double.NaN, }); ; } }

 

public class CurveItPlotInfo : ViewModelBase
    {

        private double value;
        private TimeSpan timeSpanValue;

        public double Value
        {
            get { return value; }
            set { SetProperty(ref this.value, value); }
        }

        public TimeSpan TimeSpanValue { get => timeSpanValue; set { SetProperty(ref timeSpanValue, value); } }

    }

 


<telerik:RadCartesianChart x:Name="CurveItChart" 
                                   Loaded="CurveIt_Loaded"
                                   Grid.Row="0">
            
            <telerik:RadCartesianChart.SmartLabelsStrategy>
                <telerik:ChartSmartLabelsStrategy />
            </telerik:RadCartesianChart.SmartLabelsStrategy>
            
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis x:Name="verticalAxis" Minimum="{Binding MinValue}" Maximum="{Binding MaxValue}" />
            </telerik:RadCartesianChart.VerticalAxis>
            
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:DateTimeCategoricalAxis x:Name="datetimeAxis" 
                                                 SmartLabelsMode="SmartStep"
                                                 MajorTickLength="15"
                                                 PlotMode="OnTicksPadded">
                    <telerik:DateTimeCategoricalAxis.LabelTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Converter={converters:TimeSpanFormatConverter}}" />
                        </DataTemplate>
                    </telerik:DateTimeCategoricalAxis.LabelTemplate>
                </telerik:DateTimeCategoricalAxis>
            </telerik:RadCartesianChart.HorizontalAxis>
            
            <telerik:RadCartesianChart.Series>
                <telerik:LineSeries ValueBinding="Value" CategoryBinding="TimeSpanValue" ItemsSource="{Binding Items}">

                    <telerik:LineSeries.PointTemplate>
                        <DataTemplate>
                            <Border BorderBrush="AliceBlue" BorderThickness="1" >
                                <Rectangle Width="15" Height="15" Fill="Black"
                                           MouseLeftButtonDown="Rectangle_MouseLeftButtonDown" />
                            </Border>
                        </DataTemplate>
                    </telerik:LineSeries.PointTemplate>

                </telerik:LineSeries>
                
            </telerik:RadCartesianChart.Series>
            
        </telerik:RadCartesianChart>

Fredrik
Top achievements
Rank 1
Veteran
Iron
 answered on 11 May 2021
1 answer
163 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

Vladimir Stoyanov
Telerik team
 answered on 11 May 2021
2 answers
166 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
1.4K+ 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 5
Bronze
Bronze
Bronze
 answered on 07 May 2021
2 answers
726 views

Dear Team,

In old times i used this code to have a custom sort on a datagridview:

    Private Sub DG_RM_SortCompare(sender As Object, e As DataGridViewSortCompareEventArgs) Handles DG_RM.SortCompare
        '''' <summary>Gets or sets a value indicating the order in which the compared cells will be sorted.</summary>
        '''' <returns>Less than zero if the first cell will be sorted before the second cell; zero if the first cell and second cell have equivalent values; greater than zero if the second cell will be sorted before the first cell.</returns>
        If e.Column.Index > 2 Then
            Try
                If e.CellValue1 Is Nothing OrElse e.CellValue1.Equals(DBNull.Value) Then
                    If e.CellValue2 Is Nothing OrElse e.CellValue2.Equals(DBNull.Value) Then
                        e.SortResult = 0
                    Else
                        e.SortResult = 1
                    End If
                Else
                    If e.CellValue2 Is Nothing OrElse e.CellValue2.Equals(DBNull.Value) Then
                        e.SortResult = -1
                    Else
                        e.SortResult = DirectCast(e.CellValue1, IComparable).CompareTo(DirectCast(e.CellValue2, IComparable))
                    End If
                End If
                e.Handled = True

            Catch ex As Exception
                MsgBox(Err.Description)
                Close()
            End Try
        End If
    End Sub

Now i need to achieve the same in WPF radgridview.. I have columns, with positive integers, zeroes and NULLs too.

Basically if i order : NULLs come first , then zeroes, then numbers ASC.

In my case customer needs to see in this way: zeroes, positive numbers asc, and nulls at the end.

The datasource is a datatable passed to radgridview as itemsource, and the column names (and number of them) are always dynamic, so i cannot predefine them in the XAML section. Please help

Thanks!

Peter B. (Hungary)

 

Peter
Top achievements
Rank 1
Iron
Iron
 answered on 06 May 2021
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
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?