Telerik Forums
UI for WPF Forum
1 answer
23 views

Is it possible to have the RadCalendar inside the RadDatePicker and RadDateRangePicker to have a different theme than the RadDatePicker and the RadDateRangePicker?

I tried setting this within the RadDatePicker control's xaml:

<telerik:RadDateTimePicker.CalendarStyle>
    <Style TargetType="telerik:RadCalendar">
        <Setter Property="telerik:StyleManager.Theme"
                Value="Windows11" />
    </Style>
</telerik:RadDateTimePicker.CalendarStyle>

...but it has no effect.

Stenly
Telerik team
 answered on 12 Mar 2025
0 answers
18 views

There is the a form:

|    Segment   |        TimeIn       |       TimeOut        |       Duration      |

|          1          |   XX:XX:XX:XX  |   XX:XX:XX:XX   |   XX:XX:XX:XX  |

|          2         |   XX:XX:XX:XX  |   XX:XX:XX:XX   |   XX:XX:XX:XX  |

|          3         |   XX:XX:XX:XX  |   XX:XX:XX:XX   |   XX:XX:XX:XX  |

|          4         |   XX:XX:XX:XX  |   XX:XX:XX:XX   |   XX:XX:XX:XX  |

The number of Segment depends on how many xml file is found. I want to limited the information cannot be empty in middle (without the 1st seg1 and last seg4). How can I set get these middle segment number? My way is using  SegmentNo.Text <> 1 and SegmentNo.Text <> last. However it can't use ".last". How can I get the last row's Segment No? 

Code

For Each r As GridDataItem In gridSegment.Items

   If FileName.Text <> "" Then

       // Red the textbox if data is missing

   Else

      If timeIn.Text = "" AND timeOut.Text = "" AND Duration.Text = "" Then

        If Segment.Text <> 1 AND Segment.Text <> ??? Then
        
          // Red that row all textbox

        End If

     End If

   End If

Next

 

 

Matthew
Top achievements
Rank 1
 updated question on 12 Mar 2025
0 answers
28 views

Hello dear community.

We have a problem, which results in references not being cleaned up properly and the memory leaking over time.

 

The application works like this:

We have a RadTabbedWindow, with RadTabItems. Those RadTabItems have Views with ViewModels (MVVM), injected via PRISM.

Now when we close the tab, the view is not unloaded or garbage collected. When analysed with Resharper DotMemory, you can see that in this example the StyleSelectors or the ResourceDictionarys keep it referenced and thus not allowing it to be collected.

 

To find a Solution to the problem, we have broken down the control to the most simple elements (Simplified ScheduleView.txt). When tested, we noticed that Events and StyleSelectors are keeping the items referenced. So we wrote an UnloadBehavior (which is executed when closing the tab). There is a lot more code in it, handling other stuff, but in the uploaded file (UnloadBehavior.txt) I have only left the stuff regarding this particular case.

 

You can see in MasterViewTop1.png (1 being the top, 2 the middle, 3 the bottom) the reference path.

 

In this particular code, the two StyleSelectors:

GroupHeaderStyleSelector
AppointmentStyleSelector

hinder the cleaning up.

When I give the RadScheduleView a x:Name Property and use them in code behind to set those StyleSelectors to null, it gets unloaded.    Example: ObjectName.GroupHeaderStyleSelector = null;

 

But our application is gonna be big and we need a general solution. We don't want to give each object a name and unload StyleSelectors, Events, etc.. in the code-behind and set them to null. We need a general solution.

 

I can assure that neither the ViewModel, nor the code-behind is at fault. At this particular case, it's just those two StyleSelectors. I know about events, because the RadTimeBar causes the same problem, but with the VisiblePeriodChanged property, which is an event. But we want to solve this step first, which will probably solve all other problems, too. We just need to understand what has gone wrong.

 

Does anybody have an idea what can be done or what is wrong with the code?

I can guarantee that the UnloadBehavior is executed and reaches the DependencyProperties of the RadScheduleView and also sets them to null. But for some reason the objects and the view stay in the memory, even though they don't when I manually do it in the code-behind.

 

To summarise:

- We need a general solution to unload Telerik objects and clear up references for Events, StyleSelectors and everything referencing and locking the UserControl to be garbage collected.

- When done in Code-Behind it works, but when done in the UnloadBehavior nothing happens.

Anastasios
Top achievements
Rank 1
 asked on 12 Mar 2025
1 answer
27 views
If I bind the SelectedItem of my TimeLine control to a property of my MainView model, the setter does not run when an item is selected. However, the SelectionChanged event is executed.
Stenly
Telerik team
 answered on 11 Mar 2025
2 answers
35 views

Hello everyone!

I want to let my users display a Speed field: this will be a custom field, of course Speed = Distance / Time.

The problem I have is that some of my records are incomplete (have only either distance or time populated), but those records are still being used.

From what I understand, when I get an aggregate value the aggregation function is always set to sum, and incomplete records are still being put into the sum function (even if the other value is null).

 

I would like to be able to do both of these:

  1. Specify I want to use the AVERAGE function instead of sum.
  2. Exclude incomplete records from the calculation of my calculated field.

 

Thanks for your input!


public class CalculatedSpeedCalculatedField : CalculatedField
{
    private RequiredField distance;
    private RequiredField time;

    public CalculatedSpeedCalculatedField()
    {
        this.Name = "CustomCalculatedSpeed";
        this.DisplayName = "Custom Calculated Speed";
        this.distance = RequiredField.ForProperty("distance");
        this.time = RequiredField.ForProperty("time");
    }

    protected override IEnumerable<RequiredField> RequiredFields()
    {
        return new List<RequiredField>
        {
            this.distance,
            this.time,
        };
    }

    protected override AggregateValue CalculateValue(IAggregateValues aggregateValues)
    {
        var aggregateDistance = aggregateValues.GetAggregateValue(this.distance);
        var aggregateTime = aggregateValues.GetAggregateValue(this.time);

        if (aggregateDistance.IsError())
        {
            return aggregateDistance;
        }
        else if (aggregateTime.IsError())
        {
            return aggregateTime;
        }

        double dist = aggregateDistance.ConvertOrDefault<double>();
        double tim = aggregateTime.ConvertOrDefault<double>();
        return new DoubleAggregateValue(dist / tim);
    }
}

Oscar
Top achievements
Rank 1
Iron
 answered on 11 Mar 2025
1 answer
25 views

Hi,

I have a radgridview which I have configured to sort using "telerik.RadGridView.SortDescriptors" based on whether a checkbox is tick or untick. However, upon ticking/unticking the checkbox, the radgridview does not sort based on the condition that I have specified. May I ask for the solution for this?

Martin Ivanov
Telerik team
 answered on 11 Mar 2025
1 answer
23 views
Hello, how can I bind the color of the individual slices to my viewmodel?
Martin Ivanov
Telerik team
 answered on 10 Mar 2025
1 answer
27 views
As the header state, after downloading the trial version of "Telerik_UI_for_WPF_Documentation_2025_1_211.chm", i opened the chm and navigated to the Contents Tab and when i clicked a topic nothing appears on the right side, What is wrong?
Martin Ivanov
Telerik team
 answered on 06 Mar 2025
1 answer
27 views

I have a record Pitch (see below)

    [TypeConverter(typeof(PitchTypeConverter))]
    public sealed record Pitch(double MinValue, double MaxValue) : IParsable<Pitch>
    {
        public static readonly Pitch Empty = new(0, 0);

        public static Pitch Parse(string s, IFormatProvider provider) 
            => throw new NotImplementedException();
        public static bool TryParse([NotNullWhen(true)] string s, IFormatProvider provider, [MaybeNullWhen(false)] out Pitch result) 
            => throw new NotImplementedException();

        public override string ToString()
            => $"{MinValue}-{MaxValue}";
    }

As you can see , I also have a TypeConverter (currently not fully implemented, but to show the problem it is sufficient).

  public sealed class PitchTypeConverter : TypeConverter
    {
        public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) 
            => base.CanConvertFrom(context, sourceType);

        public override bool CanConvertTo(ITypeDescriptorContext context, [NotNullWhen(true)] Type destinationType)
            => destinationType == typeof(string);

        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) 
            => base.ConvertFrom(context, culture, value);

        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
            => value?.ToString() ?? Pitch.Empty.ToString();

        public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues) 
            => base.CreateInstance(context, propertyValues);

        public override bool GetCreateInstanceSupported(ITypeDescriptorContext context) 
            => base.GetCreateInstanceSupported(context);

        public override bool IsValid(ITypeDescriptorContext context, object value) 
            => base.IsValid(context, value);

        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) 
            => base.GetProperties(context, value, attributes);

        public override bool GetPropertiesSupported(ITypeDescriptorContext context) 
            => base.GetPropertiesSupported(context);

        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) 
            => base.GetStandardValues(context);

        public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) 
            => base.GetStandardValuesExclusive(context);

        public override bool GetStandardValuesSupported(ITypeDescriptorContext context) 
            => base.GetStandardValuesSupported(context);
    }

The Pitch lives inside a ViewModel and is correctly displayed in the RadPropertyGrid, so in that sense everthing works fine.

    [Category("Conditions")]
        [Description("Sets the minimum/maximum allowed pitch limit.")]
        public Pitch PitchLimit
        {
            get => GetProperty(Pitch.Empty);
            set => SetProperty(value);
        }

        [Category("Conditions")]
        public bool RequiresDE
        {
            get => GetProperty<bool>();
            set => SetProperty(value);
        }

 

when I now edit values in the RadPropertyGrid, the RequiresDE works when pressing enter or selecting the checkbox. It doesn't work however when I edit the value for the Pitch property. I can see that the SetProperty for RequiresDE is called, but when editing the PitchLimit the SetProperty is not called.

I honestly out of ideas to find out why the RequiresDE is called and the PitchLimit isn't.

 

Any help is appreciated.

Thanks

 

 

 

 

 

 

Martin Ivanov
Telerik team
 answered on 06 Mar 2025
0 answers
18 views

Hi,

We recently upgraded from 2022.3.912 to 2025.1.211 and it appears that VirtualGrid HeaderSizeNeeded is no longer called after we change VirtualGrid ColumnWidth to flush the cache of column widths. Is this a bug or is there some other way we should be forcing a recalculation of the column widths? Thanks in advance.

__Jason

Jason
Top achievements
Rank 1
 asked on 05 Mar 2025
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?