This is a migrated thread and some comments may be shown as answers.

Visual studio 2019 Xaml Designer An Exception was thrown.

5 Answers 801 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
Psyduck asked on 17 Apr 2021, 12:21 PM

Hello.

I am using Revit API as well, so it seems to have a problem. (For similar issues, I will ask elsewhere.)

The xaml designer keeps crashing.

 

I am using the variable name like Rooms in the xaml source.
<telerik:RadGridView ItemsSource="{Binding Rooms}"/>

 

This is where the xaml designer exception is thrown.

ArgumentException: 'RadGlyphExtension' is not valid for Setter.Value. The only supported MarkupExtension types are DynamicResourceExtension and BindingBase or derived types.

 

I don't use glyph. I don't know if this is only the 'Rooms' variable, but there are other exception errors as well.

 

It succeeds on build, it starts up and works fine until results.
The controller is difficult to place as the error only occurs in the designer.

 

Why is that so? Could I ask for confirmation?

Thanks

5 Answers, 1 is accepted

Sort by
0
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
answered on 20 Apr 2021, 07:27 AM

I kept looking, but I haven't solved it yet. However, it doesn't seem to be a variable problem.

Currently my version is using the 2021_1_419 noxaml implicit style,

Refers to Windows.Data, Windows.Controls, Windows.Controls.Data, Windows.Controls.GridView, Windows.Controls.Input. (5)

 

When the Wpf view is newly created, it is visible, and an exception appears at some point.

<xaml>
    <Window.DataContext>
        <local:zProcessViewModel/>
    </Window.DataContext>
 
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/assembly;component/Resources/NoXaml/NoXamlTemplate.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
 
    <Grid>
        <telerik:RadGridView ItemsSource="{Binding ABC}"/>
    </Grid>
 
 
<viewmodel>
public class ErrorTestModel
    {
        public string Name { get; set; }
        public string Id { get; set; }
 
    }
 
    public class zProcessViewModel : Telerik.Windows.Controls.ViewModelBase
    {
        private ObservableCollection<ErrorTestModel> _abc = new ObservableCollection<ErrorTestModel>();
        public ObservableCollection<ErrorTestModel> ABC
        {
            get => _abc;
            set
            {
                _abc = value;
                OnPropertyChanged("ABC");
            }
        }
 
        public zProcessViewModel()
        {
            ABC = new ObservableCollection<ErrorTestModel> {
                new ErrorTestModel { Id = "1", Name = "One"   },
                new ErrorTestModel { Id = "2", Name = "Two"   },
                new ErrorTestModel { Id = "3", Name = "Three" },
                new ErrorTestModel { Id = "4", Name = "Four"  }
            };
        }
    }

 

If you delete ItemsSource or ResourceDictionary, Designer is shown, and if you create it again, an exception occurs.

0
Martin Ivanov
Telerik team
answered on 21 Apr 2021, 02:21 PM

Hello KIM,

There is a very similar issue logged in the Telerik WPF Feedback Portal. You can check it out and see if your case is the same.

Regards,
Martin Ivanov
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

0
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
answered on 22 Apr 2021, 01:07 AM

Hello.

 

This post was last updated on 14 Sep 2018 22:58.

ArgumentException is correct. 

My theme is also fluent, but I haven't used RadGlyph and have no style settings.

Still, should I avoid this variation by customizing your style?

 

Is there any solution other than this?

 

Thanks.

0
Martin Ivanov
Telerik team
answered on 26 Apr 2021, 01:02 PM

Hello KIM,

The issue relates to a setting in one of the ControlTemplates in the Telerik.Windows.Controls.GridView.xaml files. The template uses RadGlyph in a specific setup which causes the design-time error. The resolution in the feedback portal probably will resolve also the error on your side. The solution is to get the custom Style from the feedback portal and add it in your project. You can add the Style in the App.xaml Resources or in the Resources collection of the view where the RadGridView instance is included. Then you can remove its x:Key in order to apply it implicitly to the GridViewPinButton controls.

Currently, there is no alternative solution for this.

Regards,
Martin Ivanov
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

0
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
answered on 04 May 2021, 10:42 AM

Hello.

I found the cause of the design conflict.

When configuring datacontext viewmodel in xaml, an exception is thrown.
When I do this DataContext in xaml.cs, the designer is out of the exception.

Could you supplement this?

Thnaks.

 

(*.xaml in datacontext) Designer An Exception was thrown.

<Window...
	<Window.DataContext>
		<local:ViewModel/>
	</Window.DataContext>
</Window>

 

(*.xaml.cs) This avoids designer crashes.

public DataGridTestView()
{
    InitializeComponent();
    DataContext = new ViewModel();
}


 

Martin Ivanov
Telerik team
commented on 04 May 2021, 12:18 PM

Hello KIM. The data context is evaluated at a different moment with the two settings. If you set the ViewModel in XAML, it should be evaluated earlier than setting it in code-behind. I can't tell why the error appears, but it looks like setting the DataContext a bit later is resolving the issue.
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
commented on 06 May 2021, 01:07 AM

I think it's a bug. Do you have any thoughts on fixing and updating this issue?
Martin Ivanov
Telerik team
commented on 10 May 2021, 12:52 PM

Hello KIM. I am afraid that, without reproducing the this on my side, I cannot tell if this is an additional issue or the same one as previously linked. What I can suggest you is to open a new support ticket along with a sample project that recreates the error. 
Tags
General Discussions
Asked by
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
Answers by
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
Martin Ivanov
Telerik team
Share this question
or