Browse Source

added BusyIndicator samples to the Sample application.

pull/1645/head
brianlagunas_cp 15 years ago
parent
commit
77543e30e0
  1. BIN
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Images/CdBurning32.png
  2. 7
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Samples.Modules.BusyIndicator.csproj
  3. 132
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/HomeView.xaml
  4. 14
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/HomeView.xaml.cs
  5. 4
      ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Themes/Generic.xaml

BIN
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Images/CdBurning32.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

7
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Samples.Modules.BusyIndicator.csproj

@ -89,6 +89,10 @@
<AppDesigner Include="Properties\" /> <AppDesigner Include="Properties\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\WPFToolkit.Extended\WPFToolkit.Extended.csproj">
<Project>{72E591D6-8F83-4D8C-8F67-9C325E623234}</Project>
<Name>WPFToolkit.Extended</Name>
</ProjectReference>
<ProjectReference Include="..\..\Samples.Infrastructure\Samples.Infrastructure.csproj"> <ProjectReference Include="..\..\Samples.Infrastructure\Samples.Infrastructure.csproj">
<Project>{A4A049A4-665A-4651-9046-7D06E9D0CCDC}</Project> <Project>{A4A049A4-665A-4651-9046-7D06E9D0CCDC}</Project>
<Name>Samples.Infrastructure</Name> <Name>Samples.Infrastructure</Name>
@ -104,6 +108,9 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Images\CdBurning32.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>xcopy "$(TargetDir)*.*" "$(SolutionDir)Src\Samples\Samples\bin\$(ConfigurationName)\" /Y <PostBuildEvent>xcopy "$(TargetDir)*.*" "$(SolutionDir)Src\Samples\Samples\bin\$(ConfigurationName)\" /Y

132
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/HomeView.xaml

@ -1,14 +1,142 @@
<infControls:DemoView x:Class="Samples.Modules.BusyIndicator.HomeView" <infControls:DemoView x:Class="Samples.Modules.BusyIndicator.HomeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Samples.Modules.BusyIndicator"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="BusyIndicator"> Title="BusyIndicator">
<infControls:DemoView.Resources>
<local:IntegerToTimespanConverter x:Key="TimeSpanConverter" />
<DataTemplate x:Key="SampleContent" >
<Grid Margin="10" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="First Name:" Margin="2" VerticalAlignment="Center" />
<extToolkit:WatermarkTextBox Grid.Row="0" Grid.Column="1" Margin="2" VerticalAlignment="Center" Watermark="Enter First Name" />
<TextBlock Grid.Row="1" Text="Last Name:" Margin="2" VerticalAlignment="Center" />
<extToolkit:WatermarkTextBox Grid.Row="1" Grid.Column="1" Margin="2" VerticalAlignment="Center" Watermark="Enter Last Name" />
<TextBlock Grid.Row="2" Text="Date of Birth:" Margin="2" VerticalAlignment="Center" />
<extToolkit:DateTimeUpDown Grid.Row="2" Grid.Column="1" Format="ShortDate" Margin="2" VerticalAlignment="Center" Watermark="Enter Date of Birth" />
<TextBlock Grid.Row="3" Text="Salary:" Margin="2" VerticalAlignment="Center" />
<extToolkit:IntegerUpDown Grid.Row="3" Grid.Column="1" FormatString="C2" Margin="2" VerticalAlignment="Center" Watermark="Enter Salary" />
<TextBlock Grid.Row="4" Text="Favorite Color:" Margin="2" VerticalAlignment="Center" />
<extToolkit:ColorPicker Grid.Row="4" Grid.Column="1" Margin="2" VerticalAlignment="Center" />
<StackPanel Grid.Row="5" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
<Button Width="65" Margin="2">OK</Button>
<Button Width="65" Margin="2">Cancel</Button>
</StackPanel>
</Grid>
</DataTemplate>
</infControls:DemoView.Resources>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Grid.Row="1" Margin="10" Text="BusyIndicator makes it easy to let the user know when an application is busy. Simply wrap the relevant content in an instance of the BusyIndicator control and toggle its IsBusy property to True during any long-running process."
<TextBlock Text="BusyIndicator makes it easy to let the user know when an application is busy. Simply wrap the relevant content in an instance of the BusyIndicator control and toggle its IsBusy property to True during any long-running process."
TextWrapping="Wrap" /> TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" >
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="IsBusy:" VerticalAlignment="Center" Margin="2"/>
<CheckBox x:Name="_isBusy" Grid.Column="1" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="When true shows the BusyIndicator" />
<TextBlock Text="DisplayAfter:" Grid.Row="1" VerticalAlignment="Center" Margin="2"/>
<StackPanel Grid.Row="1" Grid.Column="1" Margin="5" HorizontalAlignment="Left" Orientation="Horizontal">
<extToolkit:IntegerUpDown x:Name="_displayAfter" Width="65" VerticalAlignment="Center" Minimum="0" Increment="100" Value="0" ToolTip="Sets the TimeSpan to wait until the BusyIndicator is displayed." />
<TextBlock Text="milliseconds" Margin="5,0" VerticalAlignment="Center"/>
</StackPanel>
</Grid>
</GroupBox>
<StackPanel Grid.Row="2" Margin="10">
<TextBlock Text="Default:" Style="{StaticResource Header}" />
<extToolkit:BusyIndicator IsBusy="{Binding IsChecked, ElementName=_isBusy}" DisplayAfter="{Binding Value, ElementName=_displayAfter, Converter={StaticResource TimeSpanConverter}}" >
<ContentControl ContentTemplate="{StaticResource SampleContent}" />
</extToolkit:BusyIndicator>
<TextBlock Text="Custom Content:" Style="{StaticResource Header}" />
<extToolkit:BusyIndicator IsBusy="{Binding IsChecked, ElementName=_isBusy}" DisplayAfter="{Binding Value, ElementName=_displayAfter, Converter={StaticResource TimeSpanConverter}}">
<extToolkit:BusyIndicator.BusyContent>
<StackPanel Orientation="Horizontal" >
<Image Source="/Samples.Modules.BusyIndicator;component/Images/CdBurning32.png" />
<StackPanel Margin="5,0">
<TextBlock Text="Burning CD..." VerticalAlignment="Center" />
<TextBlock Text="Madonna - Like a Virgin" VerticalAlignment="Center" Margin="8,0" />
</StackPanel>
</StackPanel>
</extToolkit:BusyIndicator.BusyContent>
<ContentControl ContentTemplate="{StaticResource SampleContent}" />
</extToolkit:BusyIndicator>
<TextBlock Grid.Row="2" Text="Custom Template:" Style="{StaticResource Header}" />
<extToolkit:BusyIndicator IsBusy="{Binding IsChecked, ElementName=_isBusy}" DisplayAfter="{Binding Value, ElementName=_displayAfter, Converter={StaticResource TimeSpanConverter}}" >
<extToolkit:BusyIndicator.BusyContentTemplate>
<DataTemplate>
<StackPanel Margin="4">
<TextBlock Text="Downloading Email" FontWeight="Bold" HorizontalAlignment="Center"/>
<StackPanel Margin="4">
<TextBlock Text="Downloading message 4/10..."/>
<ProgressBar Value="40" Height="15"/>
</StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Content="Pause" HorizontalAlignment="Right" Margin="0 0 2 0"/>
<Button Grid.Column="1" Content="Cancel" HorizontalAlignment="Left" Margin="2 0 0 0"/>
</Grid>
</StackPanel>
</DataTemplate>
</extToolkit:BusyIndicator.BusyContentTemplate>
<extToolkit:BusyIndicator.OverlayStyle>
<Style TargetType="Rectangle">
<Setter Property="Fill" Value="#B1EB1D1D"/>
</Style>
</extToolkit:BusyIndicator.OverlayStyle>
<extToolkit:BusyIndicator.ProgressBarStyle>
<Style TargetType="ProgressBar">
<Setter Property="Visibility" Value="Collapsed"/>
</Style>
</extToolkit:BusyIndicator.ProgressBarStyle>
<ContentControl ContentTemplate="{StaticResource SampleContent}" />
</extToolkit:BusyIndicator>
</StackPanel>
</Grid> </Grid>
</infControls:DemoView> </infControls:DemoView>

14
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/HomeView.xaml.cs

@ -1,6 +1,7 @@
using System; using System;
using Samples.Infrastructure.Controls; using Samples.Infrastructure.Controls;
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using System.Windows.Data;
namespace Samples.Modules.BusyIndicator namespace Samples.Modules.BusyIndicator
{ {
@ -15,4 +16,17 @@ namespace Samples.Modules.BusyIndicator
InitializeComponent(); InitializeComponent();
} }
} }
public class IntegerToTimespanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return TimeSpan.FromMilliseconds((int)value);
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
} }

4
ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Themes/Generic.xaml

@ -120,7 +120,9 @@
<Grid> <Grid>
<TabControl TabStripPlacement="Top" Style="{StaticResource TabControlStyle}" > <TabControl TabStripPlacement="Top" Style="{StaticResource TabControlStyle}" >
<TabItem Header="Sample" Style="{StaticResource TabItemStyle}"> <TabItem Header="Sample" Style="{StaticResource TabItemStyle}">
<ContentPresenter Margin="10" /> <ScrollViewer VerticalScrollBarVisibility="Auto" >
<ContentPresenter Margin="10" ScrollViewer.CanContentScroll="True" />
</ScrollViewer>
</TabItem> </TabItem>
<TabItem Header="XAML" Style="{StaticResource TabItemStyle}"> <TabItem Header="XAML" Style="{StaticResource TabItemStyle}">
<ContentPresenter x:Name="_xamlCode" Content="{Binding XamlText, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource XamlColorConverter}}" <ContentPresenter x:Name="_xamlCode" Content="{Binding XamlText, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource XamlColorConverter}}"

Loading…
Cancel
Save