Page 1 of 1

Inexplicit "Unknown member UserControl.DesignWidth" on certain UserControls.

Posted: 21 Jul 2020, 13:41
by asusralis
I'm at a loss on where this is coming from. It says "Unknown member UserControl.DesignWidth/DesignHeight" when certain UserControls are shown. Here is an example UserControl that has this appear:
<UserControl
    x:Class="Empis.Unity.Views.Matchmaking"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:converters="clr-namespace:Empis.Unity.Converters"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    x:Name="xRoot"
    d:DesignHeight="1000"
    d:DesignWidth="2000"
    mc:Ignorable="d">
    <Grid>
   
    </Grid>
</UserControl>
#if UNITY_5_3_OR_NEWER
#define NOESIS
using Noesis;
using Empis.Unity.ViewModels;
#else
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
#endif

namespace Empis.Unity.Views
{
    public partial class Matchmaking : UserControl
    {
        public Matchmaking()
        {
            this.InitializeComponent();
        }


#if NOESIS
        void InitializeComponent()
        {
            Noesis.GUI.LoadComponent(this, "Assets/Project/Views/Resources/Matchmaking.xaml");
        }
#endif
    }
}
This UserControl usually has around 400 lines of XAML, but removed and reimproted does not fix the errors. Removing the design width/height will fix these errors. Are there any apparent reasons why this would happen?

Re: Inexplicit "Unknown member UserControl.DesignWidth" on certain UserControls.

Posted: 21 Jul 2020, 14:02
by sfernandez
The problem is that our xaml parser is unable to ignore d:DesignWidth/Height properties until it parses attribute mc:Ignorable="d", that is defined later.
You can change the order of attributes as the following code to workaround that right now, we will try to fixt it for our next release.
<UserControl
    x:Class="Empis.Unity.Views.Matchmaking"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:converters="clr-namespace:Empis.Unity.Converters"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    x:Name="xRoot"
    mc:Ignorable="d"
    d:DesignHeight="1000"
    d:DesignWidth="2000">
    <Grid>
   
    </Grid>
</UserControl>

Re: Inexplicit "Unknown member UserControl.DesignWidth" on certain UserControls.

Posted: 22 Jul 2020, 11:32
by asusralis
Oh, I see! It seems XAML Styler decided to start forcing the design width/height before ignornable which is why this problem came out of nowhere for me. I set the order in which they appear and now it's fixed. Thanks for the help!