Telerik Forums
UI for WPF Forum
1 answer
75 views

Hey guys,

 

I like the way the ColumnsSelectionButton looks on the right side of the group panel.  Instead of using it for selection, would there be a way to easily reuse this control to show/hide the associated column?

 

Thanks!

Craig
Top achievements
Rank 1
 answered on 06 Feb 2020
6 answers
477 views

Hello,

We have a performance issue with RadGridView when using telerik's grouping.

For example:

Sorting can take about 4 seconds. while sorting without grouping, lasts less then a second.

The same issue happens when clearing the ItemSource and then use AddRange of several items.

The JetBrains dotTrace shows that most of the time spent in "Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(size)"  - 2471 milliseconds. The same operation lasts 79 Milliseconds without grouping.

We defined the gridview with the following:

GroupRendererMode = "Flat"

VirtualizingPanel.IsVirtualizingWhenGrouping = "True"

VirtualizingPanel.IsVirtualizing = "True"

VirtualizingPanel.VirtualizationMode= "Recycling"

EnableRowVirtualization="True"

EnableColumnVirtualization="True"

In addition,  the height and the columns width are fixed size.

We hope you can help us.
Thank you in advance.

 

 

Dilyan Traykov
Telerik team
 answered on 05 Feb 2020
3 answers
375 views

Hi dear Telerik Team,

I have a problem with the positioning as context menu.

I would like to show the menu at mouse position. But it appears somewhere else.
See screenshot. The mouse was over the green box. 
The screenshot is taken from your xaml examples.

Mouse and MousePoint have the same problem.

How can I solve this.

Vladimir Stoyanov
Telerik team
 answered on 05 Feb 2020
6 answers
230 views
I use a very general image creation method to create multiple images for a report.
This method doesn't yet work with RadMap because there are unfinished animations (Zooming, ...(?)) and the OpenStreetMap data isn't loaded and shown yet

Questions:
1) Can I disable the RadMap animations and get an eventcall when the map loading and creation process is finished?
   Or is there even a better way to implement it?
2) Is it possible to use something like a cache for the openStreetMap data during my report creation
3) Is it possible to use the OpenStreetMapProvider offline?


image creation method:
var outerGrid = CreateNewViewAndSetDataContextCreateViewInGrid(myDataContext);
outerGrid.Width = width;
outerGrid.Height = height;
outerGrid.Measure(new Size(width, height));
outerGrid.Arrange(new Rect(0, 0, width, height));
outerGrid.UpdateLayout();
var renderTargetBitmap = new RenderTargetBitmap(
   (int)width,
   (int)height,
   96,
   96,
   System.Windows.Media.PixelFormats.Pbgra32);
renderTargetBitmap.Render(outerGrid);
var bitmapEncoder = new PngBitmapEncoder();
bitmapEncoder.Frames.Add(BitmapFrame.Create(renderTargetBitmap));
return bitmapEncoder;



RadMap Code:
<telerik:RadMap x:Name="Map" MiniMapExpanderVisibility="Collapsed">
    <telerik:RadMap.Provider>
        <telerik:OpenStreetMapProvider x:Name="MapProvider"/>
    </telerik:RadMap.Provider>
    <telerik:VisualizationLayer x:Name="LayerInMap"/>
</telerik:RadMap>


RadMap Code Behind:
this.DataContextChanged += /* set map properties. e.g. fill visualization layer with charts */

Vladimir Stoyanov
Telerik team
 answered on 05 Feb 2020
3 answers
179 views

I'm running into the following issue with RadRichTextBox and the RadRichTextBoxRibbonUI. I have a simple xaml file with just a RadRichTextBoxRibbonUI and a RadRichTextBox. I run the app and type some text in the RadRichTextBox editor. It shows up in the font displayed in the RadRichTextBoxRibbonUI. The problem occurs if I want to change the font of subsequent text. If I go to the font control and change the font, the font control retains focus. If I click back into the RadRichTextBox control to type some text, the font reverts to the font currently in the control and Ignores the font that I had selected in the font control. For comparison, when I do the same thing in MS Word, the editor retains focus so that after you've changed the font you can just start typing and the new text is displayed in the newly selected font. Is there a way to get this behaviour with RadRichTextBoxRibbonUI and RadRichTextBox?

 

Thanks for your attention,

George

Dimitar
Telerik team
 answered on 05 Feb 2020
1 answer
118 views

Can someone please inform me how you can set this type of control either in xaml or code behind to be in TypeOver mode rather than Insert mode?

I have searched the web and can't seem to find anything...

Petar Mladenov
Telerik team
 answered on 05 Feb 2020
6 answers
239 views
Hello,

I am binding the ItemsSource of a RadToolbarTray to a ViewModel property to create one or more toolbars dynamically via the following.

<telerik:RadToolBarTray telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled="True"
                        ItemsSource="{Binding MergedToolbarCommands}"
                        x:Name="ToolbarTray">
    <telerik:RadToolBarTray.ItemTemplate>
        <DataTemplate>
            <telerik:RadToolBar ItemsSource="{Binding}"
                                OverflowMode="AsNeeded">
                <telerik:RadToolBar.ItemContainerStyle>
                    <Style TargetType="{x:Type ContentPresenter}">
                        <Setter Property="ToolBar.OverflowMode" Value="Never" />
                    </Style>
                </telerik:RadToolBar.ItemContainerStyle>
            </telerik:RadToolBar>
        </DataTemplate>
    </telerik:RadToolBarTray.ItemTemplate>
</telerik:RadToolBarTray>

Unfortunately, the ToolbarTray is not displayed. When I inspect it with Snoop, I notice that all my Toolbars have their DataContexts set correctly and Snoop correctly renders each one individually, but the RadToolbarTray measures itself to have zero height, so it is not displayed. How do I get The RadToolbarTray to measure itself correctly?

Cheers,

Mike
Petar Mladenov
Telerik team
 answered on 04 Feb 2020
10 answers
273 views
I have databound RadTreeViewItem.IsExpanded in my item container style, but when the item is created, it ignores the binding (which is set to true) and sets the property to false.  I found another thread in the forum describing the same behavior happening with the IsChecked property.

Call stack:

  Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.RadTreeViewItem.IsExpanded.set(bool value) Line 390 C#
> Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.RadTreeViewItem.OnIsExpandedChanged(bool oldValue, bool newValue) Line 1186 C#
  Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.RadTreeView.RestoreContainerProperties(object item, Telerik.Windows.Controls.RadTreeViewItem treeViewItem) Line 678 C#

Martin Ivanov
Telerik team
 answered on 04 Feb 2020
2 answers
132 views

I am trying to create custom Shape and custom ContainerShape.
I have successfully customized Shape.
But I am having a problem with customizing ContainerShape.

Below is code snippet for Model, .xaml and .cs.
When I set targetType of <style> to either Telerik:RadDiagramShape or Telerik:RadDiagramContainerShape, things work fine.
If I set CustomShape to targetType, this also works fine.
But, if I set CustomContainerShape to targetType, an error seems to occur when graphSource.AddNode(node) is excuted and StyleSelector returns Style, with InvalidOperationException error, and program terminates.

In the below code, FlowItemNode is okay. But FlowGroupNode is causing an error.
Even when I am using FlowGroupNode, if I set targetType of <style> to Telerik:RadDiagramContainerShape, it works okay.
 
I want to use CustomContainerShape so that I can implement or customize Drag and Drop(ex: drag entered, on drag, dropped) within CustomContainerShape class.
 
What am I doing wrong and How can I achieve this?

Thanks in advance.

//Selector
Class DiagramShapeSelector : StyleSelector
{
 Public override Style SelectStyle(object item, DependencyObject container)
 {
  If(item is FlowItemNode)
  {
   Return ForShapeStyle
  }
  Else if (item if FlowGroupNode)
  {
   Return ForGroupShapeStyle
  }
 }
}


 Code
//Model for shape
public class FlowItemNode : FlowItemViewModel, IDiagramNode
{
    ......
}
 
//Model for containerShape
Public Class FlowGroupViewModel<DiagramNode> : FlowItemViewModel, IContainerItem
{
}
Public class FlowGroupNode : FlowGroupViewModel<IDiagramNode>, IDiagramNode
{
    ......
}

 xaml
<local:CustomDiagram
ShapeStyleSelector = {StaticResource DiagramShapeSelector}
……
/>
<Style x:Key="ForShapeStyle" TargetType="telerik:RadDiagramContainerShape">
    <Setter Property="Position" Value="{Binding Position, Mode=TwoWay}" />
</Style>
 
<Style x:Key="ForGroupShapeStyle" TargetType="diagram:CustomContainerShape">
    <Setter Property="Position" Value="{Binding Position, Mode=TwoWay}" />
</Style>
 .cs
//Selector
Class DiagramShapeSelector : StyleSelector
{
 Public override Style SelectStyle(object item, DependencyObject container)
 {
  If(item is FlowItemNode)
  {
   Return ForShapeStyle
  }
  Else if (item if FlowGroupNode)
  {
   Return ForGroupShapeStyle
  }
 }
}
// CustomRadDiagram
    public class CustomDiagram : RadDiagram
    {
        protected override bool IsItemItsOwnShapeContainerOverride(object item)
        {
            if (item is FlowItemNode)
            {
                return item is CustomContainerShape;
            }
            else return item is CustomShape;
        }
        protected override Telerik.Windows.Diagrams.Core.IShape GetShapeContainerForItemOverride(object item)
        {
            if (item is FlowItemNode)
            {
                return new CustomContainerShape(this);
            }
            else return new CustomShape(this);
        }
    }
 
// CustomShape
   public class CustomShape : RadDiagramShape
    {
        public CustomShape(CustomDiagram diagram)
        {
        }
    }
 
// CustomContainershape
   public class CustomConnection : RadDiagramConnection
    {
        public CustomConnection(CustomDiagram diagram)
        {
        }
    }

Jaeho
Top achievements
Rank 1
 answered on 04 Feb 2020
4 answers
185 views

Hello.

Sorry for my "English" :)

VirtualGrid was added in xaml markup and it was subscribed to OverlayBrushesNeeded using EventToCommandBehavior.

<telerik:RadVirtualGrid
                    Name="VirtualGrid"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Top"
                    telerik:StyleManager.Theme="Office2016"
                    CanUserInsertRows="False"
                    CanUserEdit="True"
                    InitialRowCount="10"
                    InitialColumnCount="10"
                    MeasureTextOnRender="True"
                    DataProvider="{Binding DataProvider}"
                    LinesVisibility="Both"
                    CanUserSortColumns="False"
                    CanUserFilterColumns="False"
                    RowHeaderWidth="0"
                    ColumnWidth="150"
                    Grid.Column="2">
                    <telerik:RadVirtualGrid.ContextMenu>
                        <ContextMenu ItemsSource="{Binding ContextMenuModel.Items}" ></ContextMenu>
                    </telerik:RadVirtualGrid.ContextMenu>
                    <telerik:EventToCommandBehavior.EventBindings>
                        <telerik:EventBinding PassEventArgsToCommand="True" Command="{Binding VirtualGridOverlayBrushesNeeded}"
                                              EventName="OverlayBrushesNeeded"/>
                        <telerik:EventBinding PassEventArgsToCommand="True" Command="{Binding VirtualGridCellDecorationsNeeded}"
                                              EventName="CellDecorationsNeeded" />
                    </telerik:EventToCommandBehavior.EventBindings>
                </telerik:RadVirtualGrid>     

 

 

There are 2 commands in my ViewModel.

public ICommand VirtualGridCellDecorationsNeeded
{
    get => _virtualGridCellDecorationsNeeded;
}
 
public ICommand VirtualGridOverlayBrushesNeeded
{
    get => _virtualGridOverlayBrushesNeeded;
}

 

_virtualGridCellDecorationsNeeded = new Telerik.Windows.Controls.DelegateCommand(OnCellDecorationsNeeded);
_virtualGridOverlayBrushesNeeded = new Telerik.Windows.Controls.DelegateCommand(OnOverlayBrushesNeeded);
public void OnCellDecorationsNeeded(object sender)
 {
     if(sender is CellDecorationEventArgs args)
     {
         if(args.ColumnIndex % 2 == 0)
         {
             args.Background = Brushes.Red;
             args.Foreground = Brushes.Black;
             args.CellTextAlignment = TextAlignment.Left;
         }
         else
         {
             args.Background = Brushes.Yellow;
             args.Foreground = Brushes.Red;
             args.CellTextAlignment = TextAlignment.Left;
         }
     }
 }
 
 public void OnOverlayBrushesNeeded(object sender)
 {
     if (sender is OverlayBrushesEventArgs args)
     {
         args.Brushes.Add(Brushes.Red);
         args.Brushes.Add(Brushes.Yellow);
     }
 }

 

CellDecorationsNeeded is triggered, but OverlayBrushesNeeded is not, which makes it impossible to set colors for cells. Please tell me what I'm doing wrong.

Sergey
Top achievements
Rank 2
 answered on 04 Feb 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?