diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2018-06-15 23:18:51 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2018-06-15 23:18:51 +0300 |
| commit | f0bcdcdbfa78ba705b8fa44591fa594a425352a9 (patch) | |
| tree | d5476a7259fc5d6061d819ae5f1df5b78c904856 /Software/Visual_Studio/Tango.Touch/Controls | |
| parent | 84700eb44cffe4b503a9ad22b1dfa8c703f356d2 (diff) | |
| download | Tango-f0bcdcdbfa78ba705b8fa44591fa594a425352a9.tar.gz Tango-f0bcdcdbfa78ba705b8fa44591fa594a425352a9.zip | |
Implemented TouchLoadingPanel
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch/Controls')
| -rw-r--r-- | Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.cs | 41 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.xaml | 59 |
2 files changed, 100 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.cs new file mode 100644 index 000000000..bb9745e68 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.Touch.Controls +{ + public class TouchLoadingPanel : ContentControl + { + static TouchLoadingPanel() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchLoadingPanel), new FrameworkPropertyMetadata(typeof(TouchLoadingPanel))); + } + + public bool IsLoading + { + get { return (bool)GetValue(IsLoadingProperty); } + set { SetValue(IsLoadingProperty, value); } + } + public static readonly DependencyProperty IsLoadingProperty = + DependencyProperty.Register("IsLoading", typeof(bool), typeof(TouchLoadingPanel), new PropertyMetadata(false)); + + public String LoadingMessage + { + get { return (String)GetValue(LoadingMessageProperty); } + set { SetValue(LoadingMessageProperty, value); } + } + public static readonly DependencyProperty LoadingMessageProperty = + DependencyProperty.Register("LoadingMessage", typeof(String), typeof(TouchLoadingPanel), new PropertyMetadata("Loading...")); + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.xaml new file mode 100644 index 000000000..d4c0c3d80 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.xaml @@ -0,0 +1,59 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Tango.Touch.Controls"> + + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="../Resources/Colors.xaml" /> + </ResourceDictionary.MergedDictionaries> + + <Style TargetType="{x:Type local:TouchLoadingPanel}"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type local:TouchLoadingPanel}"> + <Border Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}"> + + <Grid> + <ContentPresenter Content="{TemplateBinding Content}" /> + + <Grid Background="#66FFFFFF"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="IsHitTestVisible" Value="False"></Setter> + <Setter Property="Opacity" Value="0"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:TouchLoadingPanel},Path=IsLoading}" Value="True"> + <Setter Property="IsHitTestVisible" Value="False"></Setter> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="00:00:0.1"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> + <local:TouchBusyIndicator Foreground="{TemplateBinding Foreground}" IsIndeterminate="True" Width="100" Height="100" HorizontalAlignment="Center" /> + <TextBlock Margin="20" Text="{TemplateBinding LoadingMessage}" HorizontalAlignment="Center" /> + </StackPanel> + </Grid> + </Grid> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + +</ResourceDictionary>
\ No newline at end of file |
