Silverlight BusyIndi​​cator 的 Ajax 风格?

发布于 2024-09-09 04:08:24 字数 220 浏览 11 评论 0原文

我正在寻找一个示例样式来将 Silverlight BusyIndi​​cator 的外观更改为更像 AJAX 应用程序的“旋转轮”外观。

绕谷歌一圈会产生一些链接,指向人们创建新控件以实现相同目标的地方(我怀疑他们早于 BusyIndi​​cator),但如果可能的话,我宁愿为 BusyIndi​​cator 换肤。

有人给我指出正确的方向吗?

谢谢马克

I'm looking for an example Style to change the look of the Silverlight BusyIndicator to more like the "spinning wheel" look of AJAX apps.

A lap around google produces some links to where people are creating new controls to achieve the same thing (I suspect they pre-date the BusyIndicator) but I'd rather skin the BusyIndicator if possible.

Anyone pont me in the right direction?

Thanks

Mark

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

傲性难收 2024-09-16 04:08:24

我从 Silverlight Toolkit 制作了自己的自定义 BusyIndi​​cator

以下是您所需要的:

  1. 在样式文件中设置系统命名空间:

    xmlns:System="clr-namespace:System; assembly=mscorlib"

  2. Put样式文件中的样式/模板:

    
        <网格 x:名称=“ColorLayer”>               
            
                
                    
                        <故事板>
                            
                                
                                    
                                        <可见性>折叠
                                    
                                
                            
                            
                                
                                    
                                        <可见性>折叠
                                    
                                
                            
                        
                    
                    
                        <故事板>
                            
                                
                                    
                                        <可见性>可见
                                    
                                
                            
                            
                                
                                    
                                        <可见性>可见
                                    
                                
                            
                        
                    
                
                
                    
                        <故事板>
                            
                                
                                    
                                        <系统:布尔值>True
                                    
                                
                            
                        
                    
                    
                        
                            
                                
                                
                            
                            
                                
                                    
                                        <系统:布尔值>False
                                    
                                
                            
                        
                    
                
            
            
            <矩形 x:Name="overlay" Style="{TemplateBinding OverlayStyle}"/>
            
                <路径 x:Name="loader" 高度="19" 宽度="19" Canvas.Left="0.5" Canvas.Top="0.5" Stretch="Fill" UseLayoutRounding="False" Stroke="Black" StrokeThickness =“0.2”渲染变换原点=“0.5,0.5”
                    数据=“M9.5,3 C5.9101491,3 3,5.9101491 3,9.5 C3,13.08985 5.9101491,16 9.5,16 C13.08985,16 16,13.08985 16,9.5 C16,5.9101491 13.08985, 3 9.5,3 z M9 .5,0 C14.746705,0 19,4.2532949 19,9.5 C19,14.746705 14.746705,19 9.5,19 C4.2532949,19 0,14.746705 0,9.5 C0,4.2532949 4.2532949 ,0 9.5,0 z">
                    <路径.RenderTransform>
                        <复合变换/>
                    
                    <路径.填充>
                        
                            
                            
                        
                    
                
            
        
    
    
    
    

  3. 在 XAML 中使用它:

<Grid x:Name="LayoutRoot" Background="White">
    <toolkit:BusyIndicator IsBusy="True" Style="{StaticResource AjaxBusyIndicator}">
        <TextBox Text="TEST test test" />
    </toolkit:BusyIndicator>
</Grid>

I made my own custom BusyIndicator from Silverlight Toolkit

Here is what you need:

  1. Set the System namespace in your style file:

    xmlns:System="clr-namespace:System;assembly=mscorlib"

  2. Put the style/template in your style file:

    <ControlTemplate x:Key="AjaxBusyIndicatorControlTemplate" TargetType="toolkit:BusyIndicator">
        <Grid x:Name="ColorLayer">               
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="VisibilityStates">
                    <VisualState x:Name="Hidden">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.001" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="busycontent">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.001" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="overlay">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Visible">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.001" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="busycontent">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.001" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="overlay">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="BusyStatusStates">
                    <VisualState x:Name="Idle">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.001" Storyboard.TargetProperty="(Control.IsEnabled)" Storyboard.TargetName="content">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <System:Boolean>True</System:Boolean>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Busy">
                        <Storyboard RepeatBehavior="Forever" AutoReverse="False">
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.Rotation)" Storyboard.TargetName="loader">
                                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="359.999"/>
                            </DoubleAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.001" Storyboard.TargetProperty="(Control.IsEnabled)" Storyboard.TargetName="content">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <System:Boolean>False</System:Boolean>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <ContentControl x:Name="content" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
            <Rectangle x:Name="overlay" Style="{TemplateBinding OverlayStyle}"/>
            <ContentPresenter x:Name="busycontent">
                <Path x:Name="loader" Height="19" Width="19" Canvas.Left="0.5" Canvas.Top="0.5" Stretch="Fill" UseLayoutRounding="False" Stroke="Black" StrokeThickness="0.2" RenderTransformOrigin="0.5,0.5"
                    Data="M9.5,3 C5.9101491,3 3,5.9101491 3,9.5 C3,13.08985 5.9101491,16 9.5,16 C13.08985,16 16,13.08985 16,9.5 C16,5.9101491 13.08985,3 9.5,3 z M9.5,0 C14.746705,0 19,4.2532949 19,9.5 C19,14.746705 14.746705,19 9.5,19 C4.2532949,19 0,14.746705 0,9.5 C0,4.2532949 4.2532949,0 9.5,0 z">
                    <Path.RenderTransform>
                        <CompositeTransform/>
                    </Path.RenderTransform>
                    <Path.Fill>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FF0089FF" Offset="0"/>
                            <GradientStop Color="White" Offset="1"/>
                        </LinearGradientBrush>
                    </Path.Fill>
                </Path>
            </ContentPresenter>
        </Grid>
    </ControlTemplate>
    
    <Style x:Key="AjaxBusyIndicator" TargetType="toolkit:BusyIndicator"  >
        <Setter Property="Template" Value="{StaticResource AjaxBusyIndicatorControlTemplate}"/>
    </Style>
    
  3. Use it in your XAML:

<Grid x:Name="LayoutRoot" Background="White">
    <toolkit:BusyIndicator IsBusy="True" Style="{StaticResource AjaxBusyIndicator}">
        <TextBox Text="TEST test test" />
    </toolkit:BusyIndicator>
</Grid>

焚却相思 2024-09-16 04:08:24

嗯,确实是一个常见的场景.. Silverlight 开发人员通常使用
链接此类控件。但由于您的要求是像 AJAX 一样,我认为这个链接可能会有所帮助:
http://chrisa.wordpress.com/2008 /10/09/a-wait-indicator-in-silverlight/

以下是有关如何自定义忙碌指示器数据模板的一些提示:
http://www.jeff.wilcox.name/2009/11 /busy-indicator-control/

问候。

Well really a common scenario.. Silverlight devs usually use
Link this type of control. but as your requirement is to have it like AJAX i think this link could be helpful:
http://chrisa.wordpress.com/2008/10/09/a-wait-indicator-in-silverlight/

Here are some hints on how to customize data template for busy indicator:
http://www.jeff.wilcox.name/2009/11/busy-indicator-control/

Regards.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文