Hi,
I'm using the RadPropertyGrid to show the properties of ExpandoObject with AutoGeneratePropertyDefinitions=true. The ExpandoObject has two nested properties. The first one is based on a public class with some public properties, the other is a second ExpandoObject. When I run the code the PropertyGrid shows the two nested properties as expected (i.e. they are collapsed).
When I expand the nested properties based on the class by clicking the expand-button (plus-sign in front of the nested propertie's name) the class' properties are shown as expected (see screenshot).
When I click the expand-button to expand the nested properties based on the second ExpandoObject the following exception is thrown:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Core.dll
Additional information: Property path is not valid. 'System.Dynamic.ExpandoObject+MetaExpando' does not have a public property named 'X'.
What can I do to solve this problem? I'm using the latest version "2016.3.194 (Dev)" of UI for WPF. Thank you for your help.
Best regards
Christian
P.S. The problem can be reproduced using the following XAML and code
<
Window
x:Class
=
"TelerikWpfApp2.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:propertyGrid
=
"clr-namespace:Telerik.Windows.Controls.Data.PropertyGrid;assembly=Telerik.Windows.Controls.Data"
Title
=
"RadPropertyGrid with nested properties based on ExpandoObject"
Height
=
"350"
Width
=
"508.828"
>
<
StackPanel
>
<
telerik:RadPropertyGrid
x:Name
=
"MyPropertyGrid"
NestedPropertiesVisibility
=
"Visible"
/>
</
StackPanel
>
</
Window
>
using
System;
using
System.Windows;
using
System.Dynamic;
namespace
TelerikWpfApp2
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public
partial
class
MainWindow : Window
{
public
MainWindow()
{
InitializeComponent();
FillPropertyGrid();
}
private
void
FillPropertyGrid()
{
dynamic item =
new
ExpandoObject();
dynamic nestedPropertyBasedOnExpando =
new
ExpandoObject();
nestedPropertyBasedOnExpando.X = 1.0;
nestedPropertyBasedOnExpando.Y = 2.0;
item.NestedPropertyBasedOnClass =
new
Point(3.0, 4.0);
item.NestedPropertyBasedOnExpando = nestedPropertyBasedOnExpando;
// if the following propeties are added then no exception is thrown;
// but nestedProperty1.X and item.X are bound to each other!
// item.X = 0.0;
// item.Y = 0.0;
MyPropertyGrid.Item = item;
}
}
}
Hi,
I need a functionality to allow users to add e a text that cannot be edited but can be deleted. It needs to have different style than ordinary text.
I Implemented it as.
private void AddHeading(string key)
{
if (HeadingsProvider == null)
return;
RtbEditor.BeginUndoGroup();
var box = RtbEditor.Document.GetLayoutBoxByPosition(RtbEditor.Document.CaretPosition.Location);
var element = box.AssociatedDocumentElement;
while (element is Inline && !(element is Span))
element = element.Parent;
while (element is Inline)
element = element.Parent;
var paragraph = element as Paragraph;
if (paragraph?.IsEmpty == false)
RtbEditor.InsertParagraph();
var headings = HeadingsProvider.GetHeadings(key).ToList();
for (int i = 0; i < headings.Count; i++)
{
RtbEditor.Document.Selection.Clear();
var lStart = RtbEditor.Document.CaretPosition.Location;
RtbEditor.InsertInline(new Span(" "));
RtbEditor.ChangeStyleName("HeadingChar", false);
RtbEditor.Insert(headings[i]);
RtbEditor.InsertInline(new Span(" "));
var lEnd = RtbEditor.Document.CaretPosition.Location;
var start = new DocumentPosition(RtbEditor.Document);
start.SetPosition(lStart);
var end = new DocumentPosition(RtbEditor.Document);
end.SetPosition(lEnd);
RtbEditor.Document.Selection.AddSelectionStart(start);
RtbEditor.Document.Selection.AddSelectionEnd(end);
RtbEditor.InsertReadOnlyRange();
RtbEditor.Document.Selection.Clear();
if (i < headings.Count - 1)
RtbEditor.InsertParagraph();
}
RtbEditor.EndUndoGroup();
}
private void RemoveHeading()
{
var box = RtbEditor.Document.GetLayoutBoxByPosition(RtbEditor.Document.CaretPosition.Location);
var span = box.AssociatedDocumentElement as Span;
if (span == null)
return;
var sibling = span.PreviousSibling;
while (sibling != null && !(sibling is ReadOnlyRangeStart) && !(sibling is ReadOnlyRangeEnd))
sibling = sibling.PreviousSibling;
var start = sibling as ReadOnlyRangeStart;
if (start == null)
return;
var end = start.End;
if (end == null)
return;
RtbEditor.Document.CaretPosition.MoveToInline(start);
var lStart = RtbEditor.Document.CaretPosition.Location;
RtbEditor.Document.CaretPosition.MoveToInline(end);
var lEnd = RtbEditor.Document.CaretPosition.Location;
var pStart = new DocumentPosition(RtbEditor.Document);
pStart.SetPosition(lStart);
var pEnd = new DocumentPosition(RtbEditor.Document);
pEnd.SetPosition(lEnd);
RtbEditor.BeginUndoGroup();
RtbEditor.DeleteReadOnlyRange(start);
RtbEditor.Document.Selection.Clear();
RtbEditor.Document.Selection.AddSelectionStart(pStart);
RtbEditor.Document.Selection.AddSelectionEnd(pEnd);
RtbEditor.Delete(false);
RtbEditor.EndUndoGroup();
}
The insert part kind of work. I need to insert an empty span before and after so that the special style not propagate when you type after the heading. I tried to insert Span(""), but it crashes the editor... I can live with " ".
The problem is that remove heading does not work. While the ReadOnlyRange is removed, the text is not. It remains in the RTB and it is selected. you need to click on another paragraph and then you can delete it manually, but then you ending with editable heading if you won't delete it manually.
I have the code below.
sometime it doesn't show the controls inside
<telerik:RadBusyIndicator x:Name="ProgressIndicator">
<telerik:RadBusyIndicator.BusyContent>
<StackPanel>
<TextBlock Name="ProgressStatus" HorizontalAlignment="Center" Grid.Row="0" />
<telerik:RadButton Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Margin="5" Grid.Row="1"/>
</StackPanel>
</telerik:RadBusyIndicator.BusyContent>
</telerik:RadBusyIndicator>
Attached below what it show when control is not showing
Hi,
in my app.cs I write this code, but format of datacolumn appears in "us"
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding CodiceModelloCommerciale}"
Header
=
"Codice"
IsReadOnly
=
"True"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding PrezzoUnitario}"
Header
=
"Prezzo"
HeaderTextAlignment
=
"Right"
TextAlignment
=
"Right"
DataFormatString
=
"C"
/>
</
telerik:RadGridView.Columns
>
public
App()
{
this
.InitializeComponent();
Thread.CurrentThread.CurrentCulture =
new
CultureInfo(name:
"it-IT"
);
Thread.CurrentThread.CurrentUICulture =
new
CultureInfo(name:
"it-IT"
);
[...]
Hello, I need help about italian spell checking.
First of all, download the zipped file from here:
http://download2.anastasis.it/software/fabrizio/TestTelerikSpellChecker.zip
it's a minimal WPF application using your current R3 2016 UI for WPF libraries, that reproduces the uncorrect behaviors. It has a custom minimal dictionary extracted from our 2 million words italian dictionary.
This mini-dictionary contains ALL the words written in the embedded test document.
---BEHAVIOR 1: Initial spellchecking
Starting up the application, only the first sentence seems completely correct.
Line 1: "Questa è una prova" is ok.
Line 2: "Dov'è" and "Quand'è" are marked wrong. "Cos'è? cos è!" are ok only because there's "cos" in the dictionary (cosine math function). We can't put "quand" and "dov" in the dictionary because they aren't correct single words in italian.
Line 3: "Prova dell'albero." is ok, but "nell'albero" and "sull'albero" are marked wrong.
Line 4a-b-c: Any order of the 3 elements results in "dell'albero" right and the others wrong. But they are all in the dictionary!
---BEHAVIOR 2: Suggestions word extraction
Problem 1:
Right-click with cursor on line 2, over the "o" in "Dov'è". First suggestion is "Dov'è", if you click it, the resulting word will be "Dov'è'è". So, it seems that the spellchecker treats the apostrophe ' character as delimiter, that's wrong in italian because "Dov" is wrong and only "Dov'[Vowel]*" is right. Same applies with thousands of different word that get truncated on the following one.
Problem 2:
Now for the black magic: Undo with Ctrl-Z, select whole "Dov'è" word and right-click it: no suggestions supplied (correct). Then, click in the editor to dismiss the context menu and roll the mouse wheel. Refresh now shows as correct the entire selection that was previously marked wrong.
Plot twist: Put the cursor after "è" in "Dov'è" and press space: "Dov'è" is marked wrong again.
But in English, all the words like "isn't", "don't", "we're" etc are marked as correct. So what's the problem with italian spell checking?
I really hope to get help from you, because the spell checker is a paramount function for our application.
Thanks in advance.
Fabrizio
Hello,
when the RibbonWindow is not maximized, left and right blocks are displayed on the outside of the window...
Hello group,
Question: I have a GridViewDataColumn. The Header property has been bind to an property in the ViewModel. If you now in the UI drag the column header to the group-by bar the Grid will display the name of the group-by as: [DataContextName].[PropertyName] instead of the (string) value of the property of the binding.
I have tried to use an converter to collect the string form the resource file but this does not work either.
Help would be appriciated.
Richard
I created a test application with a treeview using implicit themes with the XAML files loaded into project. That works fine. If I move the treeview into a usercontrol in a separate project, it does not work. I tried both methods from here with no success:
https://blogs.msdn.microsoft.com/wpfsdk/2007/06/08/defining-and-using-shared-resources-in-a-custom-control-library/
It fails when loading Telerik.Windows.Controls.Navigation.xaml. It doesn't have a problem loading Telerik.Windows.Controls.xaml. The sample in the link
As a side note, I am doing the same thing with the map control and don't have any issues with it.
Link to the Project:
https://file.ac/1GnUz6lTPqM/
Here's the snippet from the UserControl:
<
UserControl.Resources
>
<
ResourceDictionary
>
<
ResourceDictionary.MergedDictionaries
>
<
ResourceDictionary
Source
=
"Themes/System.Windows.xaml"
/>
<
ResourceDictionary
Source
=
"Themes/Telerik.Windows.Controls.xaml"
/>
<
ResourceDictionary
Source
=
"Themes/Telerik.Windows.Controls.Navigation.xaml"
/>
</
ResourceDictionary.MergedDictionaries
>
</
ResourceDictionary
>
</
UserControl.Resources
>
I want to set the two first Buttons of the RadGridView ControlPanelItems to the left. Is this possible and how. The image describes what I want to do. Below you will find also my source code.
01.
<telerik:RadGridView.ControlPanelItems>
02.
03.
<telerik:ControlPanelItem>
04.
<telerik:ControlPanelItem.ButtonContent>
05.
<telerik:RadButton Name=
"EnlargeFontSize"
Click=
"EnlargeFontSize_OnClick"
>
06.
<DockPanel>
07.
<TextBlock Text=
""
FontFamily=
"Segoe MDL2 Assets"
FontWeight=
"Bold"
FontSize=
"16"
/>
08.
<TextBlock TextAlignment=
"Center"
/>
09.
</DockPanel>
10.
</telerik:RadButton>
11.
</telerik:ControlPanelItem.ButtonContent>
12.
</telerik:ControlPanelItem>
13.
14.
<telerik:ControlPanelItem>
15.
<telerik:ControlPanelItem.ButtonContent>
16.
<telerik:RadButton Name=
"ReduceFontSize"
Click=
"ReduceFontSize_OnClick"
>
17.
<DockPanel>
18.
<TextBlock Text=
""
FontFamily=
"Segoe MDL2 Assets"
FontWeight=
"Bold"
FontSize=
"16"
/>
19.
<TextBlock TextAlignment=
"Center"
/>
20.
</DockPanel>
21.
</telerik:RadButton>
22.
</telerik:ControlPanelItem.ButtonContent>
23.
</telerik:ControlPanelItem>
24.
25.
<telerik:ControlPanelItem>
26.
<telerik:ControlPanelItem.ButtonContent>
27.
<telerik:RadButton Click=
"ResetView_Click"
HorizontalContentAlignment=
"Stretch"
>
28.
<DockPanel>
29.
<TextBlock Text=
""
FontFamily=
"Segoe UI Symbol"
Foreground=
"Red"
/>
30.
<TextBlock Text=
"Anpassung Zurücksetzen"
TextAlignment=
"Center"
/>
31.
</DockPanel>
32.
</telerik:RadButton>
33.
</telerik:ControlPanelItem.ButtonContent>
34.
</telerik:ControlPanelItem>
35.
36.
</telerik:RadGridView.ControlPanelItems>
<
telerik:RadGridView
Name
=
"patientsGridView"
SelectionMode
=
"Extended"
ItemsSource
=
"{Binding Patients}"
SelectedItem
=
"{Binding SelectedPatient}"
AutoGenerateColumns
=
"False"
IsReadOnly
=
"True"
>
public
ObservableCollection<PatientViewModel> SelectedPatients { ... }