Hello,
I came to interesting problem of calculating correct number of items that are grouped up. I have GridView that has grouped items, however in each group there is "special" item, that points to object of different type (but derived from the base type of the ItemsSource collection). This item should not be counted into overall item count of the group, as its function is to enable user to write down some notes for each group and does not contain any production data. The calculated count is then displayed in the group header text.
My idea was to create converter, that would take Group object and return the number. The converter itself would take group.ItemCount of group and then iterate in loop over the group.Items collection and substract 1 from the count if the item is of specified type. All of this is done so that when the user searches via the inbuilt search bar in GridView, the count is always correct.
Now the problem, the gridview does no load items of groups that are not expanded (except for the first one??) and as such the converter iterates over nothing (the group.Items collection is empty) and thus the count is displayed wrong (displayed number is group.ItemCount without any substraction). Any ideas how could i work around this? I would rather avoid calculating this in viewmodel as that would require tracking the search text and then manually filtering items in collection.
There appears to be a bug in the column filter popup. Whenever I change one filter operator, the second filter operator changes to the same value. So I can't do something like GreaterThan X and LessThan Y.
See a video here: https://share.cleanshot.com/6Bn9FwlJ
Is this the best place to report bugs?
This is with 2024.4.1213.462.
To duplicate the issue:
Expect the following exception to be raised
Name | Value | Type | |
---|---|---|---|
â—˘ | $exception | {"Object reference not set to an instance of an object."} | System.NullReferenceException |
at Telerik.Windows.Controls.DateTimePickerGridViewEditor.Telerik.Windows.Controls.GridView.IGridViewEditor.SetText(String text) in Telerik.Windows.Controls\DateTimePickerGridViewEditor.cs:line 56
In case the zip doesn't work:
MainWindow.xaml.cs:
namespace WpfApp14
{
using System;
using System.ComponentModel;
using System.Windows;
using System.Collections.ObjectModel;
public sealed class GridValueViewModel : INotifyPropertyChanged
{
private string someValue = string.Empty;
public GridValueViewModel(string someValue)
{
this.SomeValue = someValue;
}
public event PropertyChangedEventHandler PropertyChanged;
public string SomeValue
{
get
{
return this.someValue;
}
set
{
value = value ?? string.Empty;
if (this.SomeValue != value)
{
this.someValue = value;
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(this.SomeValue)));
}
}
}
public DateTime? DateValue
{
get
{
if (DateTime.TryParse(this.SomeValue, out var value))
{
return value;
}
return null;
}
set
{
if (value == null)
{
this.SomeValue = string.Empty;
return;
}
this.SomeValue = value.ToString();
}
}
public ObservableCollection<string> SomeValueItems { get; } = new ObservableCollection<string>(
new[]
{
"cat",
"dog",
"bird"
});
}
public partial class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
this.DataContext = this;
}
public ObservableCollection<GridValueViewModel> Values { get; } = new ObservableCollection<GridValueViewModel>(
new[]
{
new GridValueViewModel("cat"),
new GridValueViewModel("dog"),
new GridValueViewModel("bird")
});
}
}
MainWindow.xaml:
<Window x:Class="WpfApp14.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"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<telerik:RadGridView
AutoGenerateColumns="False"
ItemsSource="{Binding Values, Mode=OneWay}">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn
Header="Column 1">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<Label
Content="{Binding SomeValue}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
<telerik:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="*" />
</Grid.ColumnDefinitions>
<TextBox
Grid.Column="0"
Text="{Binding SomeValue, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
Visibility="Collapsed" />
<telerik:RadComboBox
Grid.Column="0"
HorizontalAlignment="Stretch"
IsEditable="False"
ItemsSource="{Binding SomeValueItems}"
SelectedItem="{Binding SomeValue}" />
<telerik:RadDateTimePicker
Grid.Column="0"
HorizontalAlignment="Stretch"
InputMode="DatePicker"
DateTimeWatermarkContent="{x:Null}"
SelectedValue="{Binding DateValue, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
Visibility="Collapsed" />
</Grid>
</DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</Window>
I using the <telerik:RadDatePicker>
DisplayFormat = (Long or short) only there I need a customer format how we archive.
Example : 1 July 2025, 1 JUL 2025
I've been trying to remove the thin white border line with no luck, Any help?
<telerik:RadGridView
Margin="0,5,0,0" AutoGenerateColumns="False" BorderThickness="0" BorderBrush="{StaticResource LaGrey12}"
ColumnBackground="{StaticResource LaGrey12}"
GridLinesVisibility="None" IsReadOnly="True"
ItemsSource="{Binding ContactActivityNote.ContactActivityParticipants}"
ShowColumnHeaders="False">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn
Width="Auto"
DataMemberBinding="{Binding ParticipationTypeId}"
Header="Type" />
<telerik:GridViewDataColumn
Width="*"
DataMemberBinding="{Binding AddressedTo}"
Header="Addressed To" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
I have a RadGridview displaying data from a datatable using autogenerated columns. I have EnableColumnVirtualization="True" and EnableRowVirtualization="True". When I scroll through the grid, columns and rows are autosizing to display data and everything looks good for the most part.
However, I have some columns that can be excessively wide, easily twice the width of the screen. The same for rows, I occasionally have a cell where the row is excessively high.
How can I set a max width for column and row to prevent excessively wide columns or tall rows? I tried setting MaxHeight and MaxWidth, but that also constrains the user to those settings if they do intentionally want to increase those values.
<telerik:RadGridView Grid.Row="2" Grid.ColumnSpan="2" x:Name="MyGridView"
ItemsSource="{Binding MyItems}"
RowIndicatorVisibility="Collapsed"
ShowColumnFooters="True"
ShowGroupPanel="False"
IsReadOnly="True"
HorizontalContentAlignment="Stretch"
VerticalAlignment="Top">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding MonthDisplay}" Header="Month" Width="65">
<telerik:GridViewDataColumn.Footer>
<TextBlock Text="Totals:"/>
</telerik:GridViewDataColumn.Footer>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Column1Data}" Header="Column 1" Width="*" MinWidth="40" MaxWidth="95" DataFormatString="#,###0.##" TextAlignment="Right" FooterTextAlignment="Right">
<telerik:GridViewDataColumn.AggregateFunctions>
<telerik:SumFunction/>
</telerik:GridViewDataColumn.AggregateFunctions>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Column2Data}" Header="Column 2" Width="*" MinWidth="40" MaxWidth="95" DataFormatString="#,###0.##" TextAlignment="Right" FooterTextAlignment="Right">
<telerik:GridViewDataColumn.AggregateFunctions>
<telerik:SumFunction/>
</telerik:GridViewDataColumn.AggregateFunctions>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Column3Data}" Header="Column 3" Width="*" MinWidth="40" MaxWidth="95" DataFormatString="#,###0.##" TextAlignment="Right" FooterTextAlignment="Right">
<telerik:GridViewDataColumn.AggregateFunctions>
<telerik:SumFunction/>
</telerik:GridViewDataColumn.AggregateFunctions>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Column4Data}" Header="Column 4" Width="*" MinWidth="40" MaxWidth="95" DataFormatString="#,###0.##" TextAlignment="Right" FooterTextAlignment="Right">
<telerik:GridViewDataColumn.AggregateFunctions>
<telerik:SumFunction/>
</telerik:GridViewDataColumn.AggregateFunctions>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
Month Column1 Column2 Column3 Column4 Jan 1 2 3 4 Feb 1 2 3 4 March 1 2 3 4 Totals: 3 6 9 12
Month Column1 Column2 Column3 Column4 Jan 1 2 3 4 Feb 1 2 3 4 March 1 2 3 4 Totals: 3 6 9 12 Average:1 2 3 4
Hi,
I have rad grid view with Grouping along with Select checkbox (GridviewCheckboxcolum). I need below help
Thanks in advance