x:TypeArguments 可定義泛型,目前測試只有WPF可以 WinRT無法用於建構子 

 

 Xaml:

<local:BaseWindow

  x:Class="WpfApplication1.MainWindow"
  xmlns:sys="clr-namespace:System;assembly=mscorlib"

  xmlns:local="clr-namespace:WpfApplication1"

  x:TypeArguments="local:Data"



</local:BaseWindow>

 

 C#

namespace WpfApplication1
{
    /// 
    /// MainWindow.xaml 的互動邏輯
    /// 
    public partial class MainWindow : BaseWindow<Data>
    {
        public MainWindow()
        {
            InitializeComponent();
        }
    }
}

 

 

參考資料:

https://msdn.microsoft.com/en-us/library/ee795382(v=vs.110).aspx

http://blogs.msdn.com/b/mikehillberg/archive/2006/10/06/limitedgenericssupportinxaml.aspx

http://stackoverflow.com/questions/14478469/windows-8-store-application-support-for-xtypearguments

全站熱搜

小賢 發表在 痞客邦 留言(0) 人氣()