UWP XAML アプリケーションで x:Bind を使用する場合は、次の点を考慮してください。
interface IBaseInterface
{
string A { get; set; }
}
interface ISubInterface : IBaseInterface
{
string B { get; set; }
}
class ImplementationClass : ISubInterface
{
public string A { get; set; }
public string B { get; set; }
}
Page クラスには、次のものがあります。
public partial class MainPage : Page
{
public ISubInterface TheObject = new ImplementationClass { A = "1", B = "2" };
//All the rest goes here
}
MainPage XAML には、次のスニペットがあります。
<TextBlock Text={x:Bind Path=TheObject.A}></TextBlock>
これにより、次のコンパイラ エラーが発生します: XamlCompiler error WMC1110: Invalid binding path 'A': Property 'A' can't be found on type 'ISubInterface'
ただし、以下は機能します。
<TextBlock Text={x:Bind Path=TheObject.B}></TextBlock>
継承されたインターフェイス プロパティがコンパイラによって認識されないことが、UWP XAML プラットフォームの既知の制限であるかどうかは誰にもわかりませんか? それとも、これはバグと見なすべきですか? 既知の回避策はありますか?
助けていただければ幸いです。前もって感謝します!