We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ContentProperty("Content")] [TemplatePart(Name = "PART_OverlayGrid", Type = typeof(Grid))] [TemplatePart(Name = "PART_OverlayBorder", Type = typeof(Border))] [TemplatePart(Name = "PART_OverlaySpinner", Type = typeof(Control))] public class BusyUserControl : UserControl { public static readonly DependencyProperty IsBusyProperty = DependencyProperty.Register("IsBusy", typeof (bool), typeof (BusyUserControl), new PropertyMetadata(default(bool), IsBusyChanged));
private Grid _overlayGrid; public bool IsBusy { get { return (bool) GetValue(IsBusyProperty); } set { SetValue(IsBusyProperty, value); } } public BusyUserControl() { try { Style = (Style)FindResource("Ice.BusyUserControlStyle"); } catch (ArgumentNullException) { } catch (ResourceReferenceKeyNotFoundException) { } } public override void OnApplyTemplate() { base.OnApplyTemplate(); _overlayGrid = GetTemplateChild("PART_OverlayGrid") as Grid; HandleIsBusyChanged(IsBusy); } private static void IsBusyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var control = d as BusyUserControl; if (control != null) { control.HandleIsBusyChanged((bool)e.NewValue); } } private void HandleIsBusyChanged(bool isBusy) { if (_overlayGrid != null) { _overlayGrid.Visibility = isBusy ? Visibility.Visible : Visibility.Hidden; } } }
<Style x:Key="Ice.BusyUserControl.AnimationStyle" TargetType="Control">
<Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Control"> <ControlTemplate.Resources> <Storyboard x:Key="Animation0" BeginTime="00:00:00.0" RepeatBehavior="Forever"> <DoubleAnimation Storyboard.TargetName="ellipse0" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:00.9" AutoReverse="True"> </DoubleAnimation > </Storyboard> <Storyboard x:Key="Animation1" BeginTime="00:00:00.2" RepeatBehavior="Forever"> <DoubleAnimation Storyboard.TargetName="ellipse1" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:00.9" AutoReverse="True"> </DoubleAnimation > </Storyboard> <Storyboard x:Key="Animation2" BeginTime="00:00:00.4" RepeatBehavior="Forever"> <DoubleAnimation Storyboard.TargetName="ellipse2" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:00.9" AutoReverse="True"> </DoubleAnimation > </Storyboard> <Storyboard x:Key="Animation3" BeginTime="00:00:00.6" RepeatBehavior="Forever"> <DoubleAnimation Storyboard.TargetName="ellipse3" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:00.9" AutoReverse="True"> </DoubleAnimation > </Storyboard> <Storyboard x:Key="Animation4" BeginTime="00:00:00.8" RepeatBehavior="Forever"> <DoubleAnimation Storyboard.TargetName="ellipse4" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:00.9" AutoReverse="True"> </DoubleAnimation > </Storyboard> <Storyboard x:Key="Animation5" BeginTime="00:00:01.0" RepeatBehavior="Forever"> <DoubleAnimation Storyboard.TargetName="ellipse5" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:00.9" AutoReverse="True"> </DoubleAnimation > </Storyboard> <Storyboard x:Key="Animation6" BeginTime="00:00:01.2" RepeatBehavior="Forever"> <DoubleAnimation Storyboard.TargetName="ellipse6" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:00.9" AutoReverse="True"> </DoubleAnimation > </Storyboard> <Storyboard x:Key="Animation7" BeginTime="00:00:01.4" RepeatBehavior="Forever"> <DoubleAnimation Storyboard.TargetName="ellipse7" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:00.9" AutoReverse="True"> </DoubleAnimation > </Storyboard> </ControlTemplate.Resources> <ControlTemplate.Triggers> <Trigger Property="IsVisible" Value="True"> <Trigger.EnterActions> <BeginStoryboard Storyboard="{StaticResource Animation0}" x:Name="Storyboard0" /> <BeginStoryboard Storyboard="{StaticResource Animation1}" x:Name="Storyboard1" /> <BeginStoryboard Storyboard="{StaticResource Animation2}" x:Name="Storyboard2" /> <BeginStoryboard Storyboard="{StaticResource Animation3}" x:Name="Storyboard3" /> <BeginStoryboard Storyboard="{StaticResource Animation4}" x:Name="Storyboard4" /> <BeginStoryboard Storyboard="{StaticResource Animation5}" x:Name="Storyboard5" /> <BeginStoryboard Storyboard="{StaticResource Animation6}" x:Name="Storyboard6" /> <BeginStoryboard Storyboard="{StaticResource Animation7}" x:Name="Storyboard7" /> </Trigger.EnterActions> <Trigger.ExitActions> <StopStoryboard BeginStoryboardName="Storyboard0" /> <StopStoryboard BeginStoryboardName="Storyboard1" /> <StopStoryboard BeginStoryboardName="Storyboard2" /> <StopStoryboard BeginStoryboardName="Storyboard3" /> <StopStoryboard BeginStoryboardName="Storyboard4" /> <StopStoryboard BeginStoryboardName="Storyboard5" /> <StopStoryboard BeginStoryboardName="Storyboard6" /> <StopStoryboard BeginStoryboardName="Storyboard7" /> </Trigger.ExitActions> </Trigger> </ControlTemplate.Triggers> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"> <Grid> <Canvas Height="45" Width="90" Margin="0,-10,0,0" HorizontalAlignment="Center"> <Canvas.Resources> <Style TargetType="TextBlock"> <Setter Property="Width" Value="10" /> <Setter Property="Height" Value="10" /> <Setter Property="Background"> <Setter.Value> <Binding Path="Foreground" ElementName="label"> </Binding> </Setter.Value> </Setter> <Setter Property="Opacity" Value="0" /> </Style> </Canvas.Resources> <TextBlock x:Name="ellipse0" Canvas.Left="0" Canvas.Top="0" /> <TextBlock x:Name="ellipse7" Canvas.Left="0" Canvas.Top="15" /> <TextBlock x:Name="ellipse6" Canvas.Left="0" Canvas.Top="30" /> <TextBlock x:Name="ellipse1" Canvas.Left="15" Canvas.Top="0" /> <TextBlock x:Name="ellipse5" Canvas.Left="15" Canvas.Top="30" /> <TextBlock x:Name="ellipse2" Canvas.Left="30" Canvas.Top="0" /> <TextBlock x:Name="ellipse3" Canvas.Left="30" Canvas.Top="15" /> <TextBlock x:Name="ellipse4" Canvas.Left="30" Canvas.Top="30" /> <Label Content="Loading" Canvas.Left="55" FontSize="26" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalAlignment="left" Height="45" x:Name="label"> </Label> </Canvas> </Grid> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
[ContentProperty("Content")]
[TemplatePart(Name = "PART_OverlayGrid", Type = typeof(Grid))]
[TemplatePart(Name = "PART_OverlayBorder", Type = typeof(Border))]
[TemplatePart(Name = "PART_OverlaySpinner", Type = typeof(Control))]
public class BusyUserControl : UserControl
{
public static readonly DependencyProperty IsBusyProperty = DependencyProperty.Register("IsBusy",
typeof (bool),
typeof (BusyUserControl),
new PropertyMetadata(default(bool), IsBusyChanged));
The text was updated successfully, but these errors were encountered: