I am dynamically loading a small amount of data from a Sql Server table using the dynamic data row concept in this example.
Everything is working however if one of the values is DBNull then when the column is sorted the grid displays as blank. Toggling the sort back to off shows the data again.
To solve this I am simply casting to null when the value is DBNull.
var value = reader.GetValue(x);
row[column] = value == DBNull.Value
?
null
: value;
This sounds to me like a bug.
Hi
I have a requirement to hide weekends to show up on the dropdown calendar control in RadDatePicker for WPF. I have gone through lots of google posts and telerik forum posts but couldn't find a way to do this. Is there a way to acheive this? If this is not possible, is there a easier way to disable selecting the weekends? The BlackoutDates collection won't work for me as i will need to insert all weekend dates from 1970 in to it and it is not a workable solution for us.
Thanks
Vinoth
Hi,
I use 2015 Q2. When I add mnemonic to label this way:
<
telerik:Label
Target
=
"{Binding ElementName=InputName}"
Grid.Row
=
"0"
Content
=
"_Nazwa:"
/>
<
telerik:RadMaskedTextInput
x:Name
=
"InputName"
Grid.Row
=
"0"
Grid.Column
=
"1"
/>
my label has additional margin at the beginning (space for non-existent underscore character?). Please see attached file.
When I remove underscore then label is aligned properly.
What can I do about it?
Hello,
Right now i am implementing a search button for my PDF toolbar.
all i need is the right icon. but i dont seem to find a list of the icons available
{telerik:IconResource IconRelativePath=SEARCH_ICON_goes_here.png, IconSources={StaticResource IconPaths}
can someone help please?
thanks
I took an example for a TreeView where you filter items with a Boolean "IsRemovedByFilter". The example had the items re-created with a copy constructor.
I did the same on a tree list view, and replaced the copy constructor with ListCollectionView.EditItem and CommitEdit.
The more times you filter the items, the slower it gets.
Here is the code:
MainWindow:
<
Window
x:Class
=
"TreeListView_Filtering_Issue.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<
TextBox
Text
=
"{Binding FilterText, UpdateSourceTrigger=PropertyChanged}"
/>
<
telerik:RadTreeListView
ItemsSource
=
"{Binding Items}"
AutoGenerateColumns
=
"False"
Grid.Row
=
"1"
>
<
telerik:RadTreeListView.ChildTableDefinitions
>
<
telerik:TreeListViewTableDefinition
ItemsSource
=
"{Binding FilteredChildren}"
/>
</
telerik:RadTreeListView.ChildTableDefinitions
>
<
telerik:RadTreeListView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Name}"
IsReadOnly
=
"True"
/>
</
telerik:RadTreeListView.Columns
>
</
telerik:RadTreeListView
>
</
Grid
>
</
Window
>
The data context is being set by (just a quick and dirty way for this example):
public MainWindow()
{
InitializeComponent();
this.DataContext = new MainViewModel();
}
The ViewModels are:
public
class
MainViewModel : ViewModelBase
{
private
ObservableCollection<Person> _persons =
new
ObservableCollection<Person>();
private
ListCollectionView _items;
private
string
_filterText =
string
.Empty;
public
MainViewModel()
{
for
(
int
i = 0; i < 100; i++)
{
Person person =
new
Person(
null
)
{
Name =
"Test"
+ i,
};
_persons.Add(person);
for
(
int
j = 0; j < 20; j++)
{
Person child =
new
Person(person)
{
Name =
"Child."
+ i +
"."
+ j,
};
person.Children.Add(child);
}
}
_items =
new
ListCollectionView(_persons);
_items.Filter = nonFilteredChidrenPredicate;
}
internal
static
bool
nonFilteredChidrenPredicate(
object
obj)
{
if
(obj
is
Person)
{
return
!(obj
as
Person).IsRemovedByFilter;
}
return
false
;
}
public
ListCollectionView Items
{
get
{
return
_items;
}
}
public
string
FilterText
{
get
{
return
_filterText;
}
set
{
if
(value ==
null
)
value =
string
.Empty;
_filterText = value;
FilterItems();
}
}
internal
void
FilterItems()
{
Queue<Person> queue =
new
Queue<Person>();
foreach
(var item
in
_persons)
{
queue.Enqueue(item);
}
while
(queue.Count > 0)
{
Person current = queue.Dequeue();
current.IsRemovedByFilter =
false
;
if
(current.Name.ToUpper().Contains(FilterText.ToUpper()))
{
current.IsRemovedByFilter =
false
;
//if (!string.IsNullOrEmpty(FilterText))
//{
// current.IsExpanded = true;
// if (selectedItem == null)
// selectedItem = current;
//}
// show and expand parent if one child fits with filter
setParentFilterStatus(current);
}
else
{
current.IsRemovedByFilter =
true
;
}
// filter tree leaves
if
(current.Children.Count > 0)
{
foreach
(var item
in
current.Children)
{
queue.Enqueue(item);
}
}
}
foreach
(var root
in
_persons)
{
Items.EditItem(root);
Items.CommitEdit();
refreshFilterStatus(root, root.Children);
}
}
private
void
refreshFilterStatus(Person parent, IEnumerable<Person> items)
{
foreach
(var item
in
items)
{
parent.FilteredChildren.EditItem(item);
parent.FilteredChildren.CommitEdit();
}
foreach
(var item
in
items)
{
refreshFilterStatus(item, item.Children);
}
}
private
void
setParentFilterStatus(Person person)
{
Person currentPerson = person;
while
(currentPerson.Parent !=
null
)
{
currentPerson.Parent.IsRemovedByFilter =
false
;
//// if a filter is applied, expand parent's nodes
//if (!string.IsNullOrEmpty(FilterText))
// currentPerson.Parent.IsExpanded = true;
currentPerson = currentPerson.Parent;
}
}
}
public
class
Person : ViewModelBase
{
public
string
Name {
get
;
set
; }
public
bool
IsRemovedByFilter {
get
;
set
; }
public
Person Parent {
get
;
private
set
; }
public
ObservableCollection<Person> Children {
get
;
private
set
; }
public
ListCollectionView FilteredChildren {
get
;
private
set
; }
public
Person(Person parent)
{
Children =
new
ObservableCollection<Person>();
FilteredChildren =
new
ListCollectionView(Children);
}
}
Run the example, and type the letter z. The filtering is fast. Delete the z, it now took a little more time.
Repeat this procedure few more times. You should notice that it becomes slower and slower each time (my guess would be event handlers leaking, but I didn't confirm it).
With dotTrace I can see that when the first z was typed, OnSourceViewColelctionChanged was called 5150 times.
The the z was deleted, OnSourceViewColelctionChanged was called 15150 times.
After repeating it 5 more times, OnSourceViewColelctionChanged was called 105150 times when the z was typed, and 115150 times when the z was deleted.
Currently, it is much faster (also due to virtualization) to just refresh the entire ListCollectionView
Hi!
I just installed the latest release of UI for WPF (Q1 2016) via control panel. What I noticed is that most of the installed assemblies are compiled on 01/12/2016, however some of them are compiled on 01/06/2016. This also means that the assemblies have different product versions.
Example (from Binaries.NoXaml/WPF45): Telerik.Windows.Control.dll (2016.1.112.45), Telerik.Windows.Documents.Core.dll (2016.1.106.45).
This never happened before, all files of a release normally had the same build date. Since I build my projects using special target files including the version number of each assembly this is very annoying. Please correct this in the next build.
Regards
Heiko
Hello.
I have a WPF MVVM application with several screens with grids. I currently use FilteringMode="FilterRow" on these grids. The problem I'm having is that after each filter is changed and loses focus, a database trip is made. This is very expensive and slow (going through OData and EF). I would like to defer all filtering until the user clicks a button. I can do this now by not binding a command to the Filtered event, but a change in filter still filters the grid page that currently has focus.
I have done some searching around and I do see that it's not possible to defer filtering when using FilterRow but I would like to explore what options I do have. Popup mode is not an option here as there's too much code to switch out. I saw Custom Filtering as an option but keep in mind that I have lots of grids each with lots of columns (my grid I'm testing with has 56 columns) and I have to be able to apply this across the board.
What I'm ultimately looking for is a way for a user to type their filters into whatever fields they choose and then click 1 button to apply all of them at once. The grid should not update at all when each field loses focus.
Any suggestions?
Hi,
I would like know it is possible to customize label inside each segment with a new property of our custom task.
What is the best way for that?
Thanks,
regards.