Telerik Forums
UI for WPF Forum
3 answers
865 views

 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

Zsolt
Top achievements
Rank 1
 answered on 22 Apr 2021
3 answers
209 views

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?

Dinko | Tech Support Engineer
Telerik team
 answered on 21 Apr 2021
22 answers
1.1K+ views
Hello!

if I set an RadTreeViewItem to  ".Visibility = Visibility.Collapsed" or ".Visibility = Visibility.Hidden", the item is not visible BUT it stil takes space in the triewview (as a empty row).

Is this a bug, or how do I make an item invisible by code?

Petar Mladenov
Telerik team
 answered on 20 Apr 2021
2 answers
418 views

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

Andi
Top achievements
Rank 1
 answered on 20 Apr 2021
9 answers
789 views
Hi. I'm generating a RadTreeView and its items through WPF data binding using a HierarchicalDataTemplate. So when I add a new item to the collection the RadTreeView is looking at, and I set the selected item to that newly added object, I try to get the selected container, but it's null. This is my code:

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
        } 

What I want to do is to set focus on it, so if the user clicks F2 right away after creating it, it can go into edit mode, right now the object looks selected, but hitting F2 doesn't do anything unless deselect it, and select it again.

Thanks!
Dinko | Tech Support Engineer
Telerik team
 answered on 20 Apr 2021
5 answers
302 views

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

Tanya
Telerik team
 answered on 19 Apr 2021
0 answers
244 views
I have a <Grid> which has two <ItemsControl> in it.
The first <ItemsControl-1> will be vertically placed and second <ItemsControl-2> will be horizontally placed.
Each <ItemsControl> will have same number of counts as child items.
I have attached a snap for reference(MockUI Changes.jpeg) of how it looks like. 
Be default the items in <ItemsControl> height is set to AUTO and it has lot of sub-control(telerik) in it and height of the ItemControl.items may vary based on datatrigger set for the viewmodel property. 
I want to synchronize Height of ItemsControl1.Item1 with ItemsContol2.Item.(ex:during runtime if the height of ItemControl1.Item1 is 20 then ItemControl2.Item1 must also be same).
Any Idea or suggestion or samples to implement this behavior.


Thanks and Regards,
Kishore
Kishorekumar
Top achievements
Rank 1
Veteran
 asked on 19 Apr 2021
10 answers
364 views

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

Stefan Schmiedl
Top achievements
Rank 2
 answered on 16 Apr 2021
1 answer
457 views

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

 

Martin Ivanov
Telerik team
 answered on 16 Apr 2021
5 answers
395 views
Hello,

I've created a custom theme using the telerik-approach.
Everything seems to work except for the RadRibbonWindow.
I've placed RadRibbonWindow.IsWindowsThemeEnabled = false; in the static constructor.
Does custom theming for RadRibbonWindow require any extra code or is it supported at all?
Dilyan Traykov
Telerik team
 answered on 15 Apr 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?