I have following code
when I clicked something form combobox and have error and return value to old value in that case the selected item in combobox is the last selected
01.
public
class
MyClass
02.
{
03.
public
int
ForeignId
04.
{
05.
get
06.
{
07.
return
MyObject.ForeignId;
08.
}
09.
10.
set
11.
{
12.
int
oldValue = MyObject.ForeignId;
13.
14.
try
15.
{
16.
MyObject.No = Helper.Help(value)
17.
}
18.
catch
19.
{
20.
MyObject.ForeignId = oldValue;
21.
}
22.
23.
OnPropertyChanged(() => ForeignId);
24.
}
25.
}
26.
27.
public
MyObject MyObject{
get
;
set;
}
28.
}
<
telerik:RadComboBox
ItemsSource
=
"{Binding ItemList}"
DisplayMemberPath
=
"Name"
SelectedValuePath
=
"ForeignId"
SelectedValue
=
"{Binding ForeignId, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True, UpdateSourceTrigger=PropertyChanged}"
/>
i want to change spacing between every letter ,like /expand in rtf format ,i can't find way to change that.
so as winform richtexteditor
please support it
I have a customized cell template.
<
telerik:GridViewDataColumn
Header
=
"Contact"
DataMemberBinding
=
"{Binding CustAccountsLocationContact.FirstName}"
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
TextBox
Text
=
"{Binding SomeText, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
</
telerik:GridViewDataColumn
>
Now in Model class SomeText property there is a [required] attribute. Similar this, I created the error template as
<
ControlTemplate
x:Key
=
"errorTemplate"
>
<
DockPanel
>
<
Border
BorderBrush
=
"Red"
BorderThickness
=
"1"
>
<
AdornedElementPlaceholder
x:Name
=
"controlWithError"
/>
</
Border
>
<
TextBlock
Foreground
=
"Red"
FontSize
=
"20"
FontFamily
=
"Segoe UI"
Margin
=
"3,0,0,0"
MouseDown
=
"Exclamation_MouseDown"
Tag
=
"{Binding AdornedElement.(Validation.Errors)[0].ErrorContent, ElementName=controlWithError}"
>!</
TextBlock
>
</
DockPanel
>
</
ControlTemplate
>
However I can not see the error template if validation failed. By the answer on stackoverflow, it seems need to wrap some template with <AdornerDecorator>
Is it the solution to my case? If so, how to wrap it around telerik control?
Thank you.
Hello,
In the SaveFileDialog, when the user selects "This PC" on the folders tree, the files list doesn't change.
On the windows save file dialog, the list of devices and drives is displayed.
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