Telerik Forums
UI for WPF Forum
3 answers
397 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.

 

 

 

Dinko | Tech Support Engineer
Telerik team
 answered on 12 Aug 2021
1 answer
184 views

I've made a YearRange custom filtering control that expose a DependencyProperty called Vintage

<telerik:GridViewDataColumn Width="110" DataMemberBinding="{Binding ModelVariant.Vintage}" Header="Årgang">
  <telerik:GridViewDataColumn.FilteringControl>
    <local:CustomGridFilter Vintage="{Binding ElementName=root, Path=VintageYear, Mode=TwoWay}" />
  </telerik:GridViewDataColumn.FilteringControl>
</telerik:GridViewDataColumn>

 public int? Vintage
        {
            get { return (int?)GetValue(VintageProperty); }
            set { SetValue(VintageProperty, value); }
        }

        public static readonly DependencyProperty VintageProperty =
            DependencyProperty.Register(
                "Vintage",
                typeof(int?),
                typeof(CustomGridFilter),
                new PropertyMetadata(
                    null,
                    (sender, evt) => { ((CustomGridFilter)sender).OnPropertyChanged("Vintage"); }
                )
            );

Apparently the property never changes (INotifyPropertyChanged) even though it's databound to a property on the container. 

So i suspect that the only other way to send a new filtering parameter to the Custom Filter Control is through other means ?

Or is this SUPPOSED to work ? 

How would i programatically send the new filtering parameter to the control ?

Dinko | Tech Support Engineer
Telerik team
 answered on 11 Aug 2021
1 answer
293 views

Large data and realtime append data with mvvm like use ObservableCollection or RadObservableCollection, it will deny UI for some seconds. Large data mean the list count greater than 200k even 1000k.

 

Some sence like follow:

 

a gridview binding vm.list. then vm.list.Add(data) and list.Count is greater than 200k. UI lags. list is ObservableCollection

a chart series bind a vm.chartseries[0]. then vm.chartseries[0].Add(data) .

those are similar.

 

Could some controls have a nother mode to work without mvvm? like:

Task.Run(()=>{

gridview1.AppendData(data);

 

vm.LineSeries[0].MaxCount = 200000;

chart1.Series[0].AppendData(data);

//or

vm.LineSeries[0].AppendData(data);

})

 

In this mode ,controls can append data in other thread (not ui thread, and it can use a better performence collection class) quick and reflesh UI it self. And this mode have more potential for performance optimization

Dilyan Traykov
Telerik team
 answered on 10 Aug 2021
0 answers
340 views

Hello.

First of all, my problem is that when the window is opened, the busy indicator appears after about 1-2 seconds.

 

The window is wrapped with a busy indicator.

I use async on Loaded Evenet to control the IsBsuy property.

<telerik:EventToCommandBehavior.EventBindings>
	<telerik:EventBinding EventName="Loaded" Command="{Binding OnEventLoadedCommand}"/>
</telerik:EventToCommandBehavior.EventBindings>
public ICommand OnEventLoadedCommand { get => new DelegateCommand(obj => Loaded(obj)); }
private async void Loaded()
{
    IsBusy = true;

        DataLoad . . . . (using async task)

    IsBusy = false;
}

 

In a simple sample project, it appears immediately.
However, in my actual project, it is a bit delayed.

 

This is my guess.
Before Loaded, my actual project contains a lot of controls.

The window contains navigation.

There are about 10 usercontrols.


<Window>
    <DataTemplate ....  dataconext = ViewModel> * 10
</Window>

<usercontrol> * 10
    <Many Controls Input Initial Setting>
</usercontrol>

ViewModel..cs => Read values ​​of many properties before constructor

 

User controls all share the window viewmodel (not separate, only the WindowViewModel).

I think this is the cause of the first creation, but what about it?


Is there any way to solve this? If not, what's the problem?

 

Thanks.

Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
 updated question on 10 Aug 2021
1 answer
989 views

Hi,

I've a problem with GridView and ControlPanel. I'd like to control visibility of GridView columns by using ControlPanel with ControlPanelItem containing ListBox with bounded Columns collection. Listbox contains checkboxes bounded to IsVisible property of GridViewColumn and content with column header.

Everything works fine until I want to show the list of columns in ControlPanelItem. After click on ControlPanelItem some of columns headers disappering. I've noticed that it's strictly related to columns with more complex headers (i.e. textblock with set text and toolTip properties).For columns with simple text header, everything is ok.

I can inverse that effect and click on column header, then column header appears, but Checkbox in ControlPanel doesn't contain any text.

 

TextBlockForDataGridHeader is a TextBlock control with overriden ToString() method.

ControlPanel definition is the same with example you've provided on ControlPanel section in telerik controls for WPF guidance.


<telerik:RadGridView ItemsSource="{Binding Results, Mode=OneWay}"
                                     SelectedItem="{Binding SelectedResult, Mode=TwoWay}">
                        <telerik:RadGridView.ControlPanelItems>
                            <telerik:ControlPanelItemCollection> 
                                <telerik:ControlPanelItem ButtonTooltip="{x:Static localization:Resources.ColumnsVisibility}"
                                                          ButtonContent="{StaticResource EyeOff}"> 
                                    <telerik:ControlPanelItem.ContentTemplate> 
                                        <DataTemplate> 
                                            <ListBox ItemsSource="{Binding Columns, Mode=OneTime}"  
                                                     BorderThickness="0"> 
                                                <ListBox.ItemTemplate> 
                                                    <DataTemplate> 
                                                        <CheckBox Content="{Binding Header, Mode=OneTime}" 
                                                                  IsChecked="{Binding IsVisible, Mode=TwoWay}" /> 
                                                    </DataTemplate> 
                                                </ListBox.ItemTemplate> 
                                            </ListBox> 
                                        </DataTemplate> 
                                    </telerik:ControlPanelItem.ContentTemplate> 
                                </telerik:ControlPanelItem> 
                            </telerik:ControlPanelItemCollection>
                        </telerik:RadGridView.ControlPanelItems> 
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn Header="{x:Static localization:Resources.Number}" 
                                                        DataMemberBinding="{Binding Index, Mode=OneTime}" />
                            <telerik:GridViewDataColumn Header="{x:Static localization:Resources.Name}" 
                                                        DataMemberBinding="{Binding Node.Name, Mode=OneTime}" />
                            <telerik:GridViewDataColumn Header="{x:Static localization:Resources.Container}" 
                                                        DataMemberBinding="{Binding ContainerName, Mode=OneTime}" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Real, Mode=OneTime}"
                                                        DataFormatString="{}{0:F3}">
                                <telerik:GridViewDataColumn.Header>
                                    <controls:TextBlockForDataGridColumnHeader Text="Re {U} (kV)" 
                                                                               ToolTipService.ToolTip="{x:Static localization:Resources.RealVoltage}" />
                                </telerik:GridViewDataColumn.Header>
                            </telerik:GridViewDataColumn>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Imaginary, Mode=OneTime}"
                                                        DataFormatString="{}{0:F3}">
                                <telerik:GridViewDataColumn.Header>
                                    <controls:TextBlockForDataGridColumnHeader Text="Im {U} (kV)" 
                                                                               ToolTipService.ToolTip="{x:Static localization:Resources.RealVoltage}" />
                                </telerik:GridViewDataColumn.Header>
                            </telerik:GridViewDataColumn>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Magnitude, Mode=OneTime}"
                                                        DataFormatString="{}{0:F3}">
                                <telerik:GridViewDataColumn.Header>
                                    <controls:TextBlockForDataGridColumnHeader Text="U (kV)" 
                                                                               ToolTipService.ToolTip="{x:Static localization:Resources.RealVoltage}" />
                                </telerik:GridViewDataColumn.Header>
                            </telerik:GridViewDataColumn>
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>

 

I had similar problem with WPF resources. When I want to reuse some resources (i.e. icons or paths) in the same view, I have to use x:Shared clause with false value.

 

In addition, I'd like to avoid declaring seperate resources with columns for each GridView control used in my app.

Thanks for your help!
Łukasz

Dinko | Tech Support Engineer
Telerik team
 answered on 09 Aug 2021
1 answer
359 views

Hello,

Is any way to set default width for new tables, which are creating via RichTextBox UI?

I tried to set OnLoad the following, but unsuccessfully:

Editor.Document.Style.TableProperties.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 100);

StyleDefinition normalWebStyle = Editor.Document.StyleRepository.GetValueOrNull(RadDocumentDefaultStyles.NormalWebStyleName, true);

normalWebStyle.TableProperties.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 100);

Tanya
Telerik team
 answered on 09 Aug 2021
2 answers
174 views

Hello,

I'd like to have two levels of X-Axis labelling in order to have a main category and subcategories clustered. 

I found this topic  https://www.telerik.com/forums/clustered-bar-chart---dual-x-axis-labels-is-this-possible-0866e299cb79  that asks for the same feature but the last reply is very old. It´s possible to achieve this behaviour nowadays?

Thanks !

Javier
Top achievements
Rank 1
Iron
 answered on 05 Aug 2021
3 answers
298 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 05 Aug 2021
1 answer
211 views

Hi

I am using RadAutoCompleteBox. During suggestion I want to show multiple property in single row. For this I modified the data template and created 3 column grid. Now the issue is that how do I add header to it. Header should come once.

Vladimir Stoyanov
Telerik team
 answered on 05 Aug 2021
2 answers
242 views

Hi Telerik Team,

I am facing two issues in RadgridView,

1. I am getting  "Not Responding" message when I drag and drop the column header to do grouping . this issue is occurring when we have more than 15,000 records in RadgridView.

2. After grouping when I click any grouped row , the row visibility is getting collapsed.

Please kindly help me on this issues.

 

 

Stenly
Telerik team
 answered on 04 Aug 2021
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
InlineAIAssistant
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?