Hi,
in the SDK sample, there is a "GridSorting" project which sort on the original collection
How can I implement sorting and filtering using ICollectionView (sort the parent task, and children task also)
The attached is the sample project with basic implementation of sort with ICollectionView, which is not working
Thanks and Best regards
private
void textBoxWidth_KeyDown(object sender, KeyEventArgs e)
{
if (textBoxWidth.ContentText.Length > 1)
{
textBoxWidth.ContentText = 9;
textBoxWidth.Value = 9;
}
}
Thanks.
Hi,
I have a WPF application with SpellChecker integrated with RadRichTextBox. The Richtextbox has a long content and is displayed in multiple pages and i need to achieve the below 3 things
1) SpellChecker highlights the word that needs to be changed but it does not not properly scroll to the next mispelled word which is on the next page.
2) The 'Not in Dictionary' section of the SpellChecker does not allow editing the wording there itself similar to MS Word.
3) SpellChcker not not go to the top of the page if we are at the bottom of the page.
Please help on how to achieve this.
Hi Telerik,
I'm using a RadDiagram with a custom RadDiagramConnection :
<
Style
TargetType
=
"diagramscontrols:RadDiagramConnection"
x:Key
=
"RadDiagramConnectionStyle_RotateText"
>
<
Setter
Property
=
"StrokeThickness"
Value
=
"1"
/>
<
Setter
Property
=
"HorizontalContentAlignment"
Value
=
"Stretch"
/>
<
Setter
Property
=
"VerticalContentAlignment"
Value
=
"Stretch"
/>
<
Setter
Property
=
"FocusVisualStyle"
Value
=
"{x:Null}"
/>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik:RadDiagramConnection"
>
<
Grid
x:Name
=
"RootTemplate"
MinHeight
=
"0"
HorizontalAlignment
=
"Stretch"
>
<
VisualStateManager.VisualStateGroups
>
<
VisualStateGroup
x:Name
=
"SelectionStates"
>
<
VisualState
x:Name
=
"Selected"
/>
<
VisualState
x:Name
=
"SelectedInGroup"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"SelectedInGroupPath"
Storyboard.TargetProperty
=
"Visibility"
Duration
=
"0"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"Unselected"
/>
<
VisualState
x:Name
=
"SelectedAsGroup"
/>
</
VisualStateGroup
>
<
VisualStateGroup
x:Name
=
"EditMode"
>
<
VisualState
x:Name
=
"NormalMode"
/>
<
VisualState
x:Name
=
"NormalEditMode"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetName
=
"NormalContent"
Storyboard.TargetProperty
=
"Visibility"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Collapsed</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetName
=
"EditContent"
Storyboard.TargetProperty
=
"Visibility"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"TextBoxEditMode"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetName
=
"NormalContent"
Storyboard.TargetProperty
=
"Visibility"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Collapsed</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetName
=
"EditTextBox"
Storyboard.TargetProperty
=
"Visibility"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
</
VisualStateGroup
>
</
VisualStateManager.VisualStateGroups
>
<
Path
x:Name
=
"DeferredPath"
Stroke
=
"{TemplateBinding Stroke}"
Opacity
=
"0.7"
Fill
=
"{TemplateBinding Background}"
StrokeThickness
=
"{TemplateBinding StrokeThickness}"
StrokeDashArray
=
"2 2"
/>
<
Path
x:Name
=
"SelectedInGroupPath"
Visibility
=
"Collapsed"
Stroke
=
"Green"
/>
<
Path
Stroke
=
"{TemplateBinding Stroke}"
Fill
=
"{TemplateBinding Background}"
StrokeThickness
=
"{TemplateBinding StrokeThickness}"
x:Name
=
"GeometryPath"
StrokeDashArray
=
"{TemplateBinding StrokeDashArray}"
/>
<
Grid
x:Name
=
"EdittingElement"
RenderTransformOrigin
=
"0.5 0.5"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
>
<
Grid.LayoutTransform
>
<
RotateTransform
>
<
RotateTransform.Angle
>
<
MultiBinding
Converter
=
"{StaticResource PointsToAngleConverter}"
>
<
Binding
Path
=
"StartPoint"
RelativeSource
=
"{RelativeSource AncestorType=telerik:RadDiagramConnection}"
/>
<
Binding
Path
=
"EndPoint"
RelativeSource
=
"{RelativeSource AncestorType=telerik:RadDiagramConnection}"
/>
<
Binding
ElementName
=
"DeferredPath"
Path
=
"Data"
/>
</
MultiBinding
>
</
RotateTransform.Angle
>
</
RotateTransform
>
</
Grid.LayoutTransform
>
<
Border
Background
=
"Transparent"
/>
<
TextBlock
x:Name
=
"NormalContent"
Foreground
=
"{TemplateBinding Foreground}"
FontFamily
=
"{TemplateBinding FontFamily}"
FontSize
=
"{TemplateBinding FontSize}"
Text
=
"{TemplateBinding Content}"
TextAlignment
=
"{Binding Tag.TextAlignement, RelativeSource={RelativeSource AncestorType=diagramscontrols:RadDiagramConnection}}"
HorizontalAlignment
=
"{Binding Tag.HorizontalTextAlignement, RelativeSource={RelativeSource AncestorType=diagramscontrols:RadDiagramConnection}}"
VerticalAlignment
=
"Center"
>
<
TextBlock.Margin
>
<
MultiBinding
Converter
=
"{StaticResource MarginConverter}"
>
<
Binding
Path
=
"StartPoint"
RelativeSource
=
"{RelativeSource AncestorType=telerik:RadDiagramConnection}"
/>
<
Binding
Path
=
"EndPoint"
RelativeSource
=
"{RelativeSource AncestorType=telerik:RadDiagramConnection}"
/>
<
Binding
Path
=
"ActualHeight"
RelativeSource
=
"{RelativeSource Self}"
/>
</
MultiBinding
>
</
TextBlock.Margin
>
</
TextBlock
>
<
ContentPresenter
x:Name
=
"EditContent"
Visibility
=
"Collapsed"
Content
=
"{TemplateBinding Content}"
ContentTemplate
=
"{TemplateBinding EditTemplate}"
/>
<
TextBox
x:Name
=
"EditTextBox"
Visibility
=
"Collapsed"
>
<
TextBox.InputBindings
>
<
KeyBinding
Key
=
"Enter"
Command
=
"ApplicationCommands.NotACommand"
/>
</
TextBox.InputBindings
>
</
TextBox
>
</
Grid
>
</
Grid
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
To save my diagram, I'm using this code :
Dim
pathDiagram
As
String
= myDiagram.Save()
Dim
xml_doc
As
XDocument = XDocument.Parse(pathDiagram)
The problem is that I want to save the HorizontalAlignement of the text in my custom RadDiagramConnection, and I don't know how I can do this.
For custom TextShape, the HorizontalAlignement is saved, like in the attached picture.
Do you know how I can add the save of HorizontalAlignement property during Diagram saving ?
Thank you.
Valentin.
Hi All,
I created a custom gridview which inherit from radgridview. And I have a ControlPanelItem which include a toggle button, The button has IsFilteringAllowed property. It works correctly when the gridview Visible.
But when the gridview initially collapsed a binding error occured in output.
"Cannot find source for binding with reference 'ElementName=grid'. BindingExpression:Path=IsFilteringAllowed; DataItem=null; target element is 'ToggleButton' (Name=''); target property is 'IsChecked' (type 'Nullable`1')"
This is my control xaml
<UserControl x:Class="DemoApplication.CustomGridView"
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:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="300"
x:Name="grid">
<Grid>
<telerik:RadGridView>
<telerik:RadGridView.ControlPanelItems>
<telerik:ControlPanelItem ButtonTooltip="Allow Filtering">
<telerik:ControlPanelItem.ButtonContent>
<ToggleButton IsChecked="{Binding IsFilteringAllowed, ElementName=grid}"
Width="16"
Height="16"
MinWidth="16"
MinHeight="16"
Padding="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderThickness="0">
</ToggleButton>
</telerik:ControlPanelItem.ButtonContent>
</telerik:ControlPanelItem>
</telerik:RadGridView.ControlPanelItems>
</telerik:RadGridView>
this is xaml.cs
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 DemoApplication
{
/// <summary>
/// Interaction logic for CustomGridView.xaml
/// </summary>
public partial class CustomGridView : UserControl
{
public CustomGridView()
{
InitializeComponent();
}
//
// Summary:
// Gets or sets a value indicating whether the control can be filtered through
// the UI.
public static readonly DependencyProperty IsFilteringAllowedProperty =
DependencyProperty.Register("IsFilteringAllowed", typeof(Boolean), typeof(CustomGridView));
public Boolean IsFilteringAllowed
{
get { return (Boolean)GetValue(IsFilteringAllowedProperty); }
set { SetValue(IsFilteringAllowedProperty, value); }
}
}
}
</Grid>
</UserControl>
and this is my view
<Window x:Class="DemoApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DemoApplication"
Title="MainWindow"
Height="350"
Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
<local:CustomGridView x:Name="grid"
Visibility="Collapsed" />
</Button>
</Grid>
</Window>
Thanks
Hi,
on my data grids I have implemented the functionality to do an save and load the layout, reset the layout to default and to do an export to Excel. This is done by a ContextMenu defined in a style, which works fine.
<Setter Property="ContextMenu">
<Setter.Value>
<ContextMenu>
<MenuItem Header="Export to Excel" Command="{Binding ExportToExcelCmd}" CommandParameter="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Mode=FindAncestor, AncestorLevel=1, AncestorType={x:Type ContextMenu}}}">
<MenuItem.Icon>
<Image Source="/Resources/Icons/Excel.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save grid layout" Command="{Binding SaveDataGridLayoutCmd}" CommandParameter="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Mode=FindAncestor, AncestorLevel=1, AncestorType={x:Type ContextMenu}}}">
<MenuItem.Icon>
<Image Source="/Resources/Icons/Save.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Load grid layout" Command="{Binding LoadDataGridLayoutCmd}" CommandParameter="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Mode=FindAncestor, AncestorLevel=1, AncestorType={x:Type ContextMenu}}}">
<MenuItem.Icon>
<Image Source="/Resources/Icons/Refresh.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Reset grid layout" Command="{Binding ResetDataGridLayoutCmd}" CommandParameter="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Mode=FindAncestor, AncestorLevel=1, AncestorType={x:Type ContextMenu}}}">
<MenuItem.Icon>
<Image Source="/Resources/Icons/Refresh.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</Setter.Value>
</Setter>
Recently I discoverd the ControlPanel control. I copied/paste the code from the demo to implement the show/hide columns feature. Now I would like to switch from the above ContextMenu to a ControlPanel with buttons for each action:
<telerik:ControlPanelItemCollection>
<telerik:ControlPanelItem ButtonTooltip="Column chooser" >
<telerik:ControlPanelItem.ContentTemplate>
<DataTemplate>
<ListBox ItemsSource="{Binding Columns}" BorderThickness="0">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Content="{Binding Header, Mode=OneWay}" IsChecked="{Binding IsVisible, Mode=TwoWay}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DataTemplate>
</telerik:ControlPanelItem.ContentTemplate>
</telerik:ControlPanelItem>
<telerik:ControlPanelItem ButtonTooltip="Save/Load layout" >
<telerik:ControlPanelItem.Content>
<ListBox>
<Button Content="Export to Excel" Command="{Binding ExportToExcelCmd}" CommandParameter="{Binding ?"/>
<Button Content="Save grid layout" Command="{Binding SaveDataGridLayoutCmd}" CommandParameter="{Binding ?}"/>
<Button Content="Load grid layout" Command="{Binding LoadDataGridLayoutCmd}" CommandParameter="{Binding ?}"/>
<Button Content="Reset grid layout" Command="{Binding ResetDataGridLayoutCmd}" CommandParameter="{Binding ?}"/>
</ListBox>
</telerik:ControlPanelItem.Content>
</telerik:ControlPanelItem>
But I'm stuck with the binding of the Command. As I'm using the MVVM pattern, the Command is bound to a command in my ViewModel. This works fine for the ContextMenu, but not for the ControlPanel.
Also, the datagrid itself needs to be send as a parameter with the command and I'm not sure how to do this.
Any help would be much appreciated.
Regards,
Hans
Hi,
Is it possible to select different visual template/theme dynamically in code to handle different type of alert. For example red background for critical message while blue background is for normal alert.
Thanks.