Telerik Forums
UI for WPF Forum
1 answer
325 views

I have the following XAML

 


<Window x:Class="WpfApp46.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:local="clr-namespace:WpfApp46"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="1200"
        DataContext="{Binding RelativeSource={RelativeSource Self}}">
    <Grid>
        <telerik:RadGridView ItemsSource="{Binding Foos}" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Foo1}" MinWidth="100" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Foo2}" MinWidth="100" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Foo3}" Width="*" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Foo4}" MinWidth="100" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Foo5}" MinWidth="100" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Foo6}" MinWidth="100" />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</Window>

and the following code behind

 


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApp46
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public List<Foo> Foos { get; set; }

        public MainWindow()
        {
            Foos = new List<Foo>()
            {
                new Foo() { Foo1 = "Foo 1", Foo2 = "Foo 2", Foo3 = "Foo 3", Foo4 = "Foo 4", Foo5 = "Foo 5", Foo6 = "Foo 6" },
                new Foo() { Foo1 = "Foo 1", Foo2 = "Foo 2", Foo3 = "Foo 3", Foo4 = "Foo 4", Foo5 = "Foo 5", Foo6 = "Foo 6" },
                new Foo() { Foo1 = "Foo 1", Foo2 = "Foo 2", Foo3 = "Foo 3", Foo4 = "Foo 4", Foo5 = "Foo 5", Foo6 = "Foo 6" },
                new Foo() { Foo1 = "Foo 1", Foo2 = "Foo 2", Foo3 = "Foo 3", Foo4 = "Foo 4", Foo5 = "Foo 5", Foo6 = "Foo 6" },
                new Foo() { Foo1 = "Foo 1", Foo2 = "Foo 2", Foo3 = "Foo 3", Foo4 = "Foo 4", Foo5 = "Foo 5", Foo6 = "Foo 6" },
                new Foo() { Foo1 = "Foo 1", Foo2 = "Foo 2", Foo3 = "Foo 3", Foo4 = "Foo 4", Foo5 = "Foo 5", Foo6 = "Foo 6" },
                new Foo() { Foo1 = "Foo 1", Foo2 = "Foo 2", Foo3 = "Foo 3", Foo4 = "Foo 4", Foo5 = "Foo 5", Foo6 = "Foo 6" },
                new Foo() { Foo1 = "Foo 1", Foo2 = "Foo 2", Foo3 = "Foo 3", Foo4 = "Foo 4", Foo5 = "Foo 5", Foo6 = "Foo 6" },
            };

            InitializeComponent();
        }
    }

    public class Foo
    {
        public string Foo1 { get; set; }
        public string Foo2 { get; set; }
        public string Foo3 { get; set; }
        public string Foo4 { get; set; }
        public string Foo5 { get; set; }
        public string Foo6 { get; set; }
    }
}
why can't I resize the columns "Foo5" and "Foo6"?
Vladimir Stoyanov
Telerik team
 answered on 10 May 2023
1 answer
303 views

Hello.

 

I have the same situation as https://www.telerik.com/forums/virtual-page-count.
Since the database has over 100 million data, I don't want to bring all the data into memory.
When a user clicks on a specific page, I'm trying to get only the data in that range from the DBMS.


I also read about Unbound Mode (https://docs.telerik.com/devtools/wpf/controls/raddatapager/features/unbound-mode)
But this seems to use code-behind.
I don't want to write a code-behind because I use the MVVM pattern.
How can I do it?

 

The code below has been simplified.

 

1. DataView.xaml

<UserControl x:Class="MyProject.Views.MyDataView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:MyProject.Views"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:behaviors="http://schemas.microsoft.com/xaml/behaviors"
             mc:Ignorable="d" 
             d:DesignHeight="550" d:DesignWidth="1920">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="26" />
            <RowDefinition Height="400"/>
            <RowDefinition Height="28" />
        </Grid.RowDefinitions>

        <Grid Grid.Row="0" HorizontalAlignment="Right">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Page Size" Margin="2 8 12 2"  FontWeight="SemiBold"/>

                <telerik:RadComboBox 
                                 Height="22"
                                 Margin="0 0 10 0"
                                 FontFamily="Segoe UI"
                                 ClearSelectionButtonVisibility="Visible" 
                                 ClearSelectionButtonContent="Show all" 
                                 DisplayMemberPath="DisplaySize" 
                                 ItemsSource="{Binding MyDataPageSize}" 
                                 SelectedItem="{Binding SelectedMyDataPageSize}"
                                 AllowMultipleSelection="False"
                                 Command="{Binding RefreshMyDataCommand}"/>
            </StackPanel>
        </Grid>

        <telerik:RadGridView x:Name="MyDataGridView"
                             Grid.Row="1"
                             IsFilteringAllowed="False"
                             AutoGenerateColumns="False"
                             ShowGroupPanel="False"
                             CanUserFreezeColumns="False"
                             RowIndicatorVisibility="Collapsed"
                             SelectionMode="Extended"
                             TextBlock.TextAlignment="Center"
                             CanUserSortColumns="False"
                             IsReadOnly="True"
                             Margin="10 5 10 0"
                             ScrollMode="RealTime"
                             ItemsSource="{Binding DynamicGridViewItemSource}"
        </telerik:RadGridView>

        <telerik:RadDataPager Grid.Row="2"
				x:Name="MyDataPager"
                              Width="{Binding ElementName=MyDataGridView, Path=ActualWidth}"
							  PageSize="{Binding SelectedMyDataPageSize.Size}"
							  Source="{Binding Items, ElementName=MyDataGridView}"
							  ItemCount="{Binding TotalItemCount}"
                              BorderThickness="1,0,1,1"
							  DisplayMode="All"
                              AutoEllipsisMode="Both"
							  NumericButtonCount="10"
							  IsTotalItemCountFixed="False" >
            <behaviors:Interaction.Triggers>
                <behaviors:EventTrigger EventName="PageIndexChanged">
                    <behaviors:InvokeCommandAction Command="{Binding PageIndexChangedCommand}"
                                           CommandParameter="{Binding ElementName=MyDataPager, Path=PageIndex}" />

                </behaviors:EventTrigger>
            </behaviors:Interaction.Triggers>
        </telerik:RadDataPager>
    </Grid>
</UserControl>

 

2. DataViewModel.cs

namespace MyProject.ViewModels
{
    public class StageDTO
    {
        public string StartNumber { get; set; }
        public string EndNumber { get; set; }
    }

    public class MyDataViewModel : ViewModelBase
    {

// some code

        private int _totalItemCount;
        public int TotalItemCount
        {
            get
            {
                return _totalItemCount;
            }
            set
            {
                _totalItemCount = value;
                OnPropertyChanged(nameof(TotalItemCount));
            }
        }

        public MyDataViewModel(CyclerMode mode)
        {
            // do something
        }

        public void ShowMyDataOfSelectedStage(object parameter)
        {
           StageDTO dto = parameter as StageDTO;
 
            // do something

          // and i calculate TotalItemCount here
                TotalItemCount = Convert.ToInt32(dto.EndNumber) - Convert.ToInt32(dto.StartNumber);
           
        }
    }
}

 

There may have been a typo in the process of simplifying, but there is no problem when i actually run the program.

TotalItemCount = Convert.ToInt32(dto.EndNumber) - Convert.ToInt32(dto.StartNumber);

The data goes in correctly in the code above, but nothing changes.

I made the changes below, but it still doesn't work.

ItemCount="{Binding TotalItemCount, UpdateSourceTrigger=PropertyChanged}"

If I change it like below
ItemCount="{Binding TotalItemCount, Mode=TwoWay}"

I am getting an exception like below.
System.InvalidOperationException: 'Setting RadDataPager.ItemCount is allowed in Unbound Mode only.'

 

How do I get it to work like I want?

Vladimir Stoyanov
Telerik team
 answered on 10 May 2023
1 answer
396 views

I have a RadMultiColumnComboBox with AutoCompleteMode="Search". If I type "asdf" into the combo box, close the dropdown without actually selecting an item, and then refresh the page I want to clear "asdf", but I cannot figure out how to clear this text. I have tried setting the selected Item to null, setting AutoCompleteProvider.SearchText to an empty string, and setting the selected index to -1. 

What am I doing wrong?

Martin Ivanov
Telerik team
 answered on 10 May 2023
1 answer
141 views

Hi,

I would like to create a docking layout with 4 controls spread over 2 rows as in the attached image. I achieved this result using compass, but I need to create the same layout by design.

Thank you

Luigi

 

Stenly
Telerik team
 answered on 05 May 2023
1 answer
135 views

Hi. I have some question.

An exception occurred while debugging the ExecutiveDashboard demo source code.

exception text : 
System.InvalidOperationException: 'An error occurred while processing this request.'
DataServiceTransportException: The request was aborted: Could not create SSL/TLS secure channel.
WebException: The request was aborted: Could not create SSL/TLS secure channel.



An error occurred while downloading and installing the ExecutiveDashboard demo app(setup.exe).

install.log : 
The following properties have been set:
Property: [AdminUser] = true {boolean}
Property: [InstallMode] = HomeSite {string}
Property: [NTProductType] = 1 {int}
Property: [ProcessorArchitecture] = AMD64 {string}
Property: [VersionNT] = 10.0.0 {version}
Running checks for package '.NET Desktop Runtime 6.0.1 (x64)', phase BuildList
Checking conditions before installer checks for command 'net6desktopruntime_x64\windowsdesktop-runtime-6.0.1-win-x64.exe'
Result of running operator 'ValueNotEqualTo' on property 'ProcessorArchitecture' and value 'AMD64': false
Result of checking conditions before installer checks for command 'net6desktopruntime_x64\windowsdesktop-runtime-6.0.1-win-x64.exe' is: No action
Running external check with command 'C:\Users\jmkim\AppData\Local\Temp\VSD29A9.tmp\net6desktopruntime_x64\NetCoreCheck.exe' and parameters 'Microsoft.WindowsDesktop.App 6.0.1'
Process exited with code 0
Setting value '0 {int}' for property 'NetCoreCheck'
The following properties have been set for package '.NET Desktop Runtime 6.0.1 (x64)':
Property: [NetCoreCheck] = 0 {int}
Running checks for command 'net6desktopruntime_x64\windowsdesktop-runtime-6.0.1-win-x64.exe'
Result of running operator 'ValueNotEqualTo' on property 'ProcessorArchitecture' and value 'AMD64': false
Result of running operator 'VersionLessThan' on property 'VersionNT' and value '6.1.0': false
Result of running operator 'ValueEqualTo' on property 'NetCoreCheck' and value '0': true
Result of checks for command 'net6desktopruntime_x64\windowsdesktop-runtime-6.0.1-win-x64.exe' is 'Bypass'
'.NET Desktop Runtime 6.0.1 (x64)' RunCheck result: No Install Needed
Launching Application.
URLDownloadToCacheFile failed with HRESULT '-2146697208'
Error: An error occurred trying to download 'http://demos.telerik.com/wpf/executivedashboard/ExecutiveDashboard.application'.

 

The same problem occurred with the SalesDashboard demo source code and app.

What caused the problem?


Martin Ivanov
Telerik team
 answered on 05 May 2023
0 answers
98 views

Hello!

I need to make a custom separate scrollbar for RadGridView.

Please tell me how can I know if some of the rows of the RadGridView are already out of area of ​​visibility and how can I find out what part of the rows is visible and position of the part of the rows?

 

Vsevolod
Top achievements
Rank 1
Iron
Iron
 asked on 04 May 2023
0 answers
136 views

Hi,

I was not able to find this answer on the forum. It looks like a simple thing to do but I was not able to understand it.

I have three RadTreeView with the following xaml options: (IsDragDropEnabled="True" AllowDrop="True" telerik:ScrollingSettingsBehavior.IsEnabled="False" IsDragTooltipEnabled="False") . All three Trees have 2 level of data of 2 different type of objects. 

The drop of an item might be allowed or not, depending on a combination on:

  • the origin tree of the Drag (tree 1, 2 or 3)
  • the type of object selected (level 1 or level 2)
  • the target tree (tree 1,2 or 3)
  • the drop position (inside, after, before)

As an example, the level 2 objects of tree 1 cannot be dropped on tree 3, while on tree 2 the can only be dropped inside the level 1, or before/after the level 2 (not inside level 2).

I implemented all the controls to allow this behaviour in the handler of "DragDropManager.AddDropHandler", in which when the drop is not allowed I simply have that the DropAction = DropAction.None and everything is working fine.

However what I would like to have is that when the drop is not supposed to be allowed, the drop preview should not be visible. by drop preview I mean the line in between items when the drop position is after/before or the highlight of the target item when the drop position is inside. Note that I still would like to keep the drag preview of the source item,  and that I disabled the dragtooltip as not of interest.

I considered using the handler "DragDropManager.AddDragInitializeHandler" to set the AllowDrop to false for all the correct items, however sometimes (like in the example above) I want to disable the drop only for certain drop positions, thus the item AllowDrop property cannot be set to false at the beginning of the drag. 

What I think I should do is to use the handler "DragDropManager.AddDragOverHandler", in which I check if the drop is feasible. If it is not, I somehow disable the drop preview, if it is allowed, i enable it once again. This is where I'm stuck.

Considering the variable var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;

If after checking that the drop is not allowed I set options.DropTargetItem.AllowDrop = false, the visual result is exactly what I need. However, from that moment on the handler "DragDropManager.AddDragOverHandler" does not fire anymore on that Item, so I cannot set it again to true.

If instead I set options.DropTargetItem.IsDropAllowed = false; nothing happens.

I tried to play with the dragvisual property, setting as an example the  dragVisual.IsDropPossible = false, but it doesn't change the result (I guess that this property is only for the dragtooltip that I disabled)

Note that, if possible, I also do not want to override the drop position from the not allowed to the allowed one, like suggested in the documentation (https://docs.telerik.com/devtools/wpf/controls/radtreeview/how-to/drag-and-drop/enabled-drop-inside-only). 

           

Could you please suggest me how to proceed? Please let me know if you need more information.

Thanks in advance for your help.

 

 

Antonino
Top achievements
Rank 1
Iron
 asked on 03 May 2023
1 answer
102 views
How can I, for example, when clicking on a specific button, make its event open or display me a window or page in a new tab item dynamically, and all I have to do is select the page or window to display and it moves me to it and opens it inside a new tab item just like the Google Chrome browser
Stenly
Telerik team
 answered on 03 May 2023
1 answer
135 views

Hello,

We have performance issues on a WPF application. We did some analysis using dotTrace (attached screenshot) where we saw that the method Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(Size) is causing quite some delay. 

Are there any ways to get this more up to speed ?

Thanks !

Martin Ivanov
Telerik team
 answered on 03 May 2023
0 answers
128 views

Hi Telerik Team,

We are using RadMaskedCurrencyInput inside RadGridView as RowDetailTemplate. But the performance is very poor, as it takes nearly 100 milliseconds for each number typing.

Also, it takes 2 to 4 seconds when we perform Select All and typing the number.

This happens only if the control is placed inside the RadGridView.

We have the same control outside the RadGridView for testing purpose which performs good.

Please let me know if any optimization can be done with this.

Below are the code we are using.

<tk:RadMaskedCurrencyInput

                    maskedInput:MaskedInputExtensions.MaxTextLength="5"

                    maskedInput:MaskedInputExtensions.Minimum="0"

                    FontSize="12"

                    FontWeight="DemiBold"

                    IsCurrencySymbolVisible="False"

                    Mask=""

                    SpinMode="None"

                    TextMode="PlainText" />

 

I'm not able to attach the video file here.
Thank You.

Premkumar
Top achievements
Rank 1
Iron
Iron
 asked on 02 May 2023
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
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
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
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?