u  UserControl.xaml

 

<UserControl x:Name="userControl">

         (外面的ViewModel)

 

      <Rectangle x:Name="layoutRoot" >

                (裡面ViewModel(layoutRoot))

         </Rectangle>

 

</UserControl>

 

 

 

u  OtherControl.xaml 外面ViewModel( 別的PageUserControl)

 

(外面的ViewModel)

<Storyboard:LightLineControl Grid.Row="1"

                        IsEnableAnimationBrush="{Binding IsEnableNameAnimationBrush}"

                        /> 

 

 

u  UserControl.xaml.cs

              #region Dependency Properties

 

        #region IsEnableAnimationBrush

        publicstaticreadonlyDependencyProperty IsEnableAnimationBrushProperty =

            DependencyProperty.Register("IsEnableAnimationBrush", typeof(bool), typeof(LightLineControl), newPropertyMetadata(true));

 

        publicbool IsEnableAnimationBrush

        {

            get { return (bool)GetValue(IsEnableAnimationBrushProperty); }

            set { SetValue(IsEnableAnimationBrushProperty, value); }

        }

 

        #endregion

 

        #endregion

 

        public LightLineControl()

        {

            this.InitializeComponent();

 

            ViewModelBinder.Bind(this, this.layoutRoot, null);

           (或是寫成 this.layoutRoot.DataContext = this; 也有同樣效果,上面為搭配Caliburn寫法)

        }

 

參考資料:

http://stackoverflow.com/questions/28897663/how-to-show-a-progress-ring-with-a-text-in-windows-universal-apps

全站熱搜

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