Intersoft.Client.UI.Controls Namespace : GlassButton Class |
<TemplateVisualStateAttribute(Name="Disabled", GroupName="CommonStates")> <TemplatePartAttribute(Name="BaseColor", Type=System.Windows.Controls.Border)> <TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")> <TemplateVisualStateAttribute(GroupName="CommonStates", Name="Checked")> <TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")> <TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")> <TemplatePartAttribute(Name="ContentPresenter", Type=System.Windows.Controls.ContentPresenter)> <TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")> <TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="ShineGlow", Type=System.Windows.Controls.Border)> <TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")> <DescriptionAttribute("Provides a lightweight button control with a glass style.")> <TemplatePartAttribute(Name="GlassElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="SpreadColor", Type=System.Windows.Controls.Border)> <TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)> <TemplatePartAttribute(Name="GlassColor", Type=System.Windows.Controls.Border)> Public Class GlassButton Inherits Intersoft.Client.Framework.ISButton Implements Intersoft.Client.Framework.IControl, Intersoft.Client.Framework.IFramework, Intersoft.Client.Framework.ILicensing, Intersoft.Client.Framework.INavigationSource, Intersoft.Client.Framework.INavigationSupport, Intersoft.Client.Framework.Input.ICommandSource, Intersoft.Client.Framework.Input.IKeyboardFocus
Dim instance As GlassButton
[TemplateVisualStateAttribute(Name="Disabled", GroupName="CommonStates")] [TemplatePartAttribute(Name="BaseColor", Type=System.Windows.Controls.Border)] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Checked")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")] [TemplatePartAttribute(Name="ContentPresenter", Type=System.Windows.Controls.ContentPresenter)] [TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")] [TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="ShineGlow", Type=System.Windows.Controls.Border)] [TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")] [DescriptionAttribute("Provides a lightweight button control with a glass style.")] [TemplatePartAttribute(Name="GlassElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="SpreadColor", Type=System.Windows.Controls.Border)] [TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)] [TemplatePartAttribute(Name="GlassColor", Type=System.Windows.Controls.Border)] public class GlassButton : Intersoft.Client.Framework.ISButton, Intersoft.Client.Framework.IControl, Intersoft.Client.Framework.IFramework, Intersoft.Client.Framework.ILicensing, Intersoft.Client.Framework.INavigationSource, Intersoft.Client.Framework.INavigationSupport, Intersoft.Client.Framework.Input.ICommandSource, Intersoft.Client.Framework.Input.IKeyboardFocus
[TemplateVisualStateAttribute(Name="Disabled", GroupName="CommonStates")] [TemplatePartAttribute(Name="BaseColor", Type=System.Windows.Controls.Border)] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Checked")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")] [TemplatePartAttribute(Name="ContentPresenter", Type=System.Windows.Controls.ContentPresenter)] [TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")] [TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="ShineGlow", Type=System.Windows.Controls.Border)] [TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")] [DescriptionAttribute("Provides a lightweight button control with a glass style.")] [TemplatePartAttribute(Name="GlassElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="SpreadColor", Type=System.Windows.Controls.Border)] [TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)] [TemplatePartAttribute(Name="GlassColor", Type=System.Windows.Controls.Border)] public ref class GlassButton : public Intersoft.Client.Framework.ISButton, Intersoft.Client.Framework.IControl, Intersoft.Client.Framework.IFramework, Intersoft.Client.Framework.ILicensing, Intersoft.Client.Framework.INavigationSource, Intersoft.Client.Framework.INavigationSupport, Intersoft.Client.Framework.Input.ICommandSource, Intersoft.Client.Framework.Input.IKeyboardFocus
GlassButton is inherited from ISButton class which includes fundamental features such as Commanding, Navigation, Toggle, ClickMode and more. To learn more about commanding, see Commanding Overview. To learn more about navigation, see Navigation Overview.
XAML |
Copy Code
|
---|---|
<Intersoft:GlassButton Content="Try Now" VerticalAlignment="Top" HorizontalAlignment="Left" Padding="8,4" Click="GlassButton_Click"></Intersoft:GlassButton> |
C# |
Copy Code
|
---|---|
private void GlassButton_Click(object sender, RoutedEventArgs e) { MessageBox.Show("Glass Button Clicked"); } |
To configure GlassButton as toggle button you need to set the IsToggleButton property to True and specify the GroupName that group the buttons together.
The following example shows how to configure GlassButton as toggle button.
XAML |
Copy Code
|
---|---|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal"> <Intersoft:GlassButton Content="ON" Width="50" GroupName="ToggleGroup" IsToggleButton="True" IsChecked="True"/> <Intersoft:GlassButton Content="OFF" Width="50" GroupName="ToggleGroup" IsToggleButton="True"/> </StackPanel> |
Similar to other button controls in ClientUI, GlassButton supports commands that you can bind using MVVM pattern.
The following example shows how to bind a command to GlassButton.
C# |
Copy Code
|
---|---|
using System.ComponentModel; using System.Windows; using Intersoft.Client.Framework.Input; namespace ClientUI.Samples.ViewModels { public class MainPageViewModel : INotifyPropertyChanged { public DelegateCommand SubmitCommand { get; set; } public MainPageViewModel() { this.SubmitCommand = new DelegateCommand(ExecuteSubmit, CanExecuteSubmit); } private bool CanExecuteSubmit(object parameter) { return true; // you can use validation here to determine when the command is available. } private void ExecuteSubmit(object parameter) { MessageBox.Show("Submit"); } protected void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } } public event PropertyChangedEventHandler PropertyChanged; } } |
XAML |
Copy Code
|
---|---|
<Grid x:Name="LayoutRoot" Background="White"> <Grid.DataContext> <vm:MainPageViewModel/> </Grid.DataContext> <Intersoft:GlassButton Content="Submit" HorizontalAlignment="Center" VerticalAlignment="Center" Command="{Binding SubmitCommand}"> </Intersoft:GlassButton> </Grid> |
To learn more about commanding, see Commanding Overview.
System.Object
System.Windows.DependencyObject
System.Windows.UIElement
System.Windows.FrameworkElement
System.Windows.Controls.Control
System.Windows.Controls.ContentControl
System.Windows.Controls.Primitives.ButtonBase
System.Windows.Controls.Button
Intersoft.Client.Framework.ISButton
Intersoft.Client.UI.Controls.GlassButton
Intersoft.Client.UI.Aqua.UXFlow.UXFlowControlPanelButton
Intersoft.Client.UI.Aqua.UXFlow.VideoPlayerButton
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2