Monotouchの BTProgressHudによく似た小さな再利用可能なコンポーネントを開発したいと思います。しかし、私は現在、ページのコンテンツに干渉することなくオーバーレイをビジュアル ツリーに挿入する方法に固執しています。
アップデート:
少し実験した後、ページ コンテンツからオーバーレイを分離して、ウィンドウ コンテンツをフレームからルート フレームと通知要素の両方をホストできるグリッドに変更できるようにするためのアイデアを思いつきました。 .
App.xaml.cs
protected override async void OnLaunched(LaunchActivatedArgs args)
{
Grid rootGrid = Window.Current.Content as Grid;
if(rootGrid == null)
{
var rootFrame = new Frame();
rootGrid = new Grid();
rootGrid.Children.Add(rootFrame);
Window.Current.Content = rootGrid;
}
}
ProgressHud.cs
public static class ProgressHud
{
static void Show(string msg)
{
Grid rootGrid = Window.Current.Content as Grid;
// just for testing the concept
rootGrid.Children.Add(new ProgressRing { IsActive = true };
}
}
Window.Content ルートをフレームからグリッドに変更すると、望ましくない副作用が発生する可能性があることを確認できますか?