Telerik Forums
UI for WPF Forum
0 answers
2 views

I am creating a little chat demo, by having two chat boxes next to each other (they communicate to each other). My issue is, when I load older messages from the database, I could not properly set a different "current author" for each chat box while maintaining MVVM structure (what I need is: in chatbox 1 user1 is the currentAuthor, in chatbox 2 user 2 is the currnetAuthor)

I am following an MVVM pattern. Code snippets are provided below (I tried to remove all lines irrelevant to the question):

1- my chat boxes

<telerik:RadChat x:Name="chat1" 
			 Width="400"
			 Height="550"
                         DataSource="{Binding Chat1Messages}"
                         CurrentAuthor="{Binding Chat1CurrentAuthor}">
</telerik:RadChat>

 <telerik:RadChat x:Name="chat2" 
			 Width="400"
			 Height="550"
                         DataSource="{Binding Chat2Messages}"
                         CurrentAuthor="{Binding Chat2CurrentAuthor}">

</telerik:RadChat>

2- My code in adding the messages from DB:

//some code to get data from DB//


this.chat1CurrentAuthor = this.FirstAuthor;
this.chat2CurrentAuthor = this.SecondAuthor;

//Iterator over data from DB
{
     //if message is written by first author:
     {
          this.Chat1Messages.Add(new TextMessageObject() { Text = row.MessageText, MsgAuthor = this.FirstAuthor, CreationDate = row.Time });
          this.Chat2Messages.Add(new TextMessageObject() { Text = row.MessageText, MsgAuthor = this.FirstAuthor, CreationDate = row.Time });
     }
     //if message is written by second author:
     {
          this.Chat1Messages.Add(new TextMessageObject() { Text = row.MessageText, MsgAuthor = this.SecondAuthor, CreationDate = row.Time });
          this.Chat2Messages.Add(new TextMessageObject() { Text = row.MessageText, MsgAuthor = this.SecondAuthor, CreationDate = row.Time });
     }
}


3- code to support MVVM:

public Author Chat1CurrentAuthor
{
            get { return this.chat1CurrentAuthor; }
            set
            {
                if (value != this.chat1CurrentAuthor)
                {
                    this.chat1CurrentAuthor = value;
                    OnPropertyChanged(() => this.chat1CurrentAuthor);
                }
            }
}
public Author Chat2CurrentAuthor
{
            get { return this.chat2CurrentAuthor; }
            set
            {
                if (value != this.chat2CurrentAuthor)
                {
                    this.chat2CurrentAuthor = value;
                    OnPropertyChanged(() => this.chat2CurrentAuthor);
                }
            }
}

 

With my current code, both authors are set up as current authors in both chatboxes (i.e in chatbox1, currentAuthor is both user1 and user2, in chatbox2 currentAuthor is both user1 and user2) which is not the desired behavior.

 

 

 

Wesam
Top achievements
Rank 1
 updated question on 01 Aug 2021
0 answers
2 views

I am looking for a way to implement an endless / infinite scroll in my RadGridView.

I have only found this very outdated blog post

https://www.telerik.com/blogs/wpf-how-to-endless-scrolling-of-2mil-records-using-backgroundworker-and-linq-to-sql

I also found some endless paging approach but I do not want to page, but instead to load more and more data when users scrolls to the end of the RadGridView.

For example,

I am calling a WebService and getting items from range 0 to 10, I populate my RadGridView with those items, when the user scrolls to the end, I want to hit my WebService again and fetch items from range 10 to 20 and load those into my RadGridView (now currently holding 20 items in total), than again user scroll to end, I once again hit WebServce fetch items from range 20 to 30, load those into my RadGridView...

This cycle can be repeated till the point my WebService delivers no data from a range.

 

Looking at other technologies, this seems to be what I am looking for

https://demos.telerik.com/kendo-ui/grid/endless-scrolling-local

https://demos.telerik.com/kendo-ui/grid/endless-scrolling-remote 

Though, I would prefer a solution where the total count can be unknown, and grid just tries to get new data everytime, untill it reaches the point where no data can be delivered, instead of knowing before hand how many items there may be

Rand
Top achievements
Rank 1
 asked on 31 Jul 2021
0 answers
2 views

My app uses the XAML binaries and the theme manager to set the application wide theme to Windows8Touch.  I also set custom palette colors at the same time. 

But whenever I want to customize a Telerik style, it seems I have to copy all of the relevant Theme XAML out of the Telerik Theme folder, replicate it in my app, and then base my styles off of that.  That's the only way that seems to work.

Because whenever  I try to base my custom style off just the type default, like this:

    <Style TargetType="{x:Type tk:RadPathButton}" BasedOn="{StaticResource {x:Type tk:RadPathButton}}">

I get weird results.  Colors don't match my the ones I set at application start times and it looks like the XAML comes from a different theme sometimes.

Is the rule that I must copy Telerik XAML in this situation or am I doing something else wrong?

Joe
Top achievements
Rank 1
Veteran
 asked on 30 Jul 2021
1 answer
8 views

I'm getting a crash:

System.ArgumentNullException
  HResult=0x80004003
  Message=Value cannot be null.
Parameter name: dataObject
  Source=Telerik.Windows.Controls.Diagrams
  StackTrace:
    at Telerik.Windows.Controls.Diagrams.DataTransferService.HandleDiagramElementDrop(DataObject dataObject)

looking up the stack I can see:

Telerik.Windows.Controls!Telerik.Windows.DragDrop.DragDropManager.DoDragDrop(System.Windows.DependencyObject dragSource, object data, System.Windows.DragDropEffects allowedEffects, System.Windows.DragDropKeyStates initialKeyState, object dragVisual, System.Windows.Point relativeStartPoint, System.Windows.Point dragVisualOffset)

However, I didn't do a drag and drop, I did a double click on a combo box. Plus the RadDiagram has AllowDrop="False". What's going on here?

I did try to put together a sample to see if I can reproduce this but can't seem to get RadDiagram to appear (see link)

Stenly
Telerik team
 answered on 30 Jul 2021
1 answer
12 views

Hi

I'm trying to put together a diagram sample. I based it on this: https://www.telerik.com/forums/issue-in-copy-and-paste-diagram-items as the report was about a stack trace similar to the one I'm experiencing and trying to track down: 

System.ArgumentNullException
  HResult=0x80004003
  Message=Value cannot be null.
Parameter name: dataObject
  Source=Telerik.Windows.Controls.Diagrams
  StackTrace:
	at Telerik.Windows.Controls.Diagrams.DataTransferService.HandleDiagramElementDrop(DataObject dataObject)

It builds fine but when I run it, I get an empty window, even if I click on the launch button. I can see no errors at runtime. I've attached a ZIP file of the project.

Stenly
Telerik team
 answered on 30 Jul 2021
1 answer
6 views

Hi,

 

I'm developing an application that will support scripting in it, so SyntaxEditor seems to be the perfect control to allow users to write there own script. But...

I tried to populate intelliprompts using this article (WPF SyntaxEditor | IntelliPrompts | Telerik UI for WPF) but with no success.

Do you have a full example not only an extract? In which event I populate the overlad list?

 

Thank's for any help.

Martin Ivanov
Telerik team
 answered on 30 Jul 2021
0 answers
3 views
In my PropertyGrid, one of my PropertyDefinitions binds to a property that returns a custom struct.  The struct, named "Length", represents a measured length with numeric value and measurement unit tied together. 

Since this is read-only I don't want an editor template, but I do want to be able set the template that's used to show the read-only  value.  

I do have a DataTemplate all ready.  It just shows a Label and uses a MultiBinding with the Length to show some custom information. But I cannot make the PropertyDefinition use it.

I tried setting the EditorTemplate property to my DataTemplate.  It seemed to have no effect.   Unfortunately there does not appear to be any sort of ReadOnlyTemplate property.  So is there a way for me to customize the ReadOnly view?
Joe
Top achievements
Rank 1
Veteran
 asked on 29 Jul 2021
0 answers
3 views
I tried to install and use your Theme Generator Application from here: https://docs.telerik.com/devtools/wpf/styling-and-appearance/themes-suite/color-theme-generator and when I launched it, my webcam turned on. It turned off and back on as I switched between themes and then turned off again when I closed the app. I tried this multiple times to verify that it was your app that was doing this.
Ilya
Top achievements
Rank 1
 asked on 29 Jul 2021
0 answers
4 views

Hi,

I use a standard Wpf Checkbox inside a RadPanelBarItem. I bind the background to a dynamic color and this works well, but when the mouse is over the box the background back to white, I would like that still remains of the assigned color.
Thank you in advance
Luigi

P.S:
Here the useful part of xaml (nothing in code behind)


<DataTemplate x:Key="PanelBarSorgentiTemplate">
			<StackPanel Orientation="Horizontal"  >				
				<CheckBox Margin="10 5 5 5" VerticalAlignment="Center"
						  IsChecked="{Binding IsChecked}"
						  Background="{Binding Color, Converter={StaticResource ColorToBrush}}"
						  
						  />
				<TextBlock Text="{Binding Name}"
						   VerticalAlignment="Center" />

			</StackPanel>
		</DataTemplate>
		
<t:RadPanelBarItem Header="{DynamicResource ResourceKey={x:Static l:ResourcesKeys.StatisticheVisualizzate}}"
							   ItemsSource="{Binding TabRisultati.StatisticheVisualizzate}"
							   ItemTemplate="{StaticResource PanelBarSorgentiTemplate}"
							   Visibility="{Binding IsTabStatisticaSelected, Converter={StaticResource BoolToVis}}"
							   IsExpanded="True"/>

Deltaohm
Top achievements
Rank 1
Iron
 asked on 29 Jul 2021
1 answer
13 views

I am using RadCartesianChart(c#, wpf) for stack bar chart.
I want to implement Subcategories(and legend by subcateroy) and Categories.
Is it possible?
Plz show me the way.

- Sample Datas

 

- and... I want to like below..

Martin Ivanov
Telerik team
 answered on 29 Jul 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Matthias
Top achievements
Rank 4
Bronze
Iron
Iron
Psyduck
Top achievements
Rank 4
Bronze
Iron
Iron
Jeffrey
Top achievements
Rank 2
Iron
Veteran
Iron
Thomas
Top achievements
Rank 1
Iron
Vedad
Top achievements
Rank 1
Iron
Iron
Veteran
Top users last month
Matthias
Top achievements
Rank 4
Bronze
Iron
Iron
Psyduck
Top achievements
Rank 4
Bronze
Iron
Iron
Jeffrey
Top achievements
Rank 2
Iron
Veteran
Iron
Thomas
Top achievements
Rank 1
Iron
Vedad
Top achievements
Rank 1
Iron
Iron
Veteran