Telerik Forums
UI for WPF Forum
1 answer
30 views

Hello,

I have an application where the user will drag object values from internal properties within the application into a Spreadsheet control. Think like a CAD package, the user would drag/drop something like circle's radius into a cell. These cells will automatically update as the application updates. I call these dynamic references DynamicDataFields.

The application maintains a collection of these DynamicDataFields. When the user drag/drops these fields from the application into a cell, that cell information is added to the collection.

It is a pretty simple solution and adding hooks for ActiveWorksheetEditor.Commands like Copy, Paste, Cut, Clear. RemoveCellsCommand, etc. - isn't too complicated. 

Basically, the application responds by either,

  1. Adding DynamicDataFields to the collection, or
  2. Removing DynamicDataFields to the collection. 

The biggest thing missing though, is how undo/redo get's handled. I am looking for ways to implement these two actions alongside the built-in undo redo system. Is this something that is possible? Where would I being looking? 

Or does anyone have any better ideas? 

Martin Ivanov
Telerik team
 answered on 05 Feb 2025
1 answer
46 views

None of the examples you guys have or I've been able to find are a solution to what should be an easy problem.  Right-click on a grid row, show the context menu, and when the user selects an items from the context menu, pass the id from the row to the page view model.

I did find this post but because it uses a UI element for the binding path and it uses code behind instead of MVVM, it's not a solution but my code is based on this.

MVVM RadGridView -> RadContextMenu -> RadMenuItem -> CommandParameter: get the row? in UI for WPF | Telerik Forums

Here is my context menu code.

<telerik:RadGridView.RowStyle>
    <Style TargetType="telerik:GridViewRow">
        <Setter Property="telerik:RadContextMenu.ContextMenu">
            <Setter.Value>
                <telerik:RadContextMenu>
                    <telerik:RadMenuItem Header="Open"
                                         Command="{Binding OpenCommand}"
                                         CommandParameter="{Binding Path=.}" />
                    <telerik:RadMenuItem Header="Delete"
                                         Command="{Binding DeleteCommand}"
                                         CommandParameter="{Binding Path=.}" />
                    <telerik:RadMenuItem Header="Print"
                                         Command="{Binding ReportCommand}"
                                         CommandParameter="{Binding Path=.}" />
                </telerik:RadContextMenu>
            </Setter.Value>
        </Setter>
    </Style>
</telerik:RadGridView.RowStyle>

The problem is it thinks the commands are in the view model for the grid row data so I'm getting binding failures. 

DeleteCommand property not found on object of type JobVm.

 

I need to have it use the commands in my page view model.  How can I achieve this?  I've tried dozens of combinations of setting the RelativeSource but none of them seem to work.

 

 

 

 

Stenly
Telerik team
 answered on 03 Feb 2025
1 answer
41 views

    I'm trying to allow for user customization of a grid with as little effort as possible.  In order of priority,

    1. I would like my user to be able to choose which columns are displayed in the grid, and in which order.  I'd really like a pre-built control for this, if one exists.  My vision is a list of all available columns on the left, and, on the right, a re-orderable list of columns being used.
    2. I'd like to do the same with groupings (already easy, but leading up to saving).
    3. The user should be able to set column widths and sort direction (already easy, but leading up to saving).
    4. I'd like to be able to save and restore that information as a user setting.

    Does Telerik have anything pre-built for any of that?  I've looked at the "Control Panel" sample and I don't think that would meet my definition of "little effort".

    Martin Ivanov
    Telerik team
     answered on 03 Feb 2025
    1 answer
    47 views

    I have a simple, classic grid of numerous records with a checkbox column.  I'd like to be able to multi-select records in the grid and then toggle the checkbox.  How would I go about doing that?

    A tiny, working example would be much appreciated!

    Martin Ivanov
    Telerik team
     answered on 03 Feb 2025
    2 answers
    41 views

    Hi,

    I have a ScheduleView where I want it to initially be readonly. But then open for edit by clicking a toggle button.

    Right now I have added the ReadOnlyBehaviour... and I can see how I can remove it.. but adding it back when clicking out of Edit mode is not so clear.

    I had an idea to add a bindable property to my readonlybehaviour like this:

        public class ScheduleViewReadOnlyBehaviour : ReadOnlyBehavior
        {
            private bool _isReadOnly;

            public static readonly DependencyProperty ReadOnlyProperty =
                DependencyProperty.Register(nameof(ReadOnly), typeof(bool), typeof(RadScheduleView),
                    new PropertyMetadata(true, ReadOnlyPropertyChanged));

            private static void ReadOnlyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
            {
                ((ScheduleViewReadOnlyBehaviour)((RadScheduleView)d).ReadOnlyBehavior).ReadOnlyPropertyChanged((bool)e.NewValue);
            }

            private void ReadOnlyPropertyChanged(bool isReadOnly)
            {
                _isReadOnly = isReadOnly;
            }

            public bool ReadOnly
            {
                get { return (bool)GetValue(ReadOnlyProperty); }
                set { SetValue(ReadOnlyProperty, value); }
            }

            public override bool CanSaveAppointment(IReadOnlySettings readOnlySettings, IOccurrence occurrence)
            {
                return false;
            }

            public override bool CanEditAppointment(IReadOnlySettings readOnlySettings, IOccurrence occurrence)
            {
                return false;
            }

            public override bool CanDragAppointment(IReadOnlySettings readOnlySettings, IOccurrence occurrence)
            {
                return false;
            }

            public override bool CanResizeAppointment(IReadOnlySettings readOnlySettings, IOccurrence occurrence)
            {
                return false;
            }

            public override bool CanDeleteAppointment(IReadOnlySettings readOnlySettings, IOccurrence occurrence)
            {
                return false;
            }

            public override bool CanEditSlot(IReadOnlySettings readOnlySettings, Slot slot)
            {
                return false;
            }
        }

    But keep ending up with the GetValue and SetValue methods not found.. obviously missing a point here. Would be a nice clean way of solving this problem.

     And yes, I am aware that I am currently not actually using the value being bound... I see that as the least of my issues.       
    hhgm
    Top achievements
    Rank 1
    Iron
    Iron
    Iron
     answered on 30 Jan 2025
    1 answer
    33 views

    Hi,

    How can I control the background colour of the extended bit of the header in a RadVirtualGrid? See the area circled in red on the screenshot.

    Thanks in advance,

    __Jason

    Martin Ivanov
    Telerik team
     answered on 30 Jan 2025
    1 answer
    31 views

    Hi,

    3 questions please about RadDocking element sizes and positioning.

    It's quite a simple layout: 1 dockable navigation (filters/selection) pane and 1 results/data pane in the document host.

    There can only be 1 tab in each pane but the layout will be used by many different screen types.

    ---------------------------------------------------------------------------------

    1) Is it possible to make the resize strip wider? - it's very narrow and often difficult to find. In the screenshot below I've set the RadPaneGroups' borders to be thick, leaving the obvious and narrow resize strip in between,

     

    ---------------------------------------------------------------------------------

    2) Is it possible to make the compass targets larger - they're very small.

     

    ---------------------------------------------------------------------------------

    3) It it possible to set the dock position programmatically? I've put a simple context menu in the TitleTemplate.

    The first call to this always works but subsequent calls don't do anything:


    private void OnPositionContextMenuClicked(object sender, RoutedEventArgs e)
    {
         DockState ds = (DockState)((MenuItem)sender).Tag;
    
         if(this.NavigationSplitContainer.InitialPosition != ds)
         {
            this.NavigationSplitContainer.InitialPosition = ds;
         }
    }


     

     

    Here's the XAML (a simplified version of the demo code - the panes are injected programatically):


    <UserControl x:Class="DM_Frontend_Views.TwoPaneDockingScreen"
                 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:DM_Frontend_Views"
                 xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                 xmlns:dock="clr-namespace:Telerik.Windows.Controls.Docking;assembly=Telerik.Windows.Controls.Docking"
                 
                 mc:Ignorable="d" 
                 d:DesignHeight="450" d:DesignWidth="800">
        <!-- xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=QuickStart.Common" -->
    
        <UserControl.Resources>
            <ResourceDictionary>
    
                <SolidColorBrush x:Key="ContentForegroundBrush" Color="#FF020202" />
                <SolidColorBrush x:Key="LabelBrush" Color="#767676" />
    
                <DataTemplate x:Key="TitleTemplate">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="20" />
                        </Grid.ColumnDefinitions>
                        <ContentPresenter Content="{Binding}" Margin="0,0,75,0" />
                        <telerik:RadButton Grid.Column="1" x:Name="PositionButton" Content="^" Click="PositionButton_Click">
                            <telerik:RadButton.ContextMenu>
                                <ContextMenu Name="cm" StaysOpen="false">
                                    <MenuItem Header="Left" Tag="{x:Static dock:DockState.DockedLeft}" Click="OnPositionContextMenuClicked"/>
                                    <MenuItem Header="Right" Tag="{x:Static dock:DockState.DockedRight}" Click="OnPositionContextMenuClicked"/>
                                    <MenuItem Header="Up" Tag="{x:Static dock:DockState.DockedTop}" Click="OnPositionContextMenuClicked"/>
                                    <MenuItem Header="Down" Tag="{x:Static dock:DockState.DockedBottom}" Click="OnPositionContextMenuClicked"/>
                                </ContextMenu>
                            </telerik:RadButton.ContextMenu>
                        </telerik:RadButton>
                    </Grid>
                </DataTemplate>
    
                <!-- <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Docking;component/FirstLook/Resources.xaml" />
                </ResourceDictionary.MergedDictionaries> -->
    
            </ResourceDictionary>
        </UserControl.Resources>
    
        <Grid Margin="8 0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
    
            <telerik:RadMenu Grid.Row="0">
                <telerik:RadMenuItem Header="FILE" />
                <telerik:RadMenuItem Header="EDIT" />
                <telerik:RadMenuItem Header="VIEW" />
            </telerik:RadMenu>
    
            <telerik:RadDocking x:Name="RadDocking"
                                RetainPaneSizeMode="DockingAndFloating"
                                CanAutoHideAreaExceedScreen="True"
                                Grid.Row="1" Margin="0 0 0 10"
                                BorderThickness="00"
                                Padding="0"                                                        
                                PreviewShowCompass="RadDocking_PreviewShowCompass">
    
                <!-- Navigation/selection pane -->
                <telerik:RadSplitContainer  MaxWidth="600" telerik:DockingPanel.InitialSize="296,150" MinWidth="300"
                Name="NavigationSplitContainer" InitialPosition="DockedLeft" BorderThickness="0,0,0,0">
                    <telerik:RadPaneGroup x:Name="NavigationPaneGroup" BorderThickness="0,0,20,0">
                        <telerik:RadPane x:Name="NavigationPane" CanUserClose="False" CanFloat="True" CanDockInDocumentHost="False" TitleTemplate="{StaticResource TitleTemplate}" Title="">
                            <telerik:RadPane.Header>
                                <TextBlock FontSize="40" Text="Filters"/>
                            </telerik:RadPane.Header>
                            <telerik:RadPane.Content>
                                <Grid x:Name="NavigationContentGrid">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*"/>
                                        <RowDefinition Height="17.5"/>
                                        <!-- Spacer -->
                                    </Grid.RowDefinitions>
                                </Grid>
                            </telerik:RadPane.Content>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
    
                <!-- Data/results pane -->
                <telerik:RadDocking.DocumentHost>
                    <telerik:RadSplitContainer x:Name="MainSplitContainer" BorderThickness="0,0,0,0">
                        <telerik:RadPaneGroup x:Name="MainPaneGroup" BorderThickness="20,0,0,0">
                            <telerik:RadPane x:Name="MainPane" Header="Main Pane" CanFloat="False" Visibility="Collapsed" CanUserClose="False">
                                <telerik:RadPane.Content>
                                    <Grid x:Name="MainContentGrid">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*"/>
                                            <RowDefinition Height="17.5"/>
                                            <!-- Spacer -->
                                        </Grid.RowDefinitions>
                                    </Grid>
                                </telerik:RadPane.Content>
                            </telerik:RadPane>
                        </telerik:RadPaneGroup>
                    </telerik:RadSplitContainer>
                </telerik:RadDocking.DocumentHost>
    
            </telerik:RadDocking>
        </Grid>
    </UserControl>

    Any advice (maybe regarding Templates/Adorners) would be very much appreciated!

     

    Martin Ivanov
    Telerik team
     answered on 22 Jan 2025
    0 answers
    39 views

     

    Hello,

    I have found a bug in the Track Changes Mode. It also occurs in the latest version (in the demo). To reproduce the bug:

    1. Enable Track Changes mode.
    2. Insert some text, e.g., "Lorem Ipsum is simply dummy text of the printing and typesetting industry."
    3. Wait for a short period (to allow the insertion to occur at different times), approximately 10-15 seconds.
    4. After inserting a word entire the existing text (like on the screenshot), type a character or word, then immediately try to delete the last character using the backspace key. At this point, the error occurs: backspace does not remove the last character, only on the second attempt.

     

     

     

    The error occurs in Telerik WPF 2022.1.222, but in the new version, it still appears, though without throwing exceptions (I checked in the lastest demo, and the last character doesn't delete on the first attempt).

    Can you reproduce this issue, or is it a known problem?

    Is there a solution available?

     

    Emin Sadigov
    Top achievements
    Rank 2
    Iron
    Iron
    Iron
     updated question on 21 Jan 2025
    0 answers
    25 views

    I've been tasked with designing an interactive tutorial for our Desktop application.  I'm not a developer however so I'm not entirely clear on all the capabilities of the Telerik UI.

    I see there is a callout available, which seems ideal but I have a question.  I want to ensure that the person has actually done the thing in the callout.  Is there a option to restrict what the user can select or click on, while running the tutorial?  If they do something different from what the tutorial is asking of them, it could for sure cause problems.

    Jonathan
    Top achievements
    Rank 1
     asked on 17 Jan 2025
    1 answer
    59 views
    Hi,

    I am adding Rows to a RadGridView in the ViewModel while the View is displayed. When the RadGridView runs out of vertical Space, I would like the user to be able to scroll, but scrolling is not possible despite the Scrollbal being visible and Scrolling Enabled.


    <telerik:RadGridView
        ScrollViewer.VerticalScrollBarVisibility="Visible"
        ScrollViewer.CanContentScroll="True"
        telerik:StyleManager.Theme="{StaticResource GreenTheme}"
        ItemsSource="{Binding FilteredMessages}"
        VerticalAlignment="Stretch"
        ScrollMode="RealTime"
        CanUserGroupColumns="False"
        IsReadOnly="True">
    </telerik:RadGridView>

    Martin Ivanov
    Telerik team
     answered on 16 Jan 2025
    Narrow your results
    Selected tags
    Tags
    +? more
    Top users last month
    Anislav
    Top achievements
    Rank 6
    Silver
    Bronze
    Bronze
    Jianxian
    Top achievements
    Rank 1
    Iron
    Marco
    Top achievements
    Rank 3
    Iron
    Iron
    Iron
    Jim
    Top achievements
    Rank 2
    Iron
    Iron
    Nurik
    Top achievements
    Rank 2
    Iron
    Iron
    Want to show your ninja superpower to fellow developers?
    Top users last month
    Anislav
    Top achievements
    Rank 6
    Silver
    Bronze
    Bronze
    Jianxian
    Top achievements
    Rank 1
    Iron
    Marco
    Top achievements
    Rank 3
    Iron
    Iron
    Iron
    Jim
    Top achievements
    Rank 2
    Iron
    Iron
    Nurik
    Top achievements
    Rank 2
    Iron
    Iron
    Want to show your ninja superpower to fellow developers?
    Want to show your ninja superpower to fellow developers?