bpiec
bpiec

Reputation: 1631

Warnings from XAML

Is there any way to view warnings from parsing XAML? Either from runtime or from design time. Is there any way to output them somewhere?

Consider the following example (taken from WPF 4.5 Unleashed book by Adam Nathan):

<ListBox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:sys="clr-namespace:System;assembly=mscorlib" DisplayMemberPath="DayOfWeek">
  <Button>Button</Button>
  <Expander Header="Expander"/>
  <sys:DateTime>1/1/2016</sys:DateTime>
  <sys:DateTime>1/2/2016</sys:DateTime>
  <sys:DateTime>1/3/2016</sys:DateTime>
</ListBox>

You can note that neither Button nor Expader have DayOfWeek property so there is an empty string displayed for those. Is there any message saying: Button does not contain DayOfWeek property or similar?

Upvotes: 0

Views: 616

Answers (1)

mm8
mm8

Reputation: 169370

You should see a BindingExpression path error for each binding that fails in the Output window in Visual Studio when you debug your application (at runtime) provided that you haven't turned off data binding warnings under Tools->Options->Debugging->Output Window->WPF Trace Settings.

The bindings are resolved at runtime so you won't see any errors at design or compile time.

Upvotes: 2

Related Questions