Telerik Forums
UI for WPF Forum
1 answer
280 views

Hi Telerik team,

We are having a rad-combo box control implemented in a pop up, where the user will be able to select one item from the list based on the Alphabets entered by the User.

Let us consider the user is entering 'OLI' in the combo box
The drop down list appears for the entered Alphabets, but when the user tries to add more Alphabet to it, already entered 'OLI' gets cleared and the user entered new alphabets is appearing, which should not.

I have attached the image(RadCombo box Focus Issue.jpeg)
We found that as soon as the user stops entering the Alphabet, the control selects the whole Alphabets already entered(Blue Selection). - which should not and the user have to press the Right Arrow to get the focus to the last alphabet to add more alphabet the existing text.

Any Possibility to change the behavior so that when the user stops entering the alphabet the focus is set next of the last character entered.

The Xaml Code Used is

<telerik:RadComboBox
                    Name="NameCombo"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center"
                    HorizontalContentAlignment="Left"
                    BorderBrush="#F1F1F1"
                    EmptyText="Type to Search Name"
                    IsDropDownOpen="{Binding IsDropDownOpen, Mode=TwoWay}"
                    IsEditable="True"
                    IsTextSearchCaseSensitive="False"
                    Text="{Binding NameSearchText, Mode=TwoWay}"
                    TextSearchMode="Contains">
                    <telerik:RadComboBoxItem>
                        <telerik:RadComboBoxItem.Template>
                            <ControlTemplate>
                                <Grid>
                                    <telerik:RadBusyIndicator BusyContent="Loading..." IsBusy="{Binding IsNameLoading}">
                                        <telerik:RadGridView
                                            Width="455"
                                            MaxHeight="150"
                                            behavior:ControlEventsCommand.RadGridSelectionChangedEvent="{Binding NameSelectionChangedCommand}"
                                            AutoGenerateColumns="False"
                                            CanUserFreezeColumns="False"
                                            CanUserInsertRows="False"
                                            CanUserResizeColumns="False"
                                            CanUserSortColumns="False"
                                            IsFilteringAllowed="False"
                                            IsReadOnly="True"
                                            ItemsSource="{Binding NameList}"
                                            RowIndicatorVisibility="Collapsed"
                                            ScrollViewer.VerticalScrollBarVisibility="Auto"
                                            SelectedItem="{Binding SelectedName, Mode=OneWayToSource}"
                                            ShowGroupPanel="False">
                                            <telerik:RadGridView.Columns>
                                                <telerik:GridViewDataColumn
                                                    Width="450"
                                                    Header="Name"
                                                    HeaderCellStyle="{StaticResource NameClassHeader}">
                                                    <telerik:GridViewColumn.CellTemplate>
                                                        <DataTemplate>
                                                            <TextBlock
                                                                Text="{Binding Name}"
                                                                TextTrimming="WordEllipsis"
                                                                ToolTip="{Binding Name}"
                                                                ToolTipService.IsEnabled="True"
                                                                ToolTipService.ShowOnDisabled="False">
                                                                <TextBlock.Style>
                                                                    <Style TargetType="TextBlock">
                                                                        <Style.Triggers>
                                                                            <DataTrigger Binding="{Binding Name}" Value="">
                                                                                <Setter Property="IsEnabled" Value="False" />
                                                                            </DataTrigger>
                                                                        </Style.Triggers>
                                                                    </Style>
                                                                </TextBlock.Style>
                                                            </TextBlock>
                                                        </DataTemplate>
                                                    </telerik:GridViewColumn.CellTemplate>
                                                </telerik:GridViewDataColumn>
                                            </telerik:RadGridView.Columns>
                                        </telerik:RadGridView>
                                    </telerik:RadBusyIndicator>
                                </Grid>
                            </ControlTemplate>
                        </telerik:RadComboBoxItem.Template>
                    </telerik:RadComboBoxItem>
                </telerik:RadComboBox>

Thanks In Advance!

Regards,

KishoreKumar

Dinko | Tech Support Engineer
Telerik team
 answered on 15 Sep 2021
1 answer
170 views

Hi,

I want to call different functions based on RadSaveFileDialog's FilterIndex but I'm having trouble getting the correct FilterIndex when trying to save a file. The filter shows up correctly on the dialog but whenever I click Save button, the dialog's FilterIndex is 0, instead of the expected values 1 or 2.

Using the same code, FilterDialog correctly gets set with Windows SaveFileDialog. Is there a known issue with this or could this be related to not setting the Owner property?

Thanks!

Vladimir Stoyanov
Telerik team
 answered on 15 Sep 2021
1 answer
120 views

I have setup a diagram using the Sugiyama Layout.  I have added  50  Rounded Rectangle shapes (without connectors)  in code behind.  I  am using the  following code to size the shapes to fit the diagram:

 Rect allShapesBounds = Diagram1.Shapes.GetEnclosingBounds();
 Rect inflatedRect = allShapesBounds.InflateRect(10, 10, 10, 10);
 Diagram1.BringIntoView(inflatedRect, false);
When I use the mouse to drag a shape into a different position, I would like all the other shapes compensate and adjust to :
  1. Allow the moved shape to fit in without over lapping
  2. Adjust to fill the empty spot

In the attached image Before.png you will see the 50 shapes all sized and lined up correctly.  The After.png shows I moved the shape with the #1 is overlapping the others and there is a space where it used to reside.  I tried calling the above code in the drag event handler but that returns the moved shape to it's original position.  What do I need to do to achieve the results listed above?

 
Martin Ivanov
Telerik team
 answered on 15 Sep 2021
1 answer
937 views

Hi Team ,

 

I am new to WPF , we are using RadGridView to load data from View Model in WPF by using C# .

if selected a row and data grid refreshed or load with new items(rows) then selected row position is moving either up or down to row .

here vertical scroll bar position changed .

 

reproduce steps

1. Select any of the row from the grid.

2. Wait for the Lobby updates to happen and new tables get added to the grid

 

Expected:

  • The select state should be anchored to its grid position, updates should happen above and below the selected row (the selected row will not move)

XAML : 

<telerik:RadGridView x:Name="PokerX_CashGames_RadGridView_LobbyGrid" ItemsSource="{Binding CashGamesCollection, UpdateSourceTrigger=PropertyChanged}"
                       SelectedItem="{Binding SelectedTableItem, Mode=TwoWay,  UpdateSourceTrigger=PropertyChanged}"  Loaded="OnDataGridLoaded" Unloaded="OnDataGridUnloaded"
                       AutomationProperties.AutomationId="PokerX_CashGames_RadGridView_LobbyGrid">
        <i:Interaction.Behaviors>

xaml.cs

private void OnDataGridDataUpdated(object datagridUpdateEventArgs)
        {
            if (datagridUpdateEventArgs is DataGridUpdateEvent eventArgs && this.PokerX_CashGames_RadGridView_LobbyGrid != null)
            {
                double scrollOffset = (eventArgs.CurrentIndexOfSelectedRecord - eventArgs.PreviousIndexOfSelectedRecord) * this.PokerX_CashGames_RadGridView_LobbyGrid.RowHeight;
                GridViewScrollViewer scrollViewer = this.PokerX_CashGames_RadGridView_LobbyGrid.ChildrenOfType<GridViewScrollViewer>().First();
                if (scrollViewer != null)
                {
                    double verticalOffset = scrollViewer.VerticalOffset;
                    scrollViewer.ScrollToVerticalOffset(verticalOffset + scrollOffset);

                    
                }
            }
        }

Please help me how can i fix this .

Martin Ivanov
Telerik team
 answered on 15 Sep 2021
1 answer
202 views
Hi I just installed a MS Security Update.

Windows 10 KB5005033 -  https://support.microsoft.com/en-au/topic/august-10-2021-kb5005033-os-builds-19041-1165-19042-1165-and-19043-1165-b4c77d08-435a-4833-b9f7-e092372079a4

Now I get this ugly Telerik Error.  any ideas?  thx



Must be non-negative and less than the size of the collection. Parameter name: index at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) at Telerik.Windows.Controls.RadComboBoxAutomationPeer.RaiseSelectionEvents(SelectionChangedEventArgs e) at System.Windows.Controls.Primitives.Selector.SelectionChanger.End() at System.Windows.Controls.Primitives.Selector.SelectionChanger.SelectJustThisItem(ItemInfo info, Boolean assumeInItemsCollection) at System.Windows.Controls.Primitives.Selector.OnSelectedIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType) at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at Flom2K18.Truckbook.btnRepeat_Click(Object sender, RoutedEventArgs e) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.Controls.Primitives.ButtonBase.OnClick() at System.Windows.Controls.Button.OnClick() at Telerik.Windows.Controls.RadButton.OnClick() at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonDown(MouseButtonEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) 
Dilyan Traykov
Telerik team
 answered on 14 Sep 2021
1 answer
123 views

Hi Telerik Team,

I have some few question regarding telerik:RadMaskedDateTimeInput Control

telerik:RadMaskedDateTimeInput:
I have a telerik:RadMaskedDateTimeInput Control which has a default date as 08/09/21. We want to change the date to 31/10/2021.
When the user enters 31 in the date field, the control is taking the month into consideration and changing the date automatically to 30 since there is no 31 in the month of September
So first I have to change the month field and then date field to get the new proposed date 31/10/2021.
Any Possibility to change the behaviour.

The property I have used is 
        <telerik:RadMaskedDateTimeInput
          Culture="{x:Static globalization:CultureInfo.InvariantCulture}"
          DataContext="{Binding Path=UiArrivalDateObject, Mode=TwoWay}"
          FontSize="10"
          InputBehavior="Replace"
          IsClearButtonVisible="False"
          Mask="dd/MM/yy HH:mm"
          PreviewKeyDown="RadMaskedDateTimeInput_PreviewKeyDown"
          SectionsNavigationMode="Cycle"
          SelectionOnFocus="CaretToBeginning"
          TextMode="PlainText"
          UpdateValueEvent="PropertyChanged"
          Value="{Binding Path=LiveDateBerth, Mode=TwoWay, UpdateSourceTrigger=LostFocus, Converter={StaticResource DateTimeOffsetToDateTimeConverter}}">
</telerik:RadMaskedDateTimeInput>

Thanks In Advance
Regards,
Kishore Kumar

                          
Dinko | Tech Support Engineer
Telerik team
 answered on 14 Sep 2021
1 answer
231 views

I'm using a RadGrid / GridView and the performance is horrible. 

I'm not doing anything fancy. I have 15 columns and about 2000 rows 

In HTML, this is piece of cake, blazing fast and 200hz when scrolling. 

in WPF this just sucks at 5 fps and a very laggy experience.

I'm reading through the optimization docs and there are somewhat 50+ nobs to turn in the hope that it makes a difference. 

 

My humble request is therefore : Some Telerik Application Analyzer that scans through the program and finds all the problematic settings or constructions that hurt performance. 

I guess it should be pretty simple to look at container element properties and instance properties of the RadGrid and tell the user which ones are hurting the performance or disabling scroll virtualization... coz i have no idea. 

PS. One of the performance tips are completely impossible to correct: 

  • Placing RadGridView in panels/controls which measure it with infinity disables the UI virtualization mechanism of the control and can greatly impact performance when dealing with large amounts of data. Examples of such panels include ScrollViewerStackPanel and Grid with a definition with Width/Height set to Auto.

MANY UI-elements use Grid in their internal workings: 

MainWindow - uses a Grid with height/width = auto
AdornerDecorator - uses a Grid with height/width = auto
Rootgrid - uses a Grid with height/width = auto
TabControl - uses a Grid with height/width = auto
TabItem - uses a Grid with height/width = auto
Border (Contentpresenter) - uses a Grid with height/width = auto
RadBusyIndicator - uses a Grid with height/width = auto

So how the heck am i supposed to correct all those problems without completely going insane and create a stinking pile of code ? 

Dinko | Tech Support Engineer
Telerik team
 answered on 14 Sep 2021
0 answers
130 views

I want to draw a custom MajorLinesVisibility XY. 

MajorLinesVisibility Not using XY, instead, when CategoricalAxis' PlotMode is BetweenTicks,

I want to draw vertical lines between items.
Please refer to the referenced image.

 

<telerik:RadCartesianChart x:Name="chart1" Palette="Flower" Margin="10">
            <telerik:RadCartesianChart.HorizontalAxis>
                <!--PlotMode="BetweenTicks"-->
                <telerik:CategoricalAxis  x:Name="catAxis" PlotMode="BetweenTicks"  />
            </telerik:RadCartesianChart.HorizontalAxis>
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis x:Name="verticalAxis" />
            </telerik:RadCartesianChart.VerticalAxis>

           <telerik:RadCartesianChart.Grid>
                <telerik:CartesianChartGrid MajorLinesVisibility="XY" />
            </telerik:RadCartesianChart.Grid>
            <telerik:RadCartesianChart.Annotations>
                <telerik:CartesianGridLineAnnotation Axis="{Binding ElementName=catAxis}"
                   Value="B"   Stroke="Red"   StrokeThickness="5"       />
            </telerik:RadCartesianChart.Annotations>

yoochul
Top achievements
Rank 1
 updated question on 14 Sep 2021
1 answer
294 views

No video is shown when the camera starts and calling the TakeSnapshot method results in an exception in PresentationCore.CriticalFromVisual, with the message "parameter v cannot be null'.  

I've provided a simple test app that reproduces the problem. Platform is Windows 10, and the app is a .NET 5.0 WPF app using the latest Telerik UI for WPF nuget package. I have tried AnyCPU, x64 and x86 and the behavior is the same for all configurations, both release and debug. 

I have tested on a desktop machine with a Logitech 910 webcam and on a Surface Pro 3 using the internal camera. The identical code works fine on WPF .NET Framework 4.7.2 on both devices.

Project file is attached. 

Here is the window xaml:

 

<Window x:Class="cameratest.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:cameratest"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        mc:Ignorable="d"
        Title="MainWindow"
        Height="450"
        Width="800">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Button Width="80"
                Margin="4"
                HorizontalAlignment="Left"
                Click="OnSnapClick">Snap</Button>
        <telerik:RadWebCam Grid.Row="1"
                           x:Name="radWebCam" />
    </Grid>
</Window>


And the code behind:


using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Media.Imaging;
using Telerik.Windows.Controls;
using Telerik.Windows.MediaFoundation;

namespace cameratest
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            radWebCam.SnapshotTaken += RadWebCamOnSnapshotTaken;
            radWebCam.CameraError += RadWebCamOnCameraError;
        }

        private void RadWebCamOnCameraError(object sender, CameraErrorEventArgs e)
        {
            Debug.WriteLine(e.Error.Message);
        }

        private void RadWebCamOnSnapshotTaken(object sender, SnapshotTakenEventArgs e)
        {
            BitmapSource snapshot = e.Snapshot;
        }

        private void OnSnapClick(object sender, RoutedEventArgs e)
        {
            radWebCam.TakeSnapshot();
        }
    }
}

 

Modifying the app to disable auto start and initialize and state the camera manually results in the same problem.

 

 

Stenly
Telerik team
 answered on 13 Sep 2021
1 answer
151 views

I'm trying to use the VirtualGrid to show a collection of read-only  "record" objects in a report.  The problem is that each "record" is just a List<object> whose count and types are not know until runtime.  The column titles are stored separately in a different list of field descriptors.
 

I tried the CellValueNeeded approach (i.e. without using any sort of  DataSource, custom or otherwise), and while my data showed up just fine in the grid, I had no titles on the columns.  There doesn't seem to be any way to set the titles with this approach that I can see.  There is no corresponding ColumnTitleNeeded event, no SetColumnTitle function and no collection of columns I can access.  At least not that I can see  

 So how do I set the column titles in code behind?

(I should add that I also tried the Custom DataSource approach I looked at your VirtualGrid_WPF example in the SDK, but that seems to rely on the fact that each object representing a record ("Club" in the example) has property names and types that areknown at build time.    I could not make it work at all.   )

Joe
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 12 Sep 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?