I know grid performance has been discussed many times, but I could not derive a solution so far from those posts.
The scenario is very simple, we have to show 20 items in a grid. The data paging responsibility is ours, the grid sees only 20 rows.
When the ItemsSource changes, 1-2 sec is needed for the grid to display the new results.
The performance is bad regardless of Virtualization settings (and 20 rows do not need virtualization at all naturally).
Fixed Height and With do not help, I think this is not the usual infinite height MeasureOverride issue.
I have attached DotTrace and VS profiler traces, so you can see the problematic paths.
The profiler pinpoints MeasureOverride at the surface. Most posts about grid performance revolve around this.
However, when we dig deeper we see creating each datagrid row took about 50ms.
For 20 rows this is 1sec. This explains the perceived delay.
The attached dottrace images show that LoadContent is called many hundred times, this is what actually eats the time.
Now, it is your turn to explain what I can do to avoid this big performance overhead.
Tell me if you need more profiling data from me.
Thanks,
Zsolt
I have a RadTabControl and I want to enable the drop-down button "WhenNeeded" so that users can easily access the buttons in the tab control. I have three templates for the tab items (RadTabItem) which means I should have 3 templates as well for the drop-down buttons that appear in the drop-down list.
There is a field called ItemDropDownContentTemplateSelector in RadTabControl and I created a template selector class like so:
public class DropDownDisplayModeTemplateSelector: DataTemplateSelector
{
public override DataTemplate
SelectTemplate(object item, DependencyObject container)
{
try
{
FrameworkElement element = container as FrameworkElement;
Console.WriteLine("DropDownDisplayModeTemplateSelector: " + element.GetType().Name);
if (element != null && item != null && item is TabItem)
{
TabItem tabItem = item as TabItem;
switch (tabItem.TabItemStyle)
{
case TabItemStyle.Title:
return element.FindResource("TitleDropDownModeDataTemplate") as DataTemplate;
case TabItemStyle.Button:
return element.FindResource("ButtonDropDownModeDataTemplate") as DataTemplate;
case TabItemStyle.GroupOfButtons:
return element.FindResource("GroupOfButtonsDropDownModeDataTemplate") as DataTemplate;
default:
return element.FindResource("ButtonDropDownModeDataTemplate") as DataTemplate;
}
}
else
return null;
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
return null;
}
}
}
However, finding the DataTemplates with element.FindResource() method doesn't work because the container element is of type "DropDownMenuItem" which of course is not the element where my data templates are defined.
I have them defined in the top level Grid element like so:
<Grid>
<Grid.Resources>
<ResourceDictionary>
<DataTemplate x:Key="TitleDropDownModeDataTemplate">
<TextBlock
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="4"
Grid.Column="1"
Text="TitleDropDownModeDataTemplate" />
</DataTemplate>
<DataTemplate x:Key="ButtonDropDownModeDataTemplate">
<TextBlock
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="4"
Grid.Column="1"
Text="ButtonDropDownModeDataTemplate" />
</DataTemplate>
<DataTemplate x:Key="GroupOfButtonsDropDownModeDataTemplate">
<TextBlock
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="4"
Grid.Column="1"
Text="GroupOfButtonsDropDownModeDataTemplate" />
</DataTemplate>
<models:DropDownDisplayModeTemplateSelector x:Key="myDropDownDisplayModeTemplateSelector"/>
</ResourceDictionary>
</Grid.Resources>
<telerik:RadTabControl
ItemsSource="{Binding TabItems}"
ItemDropDownContentTemplateSelector="{StaticResource myDropDownDisplayModeTemplateSelector}"
DropDownDisplayMode="WhenNeeded">
</Grid>
In this case what should I do, hack the way top to the Grid's resources or I have done something wrong in defining my drop-down template selector?
Hi there,
very simple scenario - we have a RadRichTextBox and want to show a placeholder (ghost) when there is no content in it.
Same behavior like WatermarkTextBox
Found no simple solution for this... or I have overseen something..
Thank you, Andi
private void OnAddFolderClicked(object sender, RoutedEventArgs e) |
{ |
IFolderContainer container = (sender as MenuItem).DataContext as IFolderContainer ?? null; |
Folder folder = new Folder() { Name = "Folder" }; |
container.AddFolder(folder); |
treeViewExplorer.SelectedItem = folder; |
folder.IsNodeInEditMode = true; |
RadTreeViewItem selectedItem = treeViewExplorer.SelectedContainer; // this is null even though I set the SelectedItem = folder |
} |
Hi,
I want to be able to receive the file and/or set the file for the radSpreadsheet.CommandDescriptors.SaveFile.Command command. It appears that no event can be handled before or after the command is executed.
Thanks
Hi,
I'm creating a custom localization manager, because my Culture is not supported and my client want to have everything in native language. LocalizationManager with
public override string GetStringOverride(string key)
{
switch (key)
{
}
return base.GetStringOverride(key);
}
is a great and simple tool to use. But I need some keys, which are not mentioned in telerik documentation. Currently I need those for week days and month names. Can you provide them please?
Best regards
Hi,
I've got a RadRibbonWindow like main window of my project.
I don't need the RadRibbonView but I would like to hide the title bar and insert the min/max/close button on my bar.
I attach the before and after pictures to understand that I intend.
How I can do this?
Thanks