Telerik Forums
UI for WPF Forum
2 answers
171 views

Hello,

 

it seems that having a RadPane with a binding for its IsPinned property needs to bound with Mode=TwoWay for it to work. Why is this? The problem comes more apparent when I'm using (in the real application) binding to a ViewModel that gets converted through a (Multi)ValueConverter. If I have to have the binding mode be TwoWay I have to implement the ConvertBack method of IValueConverter and have it return something like null, even though I only want the model converted one way. I absolutely do not want the pinned/unpinned status of the RadPane having any influence on my model.

 

Also, it seems the ConvertBack is only called once at the start of the program or when the actual pin/unpin icon is pressed. And this is very bad when we have the TextBox binding. If I write a string longer than 5 characters into it, the pane opens. If I then unpin the pane, the TextBox is cleared because the converter returns null!

 

Below is a repro of the problem, standard WPF .NET 4.7.2 project with only the Telerik nugets added. Clicking the checkbox Pane 1 does nothing. The checkbox Pane 2 pins/unpins Pane 2 because it is bound with Mode=TwoWay. The same can be seen with the textbox. When typing a string more than 5 characters in length, the last pane opens if the binding mode is TwoWay.

 

My MainWindow.xaml

01.<Window x:Class="TelerikDockingIsPinned.MainWindow"
06.        xmlns:local="clr-namespace:TelerikDockingIsPinned"
07.        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
08.        mc:Ignorable="d"
09.        Title="MainWindow" Height="450" Width="800">
10. 
11.    <Window.Resources>
12.        <local:TextLengthConverter x:Key="TextLenConverter" />
13.    </Window.Resources>
14. 
15.    <Grid>
16.        <Grid.RowDefinitions>
17.            <RowDefinition Height="Auto"/>
18.            <RowDefinition Height="*"/>
19.        </Grid.RowDefinitions>
20. 
21.        <StackPanel Orientation="Horizontal">
22.            <CheckBox x:Name="Pane1Pinned" Content="Pane 1"/>
23.            <CheckBox x:Name="Pane2Pinned" Content="Pane 2"/>
24.            <TextBox x:Name="Pane3Pinned" MinWidth="100"/>
25.        </StackPanel>
26. 
27.        <telerik:RadDocking Grid.Row="1">
28.            <telerik:RadSplitContainer>
29.                <telerik:RadPaneGroup>
30.                    <telerik:RadPane Header="Pane 1" IsPinned="{Binding ElementName=Pane1Pinned, Path=IsChecked}"/>
31.                    <telerik:RadPane Header="Pane 2" IsPinned="{Binding ElementName=Pane2Pinned, Path=IsChecked, Mode=TwoWay}"/>
32.                    <telerik:RadPane Header="Pane 3" IsPinned="{Binding ElementName=Pane3Pinned, Path=Text, Converter={StaticResource TextLenConverter}, Mode=TwoWay}"/>
33.                </telerik:RadPaneGroup>
34.            </telerik:RadSplitContainer>
35.        </telerik:RadDocking>
36.    </Grid>
37.</Window>

 

and the converter:

01.using System;
02.using System.Globalization;
03.using System.Windows.Data;
04. 
05.namespace TelerikDockingIsPinned {
06.    class TextLengthConverter : IValueConverter {
07.        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
08.            return (value is string) && ((string)value).Length > 5;
09.        }
10. 
11.        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
12.            Console.WriteLine("ConvertBack called");
13. 
14.            return null;
15.        }
16.    }
17.}
Rami
Top achievements
Rank 1
Veteran
 answered on 10 Nov 2020
1 answer
208 views

Hi all,

Is it possible to display icons for child items of a navigation view in a data-bound hierarchy scenario? I'm following the documentation at https://docs.telerik.com/devtools/wpf/controls/radnavigationview/populating-with-data/hierarchical-databinding but also in this example the icons are missing for child items (even if them are defined in the example data model).

Thanks.

Martin Ivanov
Telerik team
 answered on 09 Nov 2020
4 answers
273 views

After trying the First Look exemple code, there is something I did not find.

If we want to store the control content to a database or any data storage, we can look at the DataContext.Data to get back all the cards.
State property is well corresponding to the new column for exemple.

But how to know in which orders they are now sorted. There is no "Order" / "Index" / "Position" property we can bind ?

Without this info it is difficult to redraw later the same board in the same state.

Is there a way to get this information

 

Thanks

Patrick
Top achievements
Rank 1
 answered on 09 Nov 2020
1 answer
87 views

Hi,

we are currently tweaking the initial loading performance of a RadDiagram with >1000 Shapes and >5000 Connections. According to the attached DotTrace profiler run, we are spending a good amount of time (~5 seconds) within the function "UpdateFocusedElement" which intuitively seems unnecessary during the initial load of a diagram.

Would you agree that this call is unnecessary during initial load and if so could you suggest a way to temporarily suppress or work around this to improve loading time?

Thanks in advance!

Regards

Petar Mladenov
Telerik team
 answered on 09 Nov 2020
2 answers
283 views

I'm using RadGlyph with the FontAwesome library and it works great. I register the font in my App.xaml - OnStartup  and when I run my application the icons load correctly and look crisp and clear. 

The issue is in the Visual Studio designer RadGlyph complains constantly that the 'Font family FontAwsome is not registered'. This breaks parts of the UI designer and add these errors to the Error List make it look a lot worse than it is and makes finding real errors harder. 

My question is, how do I register the custom font in away that RadGlyph can detect it in the designer or can I turn off the detection of this error altogether? I don't need to see the icon in the designer I just want to clean up the error messages. 

 

Thanks,

Richard

Richard
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 09 Nov 2020
8 answers
147 views

Hello everyone.

I have shell WinForms application that hosts WPF User Control contains RadDocking. When I drag RadPane, a RootCompass indicators of RadDocking shows in wrong location (see attachment). It looks like indicators shows without offset of embedded WPF Control relatively shell WinForms application.

Is it bug? Or maybe is there a way to change a location of RootCompass indicators? 

 

Thank you.

Shrikant
Top achievements
Rank 1
 answered on 06 Nov 2020
1 answer
485 views

Hello.

I want add ToolTip on GridViewHeaderCell, column created in code as

column = new GridViewDataColumn
                {
                    ColumnGroupName = args.ColumnDef.ColumnGroupName,                
                    DataMemberBinding = new Binding(args.ColumnDef.Member)
                    {
                        Mode = BindingMode.TwoWay,
                        UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                    },
                    IsReadOnlyBinding = new Binding(args.ColumnDef.IsReadOnlyMember)
                    {
                        Converter = new NullToBooleanConverter {IsInverted = true}
                    },
                    Header = args.ColumnDef.Header,
                    HeaderCellStyle = TryFindResource("DataHeaderCellStyle") != null ? (Style)Resources["DataHeaderCellStyle"] : new Style(typeof(GridViewHeaderCell)),

                    IsVisible = true,
                    IsFilterable = false,
                };

                if (args.ColumnDef.ToolTip != null)
                    column.ToolTip = new ToolTip { Content = args.ColumnDef.ToolTip };

 

in xaml i added style

<Style x:Key="DataHeaderCellStyle" BasedOn="{StaticResource GridViewHeaderCellStyle}" TargetType="telerik:GridViewHeaderCell">
            <!--<Setter Property="ToolTipService.ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Content.Column.ToolTipText, Mode=OneWay}" />-->
            <Setter Property="ToolTip" Value="{Binding Content, RelativeSource={RelativeSource Self}}"/>
                <Setter Property="HorizontalContentAlignment" Value="Center"/>
                <Setter Property="TextWrapping" Value="Wrap"/>
                <Setter Property="FontSize" Value="12"/>
</Style>

 

If use <Setter Property="ToolTipService.ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Content.Column.ToolTipText, Mode=OneWay}" /> or <Setter Property="ToolTipService.ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Content.ToolTipText, Mode=OneWay}" /> this is don't work, no tooltip.

If use <Setter Property="ToolTip" Value="{Binding Content, RelativeSource={RelativeSource Self}}"/> (seen here https://www.telerik.com/forums/tooltip-on-column-title) content of GridViewHeaderCell will be lost (on attachement).

How need set tooltip in style property?

If add event subscribe (as here https://www.telerik.com/forums/radgridview---tooltip-for-dynamically-created-column), will work...

ctor

{

    InitializeComponent();
    EventManager.RegisterClassHandler(typeof(GridViewHeaderCell), GridViewHeaderCell.MouseEnterEvent, new RoutedEventHandler(OnMouseEnterEvent));
}

        private void OnMouseEnterEvent(object sender, RoutedEventArgs e)
        {
            if (sender is GridViewHeaderCell cell && cell.Column.ToolTip != null)
            {
                cell.ToolTip = cell.Column.ToolTip;
            }
        }

Martin Ivanov
Telerik team
 answered on 05 Nov 2020
11 answers
280 views

The performance of the property grid isn't great, and it appears that the performance degrades on some scenarios.

We are placing the property grid inside a RadDocking. The pane itself has the IsHidden bound to a property, since the software is an IDE and depending on the type of the active document, we either show a toolbox and  / or a property grid.

 

I can see with dotTrace that something is leaking (The weakevent listener is raising the handler more time than it should).

 

Code:

MainWindow.xaml:

<Window x:Class="RadPropertyGridPerformanceIssue1.MainWindow"
        xmlns:local="clr-namespace:RadPropertyGridPerformanceIssue1"
        Title="MainWindow" Height="350" Width="525" x:Name="self">
     
    <Grid>
        <telerik:RadDocking>
            <telerik:RadSplitContainer telerik:DockingPanel.InitialSize="228,650"
                    Name="RightContainer" InitialPosition="DockedRight" Orientation="Vertical">
                <telerik:RadPaneGroup>
                    <telerik:RadPane CanUserClose="False" x:Name="propertiesPane" Header="Properties Window"
                                     CanDockInDocumentHost="False" telerik:RadDocking.SerializationTag="Properties"
                                     DataContext="{Binding ElementName=self, Path=DataContext}"
                                     IsHidden="{Binding ElementName=self, Path=IsHidden, Mode=TwoWay}">
                        <local:PropertiesControl DataContext="{Binding}" />
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
        </telerik:RadDocking
        <StackPanel HorizontalAlignment="Left">
            <Button Click="Button_Click">Toggle Visibility</Button>
            <Button Click="Button_Click_1">Toggle Selected Item</Button>
        </StackPanel>
    </Grid>
</Window>

 

MainWindow,cs

public partial class MainWindow : Window
{
    private bool isItemSet = false;
 
    public object Item
    {
        get { return (object)GetValue(ItemProperty); }
        set { SetValue(ItemProperty, value); }
    }
 
    // Using a DependencyProperty as the backing store for Item.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty ItemProperty =
        DependencyProperty.Register("Item", typeof(object), typeof(MainWindow), new UIPropertyMetadata(null));
 
 
 
    public bool IsHidden
    {
        get { return (bool)GetValue(IsHiddenProperty); }
        set { SetValue(IsHiddenProperty, value); }
    }
 
    // Using a DependencyProperty as the backing store for IsHidden.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty IsHiddenProperty =
        DependencyProperty.Register("IsHidden", typeof(bool), typeof(MainWindow), new UIPropertyMetadata(false));
 
     
     
    public MainWindow()
    {
        InitializeComponent();
        this.DataContext = this;
    }
 
    private void Button_Click(object sender, RoutedEventArgs e)
    {
        IsHidden = !IsHidden;
    }
 
    private void Button_Click_1(object sender, RoutedEventArgs e)
    {
        if (!isItemSet)
            Item = new MyObject();
        else
            Item = null;
 
        isItemSet = !isItemSet;
    }
}

 

MyObject:

public class MyObject
    {
 
        [Display(Name = "Name1", GroupName = "Details1", Order = 5, Prompt = "tttt"), Browsable(true)]
        public string Name1 { get; set; }
 
        [Display(Name = "Name2", GroupName = "Details1", Order = 5, Prompt = "tttt"), Browsable(true)]
        public string Name2 { get; set; }
 
        [Display(Name = "Name3", GroupName = "Details2", Order = 5, Prompt = "tttt"), Browsable(true)]
        public string Name3 { get; set; }
 
        [Display(Name = "Name4", GroupName = "Details2", Order = 5, Prompt = "tttt"), Browsable(true)]
        public string Name4 { get; set; }
 
        [Display(Name = "Name5", GroupName = "Details2", Order = 5, Prompt = "tttt"), Browsable(true)]
        public string Name5 { get; set; }
 
        [Display(Name = "Name6", GroupName = "Details2", Order = 5, Prompt = "tttt"), Browsable(true)]
        public string Name6 { get; set; }
 
        [Display(Name = "Name7", GroupName = "Details2", Order = 5, Prompt = "tttt"), Browsable(true)]
        public string Name7 { get; set; }
 
        [Display(Name = "Name8", GroupName = "Details2", Order = 5, Prompt = "tttt"), Browsable(true)]
        public string Name8 { get; set; }
 
        [Display(Name = "Name9", GroupName = "Details2", Order = 5, Prompt = "tttt"), Browsable(true)]
        public string Name9 { get; set; }
 
        [Display(Name = "Name10", GroupName = "Details2", Order = 5, Prompt = "tttt"), Browsable(true)]
        public string Name10 { get; set; }
 
        [Display(Name = "Name11", GroupName = "Details3", Order = 6, Prompt = "tttt"), Browsable(true)]
        public string Name11 { get; set; }
 
        [Display(Name = "Name12", GroupName = "Details3", Order = 6, Prompt = "tttt"), Browsable(true)]
        public string Name12 { get; set; }
 
        [Display(Name = "Name13", GroupName = "Details3", Order = 6, Prompt = "tttt"), Browsable(true)]
        public string Name13 { get; set; }
 
        [Display(Name = "Name14", GroupName = "Details3", Order = 6, Prompt = "tttt"), Browsable(true)]
        public string Name14 { get; set; }
 
        [Display(Name = "Name15", GroupName = "Details3", Order = 6, Prompt = "tttt"), Browsable(true)]
        public string Name15 { get; set; }
 
        [Display(Name = "Name16", GroupName = "Details3", Order = 6, Prompt = "tttt"), Browsable(true)]
        public string Name16 { get; set; }
 
        [Display(Name = "Name17", GroupName = "Details4", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name17 { get; set; }
 
        [Display(Name = "Name18", GroupName = "Details4", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name18 { get; set; }
 
        [Display(Name = "Name19", GroupName = "Details4", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name19 { get; set; }
 
        [Display(Name = "Name20", GroupName = "Details4", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name20 { get; set; }
 
        [Display(Name = "Name21", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name21 { get; set; }
 
        [Display(Name = "Name22", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name22 { get; set; }
 
        [Display(Name = "Name23", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name23 { get; set; }
 
        [Display(Name = "Name24", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name24 { get; set; }
 
        [Display(Name = "Name25", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name25 { get; set; }
 
        [Display(Name = "Name26", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name26 { get; set; }
 
        [Display(Name = "Name27", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name27 { get; set; }
 
        [Display(Name = "Name28", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name28 { get; set; }
 
        [Display(Name = "Name29", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name29 { get; set; }
 
        [Display(Name = "Name30", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name30 { get; set; }
 
        [Display(Name = "Name31", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name31 { get; set; }
 
        [Display(Name = "Name32", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name32 { get; set; }
 
        [Display(Name = "Name33", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name33 { get; set; }
 
        [Display(Name = "Name34", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name34 { get; set; }
 
        [Display(Name = "Name35", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name35 { get; set; }
 
        [Display(Name = "Name36", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name36 { get; set; }
 
        [Display(Name = "Name37", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name37 { get; set; }
 
        [Display(Name = "Name38", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name38 { get; set; }
 
        [Display(Name = "Name39", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name39 { get; set; }
 
        [Display(Name = "Name40", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name40 { get; set; }
 
        [Display(Name = "Name41", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name41 { get; set; }
 
        [Display(Name = "Name42", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name42 { get; set; }
 
        [Display(Name = "Name43", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name43 { get; set; }
 
        [Display(Name = "Name44", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name44 { get; set; }
 
        [Display(Name = "Name45", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name45 { get; set; }
 
        [Display(Name = "Name46", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name46 { get; set; }
 
        [Display(Name = "Name47", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name47 { get; set; }
 
        [Display(Name = "Name48", GroupName = "Details5", Order = 7, Prompt = "tttt"), Browsable(true)]
        public string Name48 { get; set; }
    }

 

PropertiesControl.xaml:

<UserControl x:Class="RadPropertyGridPerformanceIssue1.PropertiesControl"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerk="http://schemas.telerik.com/2008/xaml/presentation"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <telerk:RadPropertyGrid Item="{Binding Item}" DescriptionPanelVisibility="Collapsed"/>
    </Grid>
</UserControl>

 

If you click the first button and then the second button over and over again, then you would notice that the property grid becomes slower and slower, and that the Telerik.Windows.Data.WeakEvent+WeakListener`1.Handler() is being called more than once, event though OnCollectionChanged was called only once.

 

On Telerik 2016.Q2 the problem was even worse. The OnCollectionChanged would be called as the number of properties the object has.

 

 

 

 

BENN
Top achievements
Rank 1
 answered on 05 Nov 2020
1 answer
123 views

Hi,

 

I am storing the user changes in the PDF viewer for multiple PDFs.

For zoom, there is the ScaleFactorChanged event.

It seems there is no event exposed for Rotation, like RotationChanged?

How is it possible to store the information when the user changes the rotation?

 

As a workaround, I now check the rotation with :

 DetailPdfViewer.CommandDescriptors.RotateClockwiseCommandDescriptor.Command.CanExecuteChanged += OnRotationChanged;

and then get DetailPdfViewer.RotationAngle, but this seems really hacky to me. It just triggers to often, so I do not like having this in production too long.

 

Best regards,

Kevin

Dimitar
Telerik team
 answered on 05 Nov 2020
4 answers
202 views

Hello,

I am having an issue with reordering multiple selected items in a RadListBox. I am trying to select multiple items in a RadListBox, and drag them within the same RadListBox to reorder them. However, it doesn't always work. When I start to drag, sometimes I will be able to reorder the items (cursor indicator and drop visual indicator in the RadListBox show normally), and sometimes it won't. The drag visual always works normally, but it looks like AllowDrop is immediately false sometimes (not sure if that is what is actually happening, but it's the best way I can describe it). I have a test RadListBox for theme visual feedback and testing, and the behavior is happening there. Here is the code I am using:

<telerik:RadListBox SelectionMode="Extended">
    <telerik:RadListBoxItem Content="Item 1"
                    Style="{DynamicResource ReorderableListItemStyle}"/>
    <telerik:RadListBoxItem Content="Item 2"
                    Style="{DynamicResource ReorderableListItemStyle}"/>
    <telerik:RadListBoxItem Content="Item 3"
                    Style="{DynamicResource ReorderableListItemStyle}"/>
    <telerik:RadListBoxItem Content="Item 4"
                    Style="{DynamicResource ReorderableListItemStyle}"/>
    <telerik:RadListBoxItem Content="Item 5"
                    Style="{DynamicResource ReorderableListItemStyle}"/>
    <telerik:RadListBoxItem Content="Item 6"
                    Style="{DynamicResource ReorderableListItemStyle}"/>
    <telerik:RadListBoxItem Content="Item 7"
                    Style="{DynamicResource ReorderableListItemStyle}"/>
    <telerik:RadListBoxItem Content="Item 8"
                    Style="{DynamicResource ReorderableListItemStyle}"/>
    <telerik:RadListBox.DragDropBehavior>
        <telerik:ListBoxDragDropBehavior/>
    </telerik:RadListBox.DragDropBehavior>
</telerik:RadListBox>

 

And here is the code for ReorderableListItemStyle:

<Style x:Key="ReorderableListItemStyle"
    TargetType="telerik:RadListBoxItem"
    BasedOn="{StaticResource RadListBoxItemStyle}">
    <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True" />
</Style>

 

Is there something I am missing? I am using Telerik WPF R3 2020.

Dinko | Tech Support Engineer
Telerik team
 answered on 05 Nov 2020
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?