Telerik Forums
UI for WPF Forum
3 answers
288 views

Hi to all,

I have a serious problem, after apply theme, I can't run project.

I received this error.

More information: 'An exception was thrown when the specification of a value of' System.Windows.Markup.StaticResourceHolder '.' line number '47' and row position '33'.

I tryed to remove all data about theme, nothing.

How can I get out to this problem?

Dario Concilio
Top achievements
Rank 2
 answered on 12 Sep 2016
3 answers
145 views

In Microsoft Word and other text editors there is a ability which stretches the text horizontally. How should I do so in RadRichTextBox in WPF Apps.

Thanks

Boyko
Telerik team
 answered on 12 Sep 2016
3 answers
397 views

Hello. I try to set the scale of RadCartesianChart.LinearAxis and I can't. How I try to do it, please see the following. Below is XAML of the RadCartesianChart:

<!--Sound velocity [meter/second] chart for each ultrasonic beam.-->
<telerik:RadCartesianChart Visibility="{Binding IsAbsoluteSplineChartVisible}">
    <telerik:RadCartesianChart.HorizontalAxis>
        <telerik:DateTimeContinuousAxis MajorStepUnit="Second" LabelInterval="5" LabelFormat="hh:mm:ss" FontFamily="Segoe UI" PlotMode="OnTicks" TickOrigin="{Binding AlignmentDate}"/>
    </telerik:RadCartesianChart.HorizontalAxis>
    <telerik:RadCartesianChart.VerticalAxis>
       <telerik:LinearAxis FontFamily="Segoe UI" Title="Meters per second [m/s]" Minimum="{Binding ChartMinimum}" Maximum="{Binding ChartMaximum}"/>
    </telerik:RadCartesianChart.VerticalAxis>
    <!--Provider for each series-->
    <telerik:RadCartesianChart.SeriesProvider>
       <telerik:ChartSeriesProvider Source="{Binding SeriesData}">
          <telerik:ChartSeriesProvider.SeriesDescriptors>
             <telerik:CategoricalSeriesDescriptor CategoryPath="Category" ValuePath="Value" ItemsSourcePath="ChartPoints">
                 <telerik:CategoricalSeriesDescriptor.TypeConverter>
                     <local:SeriesTypeConverter/>
                 </telerik:CategoricalSeriesDescriptor.TypeConverter>
             </telerik:CategoricalSeriesDescriptor>
          </telerik:ChartSeriesProvider.SeriesDescriptors>
       </telerik:ChartSeriesProvider>
    </telerik:RadCartesianChart.SeriesProvider>
    <!--Zooming and Panning-->
    <telerik:RadCartesianChart.Behaviors>
       <telerik:ChartPanAndZoomBehavior ZoomMode="Vertical"  PanMode="Vertical"/>
    </telerik:RadCartesianChart.Behaviors>
</telerik:RadCartesianChart>

Below is handler of ticks of sound velocity values polling timer.

private void Timer_Tick(object sender, EventArgs e)
{
    // Сharts filling:
    // get minimal value of sound velocity,
    double min_1_2 = Math.Min(GlobalStaticMembers.FirstBeamSoundVelocity, GlobalStaticMembers.SecondBeamSoundVelocity);
    double min_3_4 = Math.Min(GlobalStaticMembers.ThirdBeamSoundVelocity, GlobalStaticMembers.FourthBeamSoundVelocity);
    this.ChartMinimum = Math.Floor(Math.Min(min_1_2, min_3_4));
    // get maximal value of sound velocity,
    double max_1_2 = Math.Max(GlobalStaticMembers.FirstBeamSoundVelocity, GlobalStaticMembers.SecondBeamSoundVelocity);
    double max_3_4 = Math.Max(GlobalStaticMembers.ThirdBeamSoundVelocity, GlobalStaticMembers.FourthBeamSoundVelocity);
    this.ChartMaximum = Math.Ceiling(Math.Max(max_1_2, max_3_4));
    // adjust the value of the time on X-axis,
    this._currentDate = this._currentDate.AddMilliseconds(TIMER_INTERVAL);
    this.SeriesData.SuspendNotifications();
    // get the first beam chart new point where newPoint.Value is sound velocity itself,
    ChartPoint newPoint = new ChartPoint();
    newPoint.Value = GlobalStaticMembers.FirstBeamSoundVelocity;
    newPoint.Category = this._currentDate;
    if (this.SeriesData[0].ChartPoints.Count > 50)
        this.SeriesData[0].ChartPoints.RemoveAt(0);
    this.SeriesData[0].ChartPoints.Add(newPoint);
    // get the second beam chart new point where newPoint.Value is sound velocity itself,
    newPoint = new ChartPoint();
    newPoint.Value = GlobalStaticMembers.SecondBeamSoundVelocity;
    newPoint.Category = this._currentDate;
    if (this.SeriesData[1].ChartPoints.Count > 50)
        this.SeriesData[1].ChartPoints.RemoveAt(0);
    this.SeriesData[1].ChartPoints.Add(newPoint);
    // get the third beam chart new point where newPoint.Value is sound velocity itself,
    newPoint = new ChartPoint();
    newPoint.Value = GlobalStaticMembers.ThirdBeamSoundVelocity;
    newPoint.Category = this._currentDate;
    if (this.SeriesData[2].ChartPoints.Count > 50)
        this.SeriesData[2].ChartPoints.RemoveAt(0);
    this.SeriesData[2].ChartPoints.Add(newPoint);
    // get the fourth beam chart new point where newPoint.Value is sound velocity itself.
    newPoint = new ChartPoint();
    newPoint.Value = GlobalStaticMembers.FourthBeamSoundVelocity;
    newPoint.Category = this._currentDate;
    this.SeriesData[3].ChartPoints.Add(newPoint);
    if (this.SeriesData[3].ChartPoints.Count > 50)
        this.SeriesData[3].ChartPoints.RemoveAt(0);
    this.SeriesData.ResumeNotifications();
}

Below is ChartMinimum and ChartMaximum properties definitions:

public double ChartMinimum
{
   get { return this._chartMinimum; }
   set { this.SetProperty(ref this._chartMinimum, value); }
}
 
public double ChartMaximum
{
   get { return this._chartMaximum; }
   set { this.SetProperty(ref this._chartMaximum, value); }
}

Below is ChartPoint class definition:

/// <summary>
/// Point for spline series.
/// </summary>
public class ChartPoint
{
    private double _value;
    private DateTime _category;
    public ChartPoint() { }
    public ChartPoint(DateTime category, double value)
    {
        this.Category = category;
        this.Value = value;
    }
    public double Value
    {
        get { return this._value; }
        set { this._value = value; }
    }
    public DateTime Category
    {
        get { return this._category; }
        set { this._category = value; }
    }
}

Below is the collection containing all series. This collection is used as datasource for telerik:ChartSeriesProvider.

/// <summary>
/// Gets or sets the collection containing series.
/// </summary>
public RadObservableCollection<SeriesModel> SeriesData { get; set; }

And below is SeriesModel class definition:

/// <summary>
/// The model of series (chart's curve).
/// </summary>
public class SeriesModel
{
    #region Constructors
    public SeriesModel() { }
    public SeriesModel(RadObservableCollection<ChartPoint> chartPoints, string seriesType = "Spline")
    {
        this.ChartPoints = chartPoints;
        this.SeriesType = seriesType;
    }
    #endregion
 
    #region Properties
 
    /// <summary>
    /// Series type
    /// </summary>
    public string SeriesType { get; set; }
    /// <summary>
    /// Series points collection.
    /// </summary>
    public RadObservableCollection<ChartPoint> ChartPoints { get; set; }
 
    #endregion
}

I also show you the converter definition:

/// <summary>
/// Series type converter.
/// </summary>
public class SeriesTypeConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        SeriesModel seriesItem = value as SeriesModel;
 
        if (seriesItem.SeriesType == "Spline")
        {
            return typeof(SplineSeries);
        }
        else if (seriesItem.SeriesType == "Line")
        {
            return typeof(LineSeries);
        }
        else
        {
            return typeof(BarSeries);
        }
    }
 
    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        /*throw new NotImplementedException()*/return null;
    }
}

As you know, the value of sound is hundreds of meters per second. Say, for example, 345.55 meters per second (I especially take the value with  hundredths of a meter). The value of sound velocity in a good flowmeter can varies from a few hundredths to a tenth of a meter not more. So, each timer tick, I take four sound velocity values (because the flowmeter has four ultrasonic beams), find minimal value of them and take floor for this value (Math.Floor). Then I find maximal value of these four velocity values and take ceiling for this maximal value (Math.Ceiling). So I'd like to limit the vertical axis by these minimum and maximum (ChartMinimum and ChartMaximum properties). But unfortunately I can't. Supports only the maximum (please see 'SoundVelocity.PNG' file attached and 'SoundVelocity2.PNG file attached, the second one has zoomed in chart). Minimum is not supported. Why? The folowing is What I need. So. I need that the vertical axis limited by minimum and maximum and with MajorStep == 0.01. For example, if minimal value of sound velocity (obtained on timer tick) is 325.7 then limiting minimum of vertical axis must be 325, if maximal value of the sound velocity obtained is, for example, 326.2 then limiting maximum of vertical axis must be 327. So in this case the vertical axis must be from 325 to 327 with MajorStep == 0.01 (!!! but not from 0 to 327 with MajorStep==0.01 !!!). Is this possible to do ofcourse. If yes, please show me how it can be implemented. Thank you very much in advance.

P.S. If you need some aditional information for answering on this my post, please write me.

Dmitry
Top achievements
Rank 1
 answered on 12 Sep 2016
3 answers
213 views

In my application, I have a outlook bar which has some menu items. On click event of mneu Item I want to traverse the visual tree upto main Window. For normal view of Outlook bar it is working properly but for collapsed view of outlook bar when I click menu item it traverse till PopUpRoot control only. Parent of this control returns null.

 

var parent = VisualTreeHelper.GetParent(this);
                        while (!(parent is Window))
                        {
                            parent = VisualTreeHelper.GetParent(parent);
                        }

Milena
Telerik team
 answered on 12 Sep 2016
12 answers
443 views
Hi,

Will this control have a Text property that we could use to get the visible text? Using the combination of SearchText and SelectedItem, depending on if the user actually selected from the list, or entered a completly new value is not really "developer friendly".

update: of course, this can only work if the SelectionMode is set to Single. If it's multiselect, my question is not valid.

Thanks,
Gyula
Jeremy
Top achievements
Rank 1
 answered on 09 Sep 2016
0 answers
111 views

I have a RichTextBox that I am searching.  When the search result is selected the text is then highlighted correctly.  However, once the RichTextBox is scrolled, the highlight does not follow the text that was highlighted, but instead stays where the text was initially found (see attached screenshot). Below is the code that highlights the desired text initially.  Any thoughts on how to get the highlight to follow the text as it is scrolled?

01.class SearchResult
02.{
03.    public string Display { get; set; }
04.    public TextPointer Start { get; set; }
05.    public TextPointer End { get; set; }
06.}
07. 
08.public void DoSearch()
09.{
10.    string toSearch = TextBox_Find.Text.Replace(@"\", @"\\")
11.        .Replace("^", @"\^")
12.        .Replace("$", @"\$")
13.        .Replace(".", @"\.")
14.        .Replace("|", @"\|")
15.        .Replace("?", @"\?")
16.        .Replace("*", @"\*")
17.        .Replace("+", @"\+")
18.        .Replace("(", @"\(")
19.        .Replace(")", @"\)")
20.        .Replace("[", @"\[")
21.        .Replace("]", @"\]")
22.        .Replace("{", @"\{")
23.        .Replace("}", @"\}");
24.    TextRange range = new TextRange(RichTextBox_AllComments.Document.ContentStart, RichTextBox_AllComments.Document.ContentEnd);
25.    Regex reg = new Regex(toSearch, RegexOptions.Compiled | RegexOptions.IgnoreCase);
26. 
27.    var start = RichTextBox_AllComments.Document.ContentStart;
28.    while (start != null && start.CompareTo(RichTextBox_AllComments.Document.ContentEnd) < 0)
29.    {
30.        if (start.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text)
31.        {
32.            var matches = reg.Matches(start.GetTextInRun(LogicalDirection.Forward));
33.            TextRange textrange = null;
34.            foreach (Match match in matches)
35.            {
36.                textrange = new TextRange(start.GetPositionAtOffset(match.Index, LogicalDirection.Forward), start.GetPositionAtOffset(match.Index + match.Length, LogicalDirection.Backward));
37.                SearchResults.Add(new SearchResult() { Display = "Result " + (SearchResults.Count + 1).ToString(), Start = textrange.Start, End = textrange.End });
38.            }
39.            if (textrange != null) start = textrange.End;
40.        }
41.        start = start.GetNextContextPosition(LogicalDirection.Forward);
42.    }
43.}
44. 
45.private void ListBox_Find_SelectionChanged(object sender, SelectionChangedEventArgs e)
46.{
47.    if (e.AddedItems.Count > 0)
48.    {
49.        bFindItemSelected = true;
50.        SearchResult sr = e.AddedItems[0] as SearchResult;
51.        RichTextBox_AllComments.Focus();
52.        RichTextBox_AllComments.Selection.Select(sr.Start, sr.End);
53.        ((UIElement)ListBox_Find.ItemContainerGenerator.ContainerFromItem(ListBox_Find.SelectedItem)).Focus();
54.    }
55.}

webmaster
Top achievements
Rank 1
 asked on 09 Sep 2016
2 answers
241 views

Hi,

I want to use multiple line series to compare some analog sensor values over several production runs.

The production runs start at different time or dates. To compare them all time values substracted from the production run start, thus i get a compareable timespan for each value.

I tried to use a TimeSpan data type but that seems not to work with the DateTime Axes. With a DateTime datatype it works but if a production run takes more than one day I can only show the day of month. I can't show the day value as day 1, day 2 ... because the DateTime format string has no "elapsed days" only day on week or day of month.

Is there a way to use a TimeSpan or customize the lable formatting.

Thank you for your help


Philipp
Top achievements
Rank 1
 answered on 09 Sep 2016
9 answers
207 views
Hi All

We are assesing the WPF suite and will rely heavily on the GridView. I cant seem to see that there is an option to Save the Layout to an xml file.

It seems to be an option in the Silverlight and Winform versions of your suite, but not in WPF. Is this correct?

Nick
Dilyan Traykov
Telerik team
 answered on 09 Sep 2016
4 answers
244 views

Hi to all,

I'm creating new project with a Common Style Dictionary, and merged with application resource.

When I apply style to my control, this one disappers!

I tryed with RadWindow and Radbutton, same result.

 

I've attach several screeshots.

Can you help me to understand?

Martin
Telerik team
 answered on 09 Sep 2016
0 answers
121 views

Hi guys,

I have a application that spits out new lines in this Gridviewer. All the new lines are added at the bottom of the viewer. The "normal" behavior of the scrolling bar is that new lines will be added at the top. Since my new lines are added the bottom I have to revert the scrolling method. Does anyone know if this is possible? 

Timo
Top achievements
Rank 1
 asked on 09 Sep 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?