Telerik Forums
UI for WPF Forum
0 answers
32 views

I'm having an issue with the RadMultiColumnComboBox where it accepts returns, so it grows the field when it shouldn't. I tried this but it had no effect:

private void MultiColumnComboBox_Loaded(object sender, RoutedEventArgs e)
{
    var textBox = MultiColumnComboBox.FindChildByType<TextBox>();
            
    if (textBox != null)
    {
        textBox.AcceptsReturn = false;
        textBox.AcceptsTab = false;
    }
}
How can I make it so the field doesn't accept returns?
Shawn
Top achievements
Rank 1
Iron
Iron
 asked on 13 Mar 2025
1 answer
58 views
Hello everyone!
I am using Telerik in my wpf app(.NET 8.0). There is a RadGridView and the selection mode is multiple. I have a Checkbox(GridViewSelectionColumn) in the first column. And in my model there is a field IsSelectable. now my question is, how can i make the Selection enabled or disabled according to this field? When the IsSelectable is False the whole row should be disabled to select. and vise versa. Here is my current code:
<!--  Main data grid  -->
<telerik:RadGridView
Name="GridView"
Grid.Row="1"
Margin="3"
DataContext="{Binding Requests}"
ItemsSource="{Binding}"
ShowGroupPanel="False"
SelectionMode="Multiple"
SelectionUnit="FullRow"

>
<telerik:RadGridView.Columns>
<telerik:GridViewSelectColumn />

<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Id}" Header="{DynamicResource 100314}" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Branch}" Header="{DynamicResource 100214}" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=OperName}" Header="{DynamicResource 100315}" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=OperRefer}" Header="{DynamicResource 100316}" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=CrtUsr}" Header="{DynamicResource 100317}" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=CrtDtm}" Header="{DynamicResource 100318}" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=SndUsr}" Header="{DynamicResource 100319}" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=SndDtm}" Header="{DynamicResource 100320}" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Status}" Header="{DynamicResource 100242}" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Remark}" Header="{DynamicResource 100114}" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=RetCode}" Header="{DynamicResource 100321}" />
</telerik:RadGridView.Columns>

<telerik:EventToCommandBehavior.EventBindings>
<!-- Scroll event (RowLoaded) -->
<telerik:EventBinding
Command="{Binding DataContext.ScrollCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
EventName="RowLoaded"
PassEventArgsToCommand="True"
RaiseOnHandledEvents="True" />
</telerik:EventToCommandBehavior.EventBindings>

</telerik:RadGridView>
Stenly
Telerik team
 answered on 12 Mar 2025
1 answer
37 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
27 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
48 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
34 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
53 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
51 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
32 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
35 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
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
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
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?