Telerik Forums
UI for WPF Forum
0 answers
31 views

I'm using a RadChat in my project with a DataBinding to the ItemSource.

A MessageConverter creates either TextMessages or GifMessages. This all works fine.

The problem I have is that I want to add a TimeBreak to the top of the list, as I use the chat to store messages in my interface to view later, like a log. The first message can be in the past. And I want to know when this was.

My current solution is to always add one dummy message to  the top of the pile, which has a DateTime:  2000-01-01

I've added a Style to my App.Xaml:

 

 <Style BasedOn="{StaticResource InlineMessageControlStyle}" TargetType="conversationalUi:InlineMessageControl">
    <EventSetter Event="Loaded" Handler="InlineMessageControl_OnLoaded" />
 </Style>

This gives access to the loading of the InlineMessageControl. In which I look up the Message with the CreateAt of 2000-01-01. Like this:

 

private void InlineMessageControl_OnLoaded(object sender, RoutedEventArgs e)
{
  try
  {
    if (sender is not InlineMessageControl inlineMessageControl) { return; }

    //Hide first item, that is inserted manually to force a TimeBreak on the second
    if (inlineMessageControl.DataContext is InlineViewModel { CreationDate.Year: 2000 })
    {
      if (inlineMessageControl.TryFindParent<MessageGroup>() is { } messageGroup)
      {
        messageGroup.Visibility = Visibility.Collapsed;
      }

      if (inlineMessageControl.TryFindParent<VirtualizingStackPanel>() is { } panel)
      {
        panel.Margin = new Thickness(0, -15, 0, 0);
      }
    }
}

 

The result can be seen in the PNG attachment. However, I think this method should not be necesarry, as the tool itself should be able to do this using a bool like: AddTimeBreakToTop or something.

 

I am aware that you can add the Messages manually, but this seems like a even worse solution.

 

Waht are you thoughts, Am I missing something? Can this be improved?

 

Second question would be. How do I style the background of the TextMessages?

 

Max
Top achievements
Rank 1
Veteran
Iron
 updated question on 20 Mar 2025
1 answer
24 views

Hello,

With the telerik:RadDocking the content of the tab that I open expect a specific parent Window (of type like WindowBase) with utilities, notification, modals, ...

Then I drag out one of the docking pane the parent window is a ToolWindow, is there a way to create a custom ToolWindow or wrap the content of a ToolWindow in a custom UserControl ?

Thanks you,

Martin Ivanov
Telerik team
 answered on 19 Mar 2025
1 answer
34 views

Hi there,

In the color editor, is there a mechanism to have alpha show as 0... 255 rather than as a percentage?  Our users are accustomed to working with these colors as 4x byte values for consistency.

I don't think I see a setting similar to AlphaSettingsVisibility, but I thought I'd ask to see whether I've missed anything.

Thanks!

-David

Stenly
Telerik team
 answered on 17 Mar 2025
1 answer
28 views

There's an issue with the RadMultiColumnComboBox in that the inner text field is left aligned so if the user doesn't click exactly in the text box, then they can't type anything.

In the attached image, I set the border of the inner textbox to red just for a visual aid. If the user clicks anywhere inside the red border, then the field gets focus and they can type and everything works as expected. However, if they're not focused on that field and they try to click to the right of the red border, it does nothing and to the user, it feels buggy.

I tried setting the horizontal alignment of the text box to stretch, but that had no effect. Is there a fix for this?

Shawn
Top achievements
Rank 1
Iron
Iron
 answered on 13 Mar 2025
0 answers
29 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
48 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
33 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
25 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
42 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
32 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?