Hi,
i have two database models:
public class LogOrder
{
[Key]
public long Id { get; set; }
public string Name { get; set; }
...
[Display(AutoGenerateField = false)]
[InverseProperty(nameof(LogOrderUpdate.Order))]
public virtual ICollection<LogOrderUpdate> Updates { get; set; }
#region View
[Display(AutoGenerateField = false)]
public LogOrderUpdate LastUpdate
{
get
{
if (Updates != null && Updates.Any())
{
return Updates.MaxBy(x => x.Time);
}
return null;
}
}
#endregion
ctor ...
}
public class LogOrderUpdate : IEntity
{
[Key]
public long Id { get; set; }
public DateTime Time { get; set; }
...
}
used in a ViewModel
private QueryableEntityCoreCollectionView<LogOrder> entityCollectionView;
public QueryableEntityCoreCollectionView<LogOrder> EntityCollectionView
{
get { return entityCollectionView; }
set
{
this.entityCollectionView = value;
this.OnPropertyChanged(nameof(EntityCollectionView));
}
}
private readonly LogOrderContext objectContext;
public ViewModel()
{
objectContext = new LogOrderContext();
entityCollectionView = new QueryableEntityCoreCollectionView<LogOrder>(objectContext, objectContext.LogOrders, new Collection<string>() { nameof(LogOrder.Updates) } );
}
shown in xaml
<telerik:RadGridView
AutoGenerateColumns="False"
ItemsSource="{Binding EntityCollectionView}"
IsReadOnly="True"
Name="LogOrderGrid">
<b:Interaction.Behaviors>
<behaviors:RadGridLayoutBehavior />
</b:Interaction.Behaviors>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Id" UniqueName="Id" DataMemberBinding="{Binding Path=Id}"/>
<telerik:GridViewDataColumn Header="Name" UniqueName="Name" DataMemberBinding="{Binding Path=Name}"/>
<telerik:GridViewDataColumn Header="Time" UniqueName="LastUpdateTime" DataMemberBinding="{Binding Path=LastUpdate.Time}"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
Everything works as expected
But when I try to sort or filter the grid i get a System.InvalidOperationException
System.InvalidOperationException: 'The LINQ expression 'DbSet<LogOrder>()
.OrderBy(l => l.LastUpdate.Time)' could not be translated. Additional information: Translation of member 'LastUpdate' on entity type 'LogOrder' failed. This commonly occurs when the specified member is unmapped. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.'
It tries to query the "non database" property directly from the database -> .OrderBy(l => l.LastUpdate.Time)'
and the grid gets empty
I know combining db model and view properties are not a good approach but with the QueryableEntityCoreCollectionView I have to!?
Is there any annotation for those properties like [NonDbProperty] i can control this behavior?
Or is my approach completely wrong?
thank you in advance,
Marco
Hello
I have a RadCartesianChart with two LineSeries, one of the series is populated with a list of categories and values and the other is loads its categories based on a timer. Every time the timer ticks, a new category and value is added to the green line series.
Let me show you a screenshot.
I know exactly what are the categories and values for the grey line. The chart is loaded with them and that works well.
But the green line series ends up in the wrong place as I add new categories that were not there in first place. I wish that in the example above the categories could be 1 ... 2 ... 3 ...
Do I need to sort it? But how?
Here's my code example:
<Window
x:Class="Telerik.Question.Charts.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Title="MainWindow"
Width="1200"
Height="450"
mc:Ignorable="d">
<Grid>
<telerik:RadCartesianChart
x:Name="chart"
Width="1050"
Height="176">
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:CategoricalAxis
LineThickness="0"
MajorTickLength="0"
SmartLabelsMode="SmartStep"
TickThickness="0" />
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.VerticalAxis>
<telerik:LinearAxis
LineThickness="0"
MajorTickLength="30"
TickThickness="0" />
</telerik:RadCartesianChart.VerticalAxis>
<telerik:RadCartesianChart.Series>
<telerik:LineSeries
x:Name="scriptSeries"
Stroke="#525E68"
StrokeThickness="4" />
<telerik:LineSeries
x:Name="scriptChangesSeries"
Stroke="#07D19C"
StrokeThickness="4">
<telerik:LineSeries.Resources>
<DataTemplate x:Key="lastPointTemplate">
<Ellipse
Width="32"
Height="32"
Fill="White"
Stroke="#07D19C"
StrokeThickness="11" />
</DataTemplate>
</telerik:LineSeries.Resources>
</telerik:LineSeries>
</telerik:RadCartesianChart.Series>
</telerik:RadCartesianChart>
</Grid>
</Window>
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Timers;
using System.Windows;
using Telerik.Windows.Controls.ChartView;
namespace Telerik.Question.Charts
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
scriptSeries.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "Category" };
scriptSeries.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "Value" };
scriptSeries.ItemsSource = new List<ChartDataObject>()
{
new ChartDataObject(2, 4 ),
new ChartDataObject(2, 4 ),
new ChartDataObject(2, 8 ),
new ChartDataObject(4, 8 ),
new ChartDataObject(4, 4 ),
new ChartDataObject(6, 4 ),
new ChartDataObject(6, 8 ),
new ChartDataObject(9, 8 ),
new ChartDataObject(9, 10 ),
new ChartDataObject(11, 10 ),
new ChartDataObject(11, 4 ),
new ChartDataObject(12, 4 ),
new ChartDataObject(12, 18 ),
new ChartDataObject(14, 18 ),
};
var scriptChangesSeriesDataSource = new ObservableCollection<ChartDataObject>();
scriptChangesSeries.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "Category" };
scriptChangesSeries.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "Value" };
scriptChangesSeries.ItemsSource = scriptChangesSeriesDataSource;
var timer = new Timer
{
Interval = 1000
};
var i = 0d;
timer.Elapsed += (e, a) =>
{
i += 1;
scriptChangesSeriesDataSource.Add(new ChartDataObject(i, 5));
};
timer.Start();
}
}
public class ChartDataObject
{
public ChartDataObject(double category, double value)
{
Category = category;
Value = value;
}
public double Category { get; set; }
public double Value { get; set; }
}
}
What do I need to do to achieve that?
Thanks!
Hi,
I'm looking for some advice on the best control to use for user input of a single element, though drag&drop , that also has data validation display.
I have used it on RadListBox, RadGridView and RadTreeView but in this case I do not have a collection to fill.
I would like for the control to bind to a single property of type Foo and use the DragDropManager / BeahviorManager / PayloadManager to control what can be dragged / dropped onto the control so that the bound variable is updated.
I would also like for the control to display any validation error through INotifyDataErrorInfo
I would appreciate any suggestions.
Thank you for your help.
Hello,
I'm currently using a RadSyntaxEditor for user text inputs. The problem I'm facing happens when a user tries to write anything using an Asian IME, for example the Japanese IME with Hiragana input. Instead of having a predictive text dropdown open at the point of the caret, it opens a little input box in the corner of the screen and the predictive text dropdown opens at that position.
Is there a way to have the predictive text dropdown open at the position of the caret in the SyntaxEditor?
For reference, I have reproduced the issue in the Telerik UI for WPF SDK Samples Browser, the "Custom Language Highlighting" demo and attached the screenshot of the observed behaviour.
Any help would be appreciated, thank you.
Hello,
I have a ScheduleView that uses only a MonthViewDefinition and implements a ContextMenu for copy/pasting appointments. It works great when using a mouse to right-click and open the context menu. However, when opening the menu with a 'right-touch', the SelectedSlot property of the ScheduleView is always null. As a result, the copy/paste only works with touch if the user first touches a slot to 'select' it and then opens the context menu.
If the user 'right-touches' the day header (GoToDayButton) or an actual appointment, I am able to work around this problem by identifying the selected slot using GetClickedElement<TimeRulerMonthViewItem> or GetClickedElement<AppointmentItem> in the Opening event and programmatically setting the SelectedSlot property. However, if they are 'right-touching' the empty area in a day slot, I don't see a way to identify the selected day, as GetClickedElement<HighlightItem> returns null. Is there another way to identify the 'clicked' day in this case, or do you have any other suggestions on dealing with this touch bug?
Thanks in advance,
Vic
Have set a theme at the application level (Windows11Palette) but no matter how I set the colour variation, when it is set then the windows controls are not visible
I have tried the following:
StyleManager.ApplicationTheme = new Windows11Theme(Windows11Palette.ColorVariation.Dark);
Also:
StyleManager.ApplicationTheme = new Windows11Theme();
Windows11Palette.LoadPreset(Windows11Palette.ColorVariation.Dark);
Without the theme colour, then the controls are visible
Hi,
I tried to upgrade my app which have a reference to telerik.windows.Documents.for.WPF.
It seems that it is not supported for .NET 7. (only .NET Framework).
Will it be supported ?
Thank's for your response.
Hi,
When using certain column names in a Telerik WPF grid, the corresponding values are not being displayed correctly. The issue occurs when attempting to show data in the grid with the following column names :
Data = new ObservableCollection<CustomDynamicObject>()
{
new CustomDynamicObject(new Dictionary<string, object>
{
{"Check bug", "OK"}, // Values displayed correctly
{"Check. bug.", "OK"}, // Values not displayed correctly
{"Check. bug", "OK"}, // Values not displayed correctly
{"Check.", "OK"}, // Values not displayed correctly
{"Check ", "OK"}, // Values not displayed correctly
{"Check bug.", "OK"}, // Values displayed correctly
{"Check bug ", "OK"}, // Values displayed correctly
})
};
<telerik:RadGridView ItemsSource="{Binding Data}"/>
(CustomDynamicObject is a custom class that implements DynamicObject with Dictionary<string, object>())
After binding the data object to the grid, some values are not visible for specific column names. This issue appears to be related to column names that contain special characters such as periods (".") and spaces. Consequently, users cannot view the complete dataset, leading to data misinterpretation.
This issue severely impacts the usability of our application, as users rely on the accurate display of data in the grid. We use dynamic objects because the user generates the SQL requests. Is it a bug? There is any workaround or alternative approach using dynamic objects
that would allow us to display the data correctly in the grid, we would
be grateful for your guidance on implementing it ?
Attached you'll find a simplified example of how to reproduce the bug and a screenshot.
If you require any additional information or assistance in reproducing the bug, please do not hesitate to reach out. We are eager to see this issue addressed as soon as possible.
Best regards,
Hi,
I currently am using a RadMenuItem to show one particular Icon for example the Whatsapp logo.
When I hover over the RadMenuItem I would like the icon to change to another version (white) which will be more visible due to our RadMenuItem mouse over having a darker background.
The code below is showing the original logo but the IsMouseOver trigger does not appear to be working.
Here is my code:
MainWindow.Xaml
<telerik:RadMenuItem Height="30"
Command="{Binding EmailSupportCommand}"
FontSize="14" IconColumnWidth="30" Header="Email info@.com"
>
<telerik:RadMenuItem.Icon>
<Image>
<Image.Style>
<Style TargetType="{x:Type Image}">
<Setter Property="Source" Value="..\..\Auxiliary\Resources\64x64\dark\email.png" />
<Style.Triggers>
<DataTrigger Value="True" Binding="{Binding RelativeSource={RelativeSource AncestorType=telerik:RadMenuItem}, Path=IsMouseOver}">
<Setter Property="Source" Value="..\..\Auxiliary\Resources\64x64\light\email.png" />
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</telerik:RadMenuItem.Icon>
</telerik:RadMenuItem>