私はc#(UWP)を学び、XAMLで通知テキストブロックを作成しました。C#UWP - 通知パネル
ここにある:
<Storyboard x:Name="notificationPanel1">
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="notificationBorder">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Thickness>0,-80,0,0</Thickness>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="notificationBorder">
<EasingDoubleKeyFrame KeyTime="0" Value="0">
<EasingDoubleKeyFrame.EasingFunction>
<BackEase EasingMode="EaseInOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
<EasingDoubleKeyFrame KeyTime="0:0:1.5" Value="75">
<EasingDoubleKeyFrame.EasingFunction>
<BackEase EasingMode="EaseInOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="75">
<EasingDoubleKeyFrame.EasingFunction>
<BackEase EasingMode="EaseInOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Grid>
....
<Border x:Name="notificationBorder" BorderBrush="{x:Null}" VerticalAlignment="Top" Margin="0,-80,0,0" RenderTransformOrigin="0.5,0.5">
<Border.RenderTransform>
<CompositeTransform/>
</Border.RenderTransform>
<TextBlock x:Name="notificationTxt" TextWrapping="Wrap" Padding="0" TextAlignment="Center" Foreground="White" Text="sdfdsfsdf" Margin="0,15"/>
</Border>
....
</Grid>
はこれを行うには良い方法はありますか?これで、このXAMLをすべてのページにコピーする必要があります。
Mbはこれを動的に生成しますか?しかし、私はどのように、私にヒントを与えることができますか分からない?
は、ユーザーコントロールのそれを入れて、そしてちょうどすべてのページを渡ってそれを使用することです! –
@PedroLamas、返信いただきありがとうございます。私が言ったように、私はC#を学んでいるので、今私はどのようにカスタムコントロールを作成するか分かりません。しかし、私はgoogleでそれをチェックします。ありがとう –
usercontrolで始まります(これはページのようなもので、Visual Studioから直接追加できます)。あなたがまだ学んでいるように、それはカスタムコントロールよりも扱いが簡単です! –