Telerik Forums
UI for WPF Forum
0 answers
2 views

The default design time theme is `office black`, is there any approaches to change default theme?

Set `telerik:StyleManager.Theme="xxx"` for each control is very troublesome.

Joke
Top achievements
Rank 1
 asked on 30 Sep 2022
0 answers
2 views

Hi All,

I am trying to explore RadAutoSuggestBox (R2 2022 SP1 version) in my WPF MVVM application however I didn't find any support, how to purely bind (TextChanged event and few others) it with my ViewModel. My requirement is: Whenever user type, I have to make API call and then bind response with control's itemsource.

Any help will be appreciated.

M
Top achievements
Rank 1
 asked on 30 Sep 2022
0 answers
4 views

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

Mikola
Top achievements
Rank 1
 asked on 29 Sep 2022
0 answers
4 views

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.

Alexander
Top achievements
Rank 1
 asked on 29 Sep 2022
0 answers
8 views

I have a RadGridView with one of its columns being a GridViewToggleRowDetailsColumn to allow the operator to expand or collapse the selected row details.

Next to the grid I have a checkbox that I want to use to expand/collapse all rows details in a single click if needed.

I’ve managed to partially do it by using the following code, but the collapse doesn’t work unless I disable row virtualization which I cannot.

Does anyone have a solution to this problem?


        private void ToggleAllRowsDetails(object sender, RoutedEventArgs e)
        {
            if(DataContext is MyViewModel vm)
            {
                using (MyGrid.DeferRefresh())
                {
                    if (MyRowDetails.IsChecked.Value)
                    {                       
                        MyGrid.RowDetailsVisibilityMode = GridViewRowDetailsVisibilityMode.Visible;
                    }
                    else
                    {
                        MyGrid.RowDetailsVisibilityMode = GridViewRowDetailsVisibilityMode.Collapsed;                      
                    }
                }
            }
        }

Joao
Top achievements
Rank 1
 asked on 28 Sep 2022
0 answers
18 views

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?

Ict
Top achievements
Rank 1
 asked on 26 Sep 2022
0 answers
7 views

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

Peter
Top achievements
Rank 1
Iron
Iron
 asked on 25 Sep 2022
2 answers
15 views

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.

Andrzej
Top achievements
Rank 1
Iron
 answered on 23 Sep 2022
1 answer
39 views

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? 

Dilyan Traykov
Telerik team
 answered on 22 Sep 2022
0 answers
15 views

Question cancelled

francis
Top achievements
Rank 1
 updated question on 22 Sep 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Deasun
Top achievements
Rank 2
Iron
Iron
Veteran
Teja
Top achievements
Rank 1
Ethan
Top achievements
Rank 1
James
Top achievements
Rank 1
Simos Sigma
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Deasun
Top achievements
Rank 2
Iron
Iron
Veteran
Teja
Top achievements
Rank 1
Ethan
Top achievements
Rank 1
James
Top achievements
Rank 1
Simos Sigma
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?