Hi.
I have the following RadPropertyGrid:
XAML:
<Grid
behaviors:CalloutTagBehavior.CalloutTag="F6C90D8E-9F1C-4372-87D0-17B40EE1E462"
IsEnabled="{Binding StateDispatcher.EnvironmentState,
Converter={converters:ComparisonConverter},
ConverterParameter={x:Static runtime:EnvironmentState.Design}}">
<telerik:RadPropertyGrid
x:Name="RadPropertyGrid"
telerik:PropertySet.ShouldAddNullForNonMatchingValues="True"
AutoGeneratingPropertyDefinition="RadPropertyGrid_OnAutoGeneratingPropertyDefinition"
EditEnded="RadPropertyGrid_OnEditEnded"
EditMode="Single"
FieldIndicatorVisibility="Collapsed"
IsGrouped="False"
Item="{Binding SelectedObject}"
LabelColumnWidth="0.8*"
Loaded="RadPropertyGrid_OnLoaded"
PropertySetMode="None"
RenderMode="Flat">
<telerik:RadPropertyGrid.GroupStyle>
<Style TargetType="telerik:RadToggleButton">
<Setter Property="Margin" Value="0,0,15,0" />
</Style>
</telerik:RadPropertyGrid.GroupStyle>
</telerik:RadPropertyGrid>
</Grid>CodeBehinde:
public partial class PropertyGridPaneUserControl : UserControl
{
public PropertyGridPaneUserControl(IEventAggregator eventAggregator)
{
if (eventAggregator == null) throw new ArgumentNullException(nameof(eventAggregator));
InitializeComponent();
eventAggregator.Register<RefreshPropertyGridMessage>(this, RefreshPropertyGridMessageHandler);
}
private void RefreshPropertyGridMessageHandler(RefreshPropertyGridMessage message)
{
RadPropertyGrid.ReloadData();
}
private void RadPropertyGrid_OnAutoGeneratingPropertyDefinition(object? sender, AutoGeneratingPropertyDefinitionEventArgs e)
{
((Binding)e.PropertyDefinition.Binding).ValidatesOnExceptions = true;
}
private void RadPropertyGrid_OnLoaded(object sender, RoutedEventArgs e)
{
var virtualizingStackPanel = RadPropertyGrid
.ChildrenOfType<VirtualizingStackPanel>().FirstOrDefault();
if (virtualizingStackPanel != null)
{
virtualizingStackPanel.ScrollOwner.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
}
}
private void RadPropertyGrid_OnEditEnded(object? sender, PropertyGridEditEndedEventArgs e)
{
if (e.EditAction != PropertyGridEditEndedAction.Commit ||
Equals(e.NewValue, e.OldValue) ||
DataContext is not PropertyGridViewModel {SelectedObjects: { }} propertyGridViewModel) return;
ItemPropertyInfo sourceProperty = e.EditedPropertyDefinition.SourceProperty;
foreach (var selectedObject in propertyGridViewModel.SelectedObjects)
{
if (selectedObject == e.EditedPropertyDefinition.Instance) continue;
PropertyInfo? property = selectedObject.GetType()
.GetProperty(sourceProperty.Name, sourceProperty.PropertyType);
if (property != null)
{
property.SetValue(selectedObject, e.NewValue);
}
}
}
}And it worked fine up to a certain point. The problem occurs when processing an object with the ObservableCollection property of the following type:
public class A
{
public ObservableCollection<object> Collection { get; }
}My task is to perform asynchronous addition of elements to a nested collection. If I didn't open the CollectionEditor in the UI, then the addition happens without problems. But if you open CollectionEditor in UI at least once, InvalidOperationnException is generated when adding asynchronously: The calling thread cannot access this object because a different thread owns it. Stack trace part:
at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.DependencyObject.GetValue(DependencyProperty dp)
at System.Windows.Controls.Panel.get_IsItemsHost()
at System.Windows.Controls.ItemsControl.GetItemsOwnerInternal(DependencyObject element, ItemsControl& itemsControl)
at System.Windows.Controls.Panel.VerifyBoundState()
at System.Windows.Controls.Panel.OnItemsChanged(Object sender, ItemsChangedEventArgs args)
at System.Windows.Controls.ItemContainerGenerator.OnItemAdded(Object item, Int32 index)
at System.Windows.Controls.ItemContainerGenerator.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
at System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
at MS.Internal.Data.CollectionViewProxy._OnViewChanged(Object sender, NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.ProcessSynchronousCollectionChangedWithAdjustedArgs(NotifyCollectionChangedEventArgs originalArguments, Int32 adjustedOldIndex, Int32 adjustedNewIndex)
at Telerik.Windows.Data.QueryableCollectionView.ProcessSynchronousCollectionChanged(NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.OnSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs args)
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)At the same time, an exception occurs even if in Rad PropertyGrid.Item set another instance of the object or null. I would like to know how to correct this misunderstanding
How dynamically change with of column in RowDetails
Hello. I have a TreeListView with three columns. Also some rows have details. There is a GridView in Details. I would like that width of the first column in Details is equals width of the first column in TreeListView, and so on for each columns. And when I change size of TreeListView the columns in Details dynamically change itself width.
Telerik SDK Samples Browser has demo "Binding RowDetails Element Width". But it's not working when I change size of window. Details does not change it's width.
Thanks.
I'm converting my application to use the Windows 11 theme and I noticed an issue that sometimes pops up with the RadGridView control.
When closing a details section of a row (click on the minus button to close the row again) the lines suddenly jump down and show a bit white space.
I didn't have the issue before I switched to the new theme. (before we were using the Office 2016 theme)
Currently I have no clue why it's happening or where I should start looking. When I scroll or click on the plus button to open row details it goes back to normal.
Anybody experienced something similar before?
Dear Team!
I have the same issue on WPF, what i had in WinForm earlier.
You helped me on this link:
https://www.telerik.com/forums/space-less-custom-language-in-syntax-editor
I have to achieve the same under WPF, but i had no success so far. I tried to modify the WF code to make it work under a WPF class (vb.net)
but it doenst color those keywords which are connected to other strings. Examples and everything are available on the above link, i can share more if you want.
Thank you for the support
Peter
Hello,
I am experiencing the same issue, that "Guy" has mentioned in his thread:
Link to question
However, the topic is discontinued. So the issue is, that when i use classic field style, everything looks good. My object has 4 properties, and the event FieldLoaded is called 4 times - see counter at the bottom.
However, when i apply FieldStyle (in my case FieldStyle="{StaticResource PropertyGridFieldStyleCustom}") to make property name appear over editor instead of on the left on it, the fieldloaded event is called 8 times - twice for each property.
I am attaching my solution where You can see the example im referring to. Is there something im doing wrong, or it may be a RadPropertyGrid bug?
Thanks for any help.
I'm trying to update the bound property in a RadNumericUpDown by calling UpdateSource on the Value BindingExpression. But the Value property hasn't been updated from the internal TextBox yet. Is there some way I can tell the RadNumericUpDown to update the Value property using the Text in its internal TextBox?
Question cancelled
In our applications we have several large ResourceDictionaries that contain many images that we then use throughout our applications.
For example, we have a "refresh" icon defined as :
<BitmapImage x:Key="Refresh32Image" UriSource="Refresh32px.png"/>Then whenever we want to show that image on any WPF window we just put this:
<Button x:Name="RefreshButton">
<Image Source="{StaticResource Refresh32Image}"/>
</Button>We have this in dozens of different windows etc.
We are now switching over to use Telerik Implicit Theming and we can make this work by adding an IconSource at the top of each window and changing the buttons content to :
<Image Style="{StaticResource Image16Style}"
Source="{telerik:IconResource IconRelativePath=Refresh32px.png,IconSources={StaticResource CommonIconSources}}"/>
This does work, however, requires a LOT of code changes throughout the application. We have hundreds of buttons that would all need updating with various different image filenames etc. etc.
So ideally we want to change the Bitmap Image Resource instead, so that we don't have to change the button content, and of course, any new buttons that we want to add are much simpler.
However, we cannot find way to do this. We have tried this, so instead of declaring the Refresh32Image as a BitmapResource, instead it's an IconResource
<telerik:IconResource x:Key="Refresh32Image" IconRelativePath="Refresh32px.png" IconSources="{StaticResource CommonIconSources}" />However, this won't compile because when we then try to use that resource in a button, WPF shows:
'Telerik.Windows.Controls.IconResourceExtension' is not a valid value for property
We also tried declaring the image resource as
<BitmapImage x:Key="Refresh32Image" UriSource="{telerik:IconResource IconRelativePath=Refresh32px.png,IconSources={StaticResource CommonIconSources}}"/>But this is rejected as
Property 'UriSource' or property 'StreamSource' must be set.
I'm sure there must be an easy way of declaring BitmapImage resources just once and reusing them wherever we need using IconResources, so can you help us work out how to do this?
Hi,
I'm trying to identify the best approach / best control that I could bind its "value" to a property that may change type during runtime.
For instance it could look like: Value = [ ... ], where [ ... ] would be the value of a boolean, string or decimal.
Simple code could be:
<StackPanel Orientation="Horizontal">
<TextBlock Text="Value ="/>
<!--< Control something ??? Value={Binding ActiveItem, Mode=TwoWay} />-->
</StackPanel>I guess some type of generic control where I can set a Template Selector. But in addition I would be great if I could set an EditTemplateSelector as well, so I can use a different control for editing
GridViewCell has this kind of behavior but I would need it out of a RadGridView
Thank you for your help and ideas.
Hello,
After update Telerik components we have problem with filtering control.
After first click we don't see text fields (filtering1.png)
But after second click everything is ok (filtering2.png).
Previously we have used Telerik v 2012.