Telerik Forums
UI for WPF Forum
1 answer
289 views

I am making a test app to measure the loading speed of Windows DataGrid vs RadGrid. In the app I was binding Data Tables and Collections into DataGrid and RadGrid. Binding to the Windows DataGrid I would see and average time of 5ms for DataTables and 1.5ms for Collections. When you bind to RadGrid I get 200-400ms regardless of the type. Any ideas?

<telerik:RadBusyIndicator IsBusy="{Binding Path=IsBusy}">
        <Grid DataContext="{Binding Telerik, Source={StaticResource Locator}}">

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.Resources>
                <Style TargetType="DataGrid">
                    <Setter Property="HorizontalAlignment" Value="Stretch"/>
                    <Setter Property="VerticalAlignment" Value="Stretch"/>
                    <Setter Property="Margin" Value="10"/>
                </Style>
                <Style TargetType="Button">
                    <Setter Property="Width" Value="75"/>
                    <Setter Property="HorizontalAlignment" Value="Center"/>
                    <Setter Property="VerticalAlignment" Value="Center"/>
                    <Setter Property="Margin" Value="10"/>
                </Style>
                <Style TargetType="TextBlock">
                    <Setter Property="Width" Value="75"/>
                    <Setter Property="HorizontalAlignment" Value="Center"/>
                    <Setter Property="VerticalAlignment" Value="Center"/>
                    <Setter Property="Margin" Value="10"/>
                </Style>
                <Style x:Key="TextLabel" TargetType="TextBlock">
                    <Setter Property="HorizontalAlignment" Value="Right"/>
                    <Setter Property="VerticalAlignment" Value="Center"/>
                    <Setter Property="Margin" Value="2"/>
                    <Setter Property="FontWeight" Value="Bold"/>
                </Style>
                <Style x:Key="ToolBarImage" TargetType="Image">
                    <Setter Property="Width" Value="20"/>
                    <Setter Property="Height" Value="20"/>
                    <Setter Property="Margin" Value="1"/>
                </Style>
            </Grid.Resources>
            <ToolBarTray>
                <ToolBar>
                    <Button Command="{Binding ExitCommand}"  ToolTip="Home">
                        <Grid>
                            <Image Source="{StaticResource Home}" Style="{StaticResource ResourceKey=ToolBarImage}"/>
                        </Grid>
                    </Button>
                    <Button Command="{Binding DataCommand}"  ToolTip="Execute" >
                        <Grid>
                            <Image Source="{StaticResource Play}" Style="{StaticResource ResourceKey=ToolBarImage}"/>
                        </Grid>
                    </Button>
                    <Button Command="{Binding ResetCommand}"  ToolTip="Reset">
                        <Grid>
                            <Image Source="{StaticResource Reset}" Style="{StaticResource ResourceKey=ToolBarImage}"/>
                        </Grid>
                    </Button>
                    <Separator/>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Execution Time:" Style="{StaticResource TextLabel}"/>
                        <TextBlock Text="{Binding TimeElapsed, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, StringFormat={}{0:F3} ms}"/>
                    </StackPanel>
                    <Separator/>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Average Time:" Style="{StaticResource TextLabel}"/>
                        <TextBlock Text="{Binding AvgTimeElapsed, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, StringFormat={}{0:F3} ms}"/>
                    </StackPanel>
                    <Separator/>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Times executed: " Style="{StaticResource TextLabel}"/>
                        <TextBlock Text="{Binding ExecutedNum, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"/>
                    </StackPanel>
                </ToolBar>
            </ToolBarTray>
            <telerik:RadGridView Grid.Row="1" Grid.Column="0" ItemsSource="{Binding MoldData}" Name="dataGridView1"/>
            
        </Grid>
    </telerik:RadBusyIndicator>

Dilyan Traykov
Telerik team
 answered on 19 Oct 2018
10 answers
798 views
Hi,
I am using RadTreeView to display the hierarchy such as folders/subfolders and items within them. I have implemented template and style selectors according to the treeview item type But in case that I have a lot of folders (100+) with items in it (10+ items per folder) it take to much time to bind that on UI.
NOTE: folders are expanded by default.
I checked my data access layer and results are retrieved from the database in a decent time, so seems to me that the issue is just on UI side. I checked whether virtualization is working,check the live tree view and saw that there is ~20 folders loaded, even though, according to the current window(container) size there can be visible just 2 expanded folders with their items on the viewable area, so I was suspecting that this could be a cause of some delays because event virtualization is working, tree view loads much more elements than it could display.

Is there any way to handle this?

Also, whenever UI is refreshed I can see in my log exception like:
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; target element is 'ListBoxItem' (Name=''); target property is 'HorizontalContentAlignment' (type 'HorizontalAlignment')

I figured out that it throwing this exception takes some amount of time. I checked the styles and tried to update all suspicious places in code but still getting the same error, so maybe I do not understand the real meaning of that exception. Any thoughts on this error?
Stefan
Telerik team
 answered on 19 Oct 2018
0 answers
79 views

                    Chart.Series.Add(new LineSeries
                    {
                        CategoryBinding = binding,
                        ValueBinding = ...,
                        StrokeThickness = 1,
                        Stroke = ...,
                        ItemsSource = vm.Datas,
                        TrackBallInfoTemplate = // difficult to create
                    }); 

 

TrackBallInfoTemplate is difficult to create, how can i only set a stringformat to use trackballinfo

Si
Top achievements
Rank 1
 asked on 19 Oct 2018
4 answers
438 views

Hello,

I have some of GridViewCheckBoxColumn and GridViewComboBoxColumn that bound to nested property which works perfectly. But when I try to use ExportToXlsx() to export into excel file, result from every columns that bound to nested property are different.

GridViewCheckBoxColumn bound to nested property yields True/False instead of TRUE/FALSE and GridViewComboBoxColumn yields selected value instead of display value which I preferred display value.

Is there anyway to make all columns regardless of nested property binding to be exported in the same format?

 

Here's my sample code

<Window x:Class="WpfApplication3.Window4"
        xmlns:local="clr-namespace:WpfApplication3"
        mc:Ignorable="d"
        Title="Window4" Width="800" Height="300" >
    <StackPanel>
        <telerik:RadGridView Name="grid1" ItemsSource="{Binding GridItemSoure}" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Display" DataMemberBinding="{Binding Display}"/>
                <telerik:GridViewCheckBoxColumn Header="IsChecked" DataMemberBinding="{Binding IsChecked}"/>
                <telerik:GridViewComboBoxColumn Header="SelectedItem" DataMemberBinding="{Binding SelectedItemId}" ItemsSource="{Binding ComboItemSource}" DisplayMemberPath="Display" SelectedValueMemberPath="Id"/>
                <telerik:GridViewDataColumn Header="Amount" DataMemberBinding="{Binding Amount}"/>
                <telerik:GridViewDataColumn Header="This.Display" DataMemberBinding="{Binding This.Display}"/>
                <telerik:GridViewCheckBoxColumn Header="This.IsChecked" DataMemberBinding="{Binding This.IsChecked}"/>
                <telerik:GridViewComboBoxColumn Header="This.SelectedItem" DataMemberBinding="{Binding This.SelectedItemId}" ItemsSource="{Binding ComboItemSource}" DisplayMemberPath="Display" SelectedValueMemberPath="Id"/>
                <telerik:GridViewDataColumn Header="This.Amount" DataMemberBinding="{Binding This.Amount}"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
        <Button Click="Button_Click">Export</Button>
    </StackPanel>
</Window>
public partial class Window4 : Window
{
    public Window4()
    {
        InitializeComponent();
 
        this.DataContext = new
        {
            GridItemSoure = new List<RowItem>()
            {
                new RowItem() { Display = "Row1", IsChecked = true, SelectedItemId = null, Amount = 9.999m },
                new RowItem() { Display = "Row2", IsChecked = false, SelectedItemId = null, Amount = 10000 },
                new RowItem() { Display = "Row3", IsChecked = true, SelectedItemId = 2, Amount = 1/3 },
                new RowItem() { Display = "Row4", IsChecked = false, SelectedItemId = 3, Amount = -1/3 },
            },
            ComboItemSource = new List<Item>()
            {
                new Item() { Id = 1, Display = "Item 1" },
                new Item() { Id = 2, Display = "Item 2" },
                new Item() { Id = 3, Display = "Item 3" },
            },
        };
    }
 
    private void Button_Click(object sender, RoutedEventArgs e)
    {
 
        string extension = "xlsx";
        SaveFileDialog dialog = new SaveFileDialog()
        {
            DefaultExt = extension,
            Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, "Excel Workbook"),
            FilterIndex = 1
        };
        if (dialog.ShowDialog() == true)
        {
            using (Stream stream = dialog.OpenFile())
            {
                grid1.ExportToXlsx(stream, new GridViewDocumentExportOptions()
                {
                    ShowColumnHeaders = true,
                    ShowColumnFooters = true,
                    ShowGroupFooters = true,
                    AutoFitColumnsWidth = true,
                    ExportDefaultStyles = false,
                });
            }
        }
    }
}
 
public class RowItem : INotifyPropertyChanged
{
    private string _Display;
    public string Display
    {
        get { return _Display; }
        set
        {
            this._Display = value;
            OnPropertyChanged(nameof(Display));
        }
    }
 
    private bool _IsChecked;
    public bool IsChecked
    {
        get { return _IsChecked; }
        set
        {
            this._IsChecked = value;
            OnPropertyChanged(nameof(IsChecked));
        }
    }
 
    private int? _SelectedItemId;
    public int? SelectedItemId
    {
        get { return _SelectedItemId; }
        set
        {
            this._SelectedItemId = value;
            OnPropertyChanged(nameof(SelectedItemId));
        }
    }
 
    private decimal? _Amount;
    public decimal? Amount
    {
        get { return _Amount; }
        set
        {
            this._Amount = value;
            OnPropertyChanged(nameof(Amount));
        }
    }
 
    public RowItem This
    {
        get
        {
            return this;
        }
    }
 
    public event PropertyChangedEventHandler PropertyChanged;
 
    private void OnPropertyChanged(string name)
    {
        if (PropertyChanged != null)
            PropertyChanged(this, new PropertyChangedEventArgs(name));
    }
}
 
public class Item : INotifyPropertyChanged
{
    private string _Display;
    public string Display
    {
        get { return _Display; }
        set
        {
            this._Display = value;
            OnPropertyChanged(nameof(Display));
        }
    }
 
    private int? _Id;
    public int? Id
    {
        get { return _Id; }
        set
        {
            this._Id = value;
            OnPropertyChanged(nameof(Id));
        }
    }
 
    public event PropertyChangedEventHandler PropertyChanged;
 
    private void OnPropertyChanged(string name)
    {
        if (PropertyChanged != null)
            PropertyChanged(this, new PropertyChangedEventArgs(name));
    }
}

 

Thanks

Non
Top achievements
Rank 1
 answered on 18 Oct 2018
2 answers
173 views

Hi,

 

I have a huge amount of data, which I don't want to load all into the gridview.

I want to have the following scenario: The user applies filter with the default filtering control. The ViewModel get the FilterDescriptor and request the filtered Data at the DataService. The GridView shows the received data.

I don't want to use the filter for filtering the data bound to the gridview, I want to use it to request filtered data.

 

Moritz

Moritz
Top achievements
Rank 1
 answered on 17 Oct 2018
0 answers
155 views

I've modified the AppointmentItemHorizontalControlTemplate template to include a popup like so:

<ControlTemplate x:Key="AppointmentItemHorizontalControlTemplate" TargetType="telerikScheduleView:AppointmentItem">
        <Grid x:Name="Root">
            <Popup Style="{StaticResource AppointmentPopupStyle}" PlacementTarget="{Binding ElementName=Root}" />
...
</ControlTemplate>

 

The popup shows as expected, however when I try to selected something on the popup by holding down the left mouse button, a drag effect is initiated beneath it that is trying to move the appointment into another slot (e.g when using the Month View definition). Unfortunately no event is received in the popup until after the drag effect is initiated.

 

Is there are a way to cancel the drag effect of the schedule view when the user is interacting with a popup?

fsfsf
Top achievements
Rank 1
 asked on 17 Oct 2018
1 answer
350 views

now the fluent theme use the Aero effect,the background is too clear,

the Acrylic effect is better!

there is a opensource project: https://github.com/sourcechord/FluentWPF

the principal code:

     internal enum AccentState
    {
        ACCENT_DISABLED = 0,
        ACCENT_ENABLE_GRADIENT = 1,
        ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
        ACCENT_ENABLE_BLURBEHIND = 3,
        ACCENT_ENABLE_ACRYLICBLURBEHIND = 4,
        ACCENT_INVALID_STATE = 5
    }

   accent.GradientColor = 0x00FFFFFF;

  

Kalin
Telerik team
 answered on 17 Oct 2018
3 answers
202 views

Hello,

A multi-selection RadComboBoxis integrated into a cell of a RadGridView in the project that is attached.

The problem I have when trying to add a handle to an event to customize the loading of the multiple values of the RadComboBox.

This code does not work ...

FrameworkElementFactory dateFactory = new FrameworkElementFactory (typeof (RadComboBox), "Target");
dateFactory.SetValue (RadComboBox.AllowMultipleSelectionProperty, true);
dateFactory.SetValue (RadComboBox.ItemsSourceProperty, new List <string> {"DBF", "REP"});

                 // Add handler not rule
                 RoutedEventHandler handler = new RoutedEventHandler (LoadedTarget_RadComboBox);
                 dateFactory.AddHandler (RadComboBox.LoadedEvent, handler, true);



On the other hand, if I add the handler outside of a Grid it works correctly

Thanks in advance.

[I'm attaching the test project code concerning the problem]

Dilyan Traykov
Telerik team
 answered on 16 Oct 2018
2 answers
133 views

we are using 2 RadTreeview in of our form in WPF application.

we got a requirement that one RadTreeView will have  only one parent folder like Favoirites.

so whenever any folder is selected by user in another RadTreeview ,then that folder must be added in Favoirites

 

Ex:

RadTreeView1

 Favourites

  --->MyFolder

RadTreeView2

Categories

-->MyFolder

At first Favourites will be empty and when user will select MyFolder it will be getting added into Favourites.

 

Please help me.

 

 

 

Priyatam
Top achievements
Rank 1
 answered on 16 Oct 2018
0 answers
88 views

How can I force data-grid refresh on the Outlook Template for VS2018?

 

At this moment, when I make a change on the cell, I need to close the group and open the group to see the changes.

I am using observablecollection and INotifyPropertyChanges.

 

I saw in some forum that I can force the grid to update, I want to do this with a button which calls on a command function from the command file in the template.

e.g.   DataGridName.Item.Refresh();

But it seems like I can't find the reference to the datagrid at all.

Khoa
Top achievements
Rank 1
 asked on 16 Oct 2018
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?