Intersoft ClientUI Documentation
GlassButton Class
Members  See Also  Send Feedback
Intersoft.Client.UI.Controls Namespace : GlassButton Class






Provides a lightweight button control with a glassed themed.

Object Model

GlassButton Class

Syntax

Visual Basic (Declaration) 
<TemplatePartAttribute(Name="ShineGlow", Type=System.Windows.Controls.Border)>
<TemplateVisualStateAttribute(Name="Disabled", GroupName="CommonStates")>
<TemplatePartAttribute(Name="GlassElement", Type=System.Windows.Controls.Grid)>
<TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")>
<TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")>
<TemplatePartAttribute(Name="GlassColor", Type=System.Windows.Controls.Border)>
<TemplatePartAttribute(Name="BaseColor", Type=System.Windows.Controls.Border)>
<TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")>
<TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")>
<TemplatePartAttribute(Name="SpreadColor", Type=System.Windows.Controls.Border)>
<TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)>
<TemplateVisualStateAttribute(GroupName="CommonStates", Name="Checked")>
<TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)>
<TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")>
<DescriptionAttribute("Provides a lightweight button control with a glass style.")>
<TemplatePartAttribute(Name="ContentPresenter", Type=System.Windows.Controls.ContentPresenter)>
Public Class GlassButton 
   Inherits Intersoft.Client.Framework.ISButton
   Implements IControlIFramework, ILicensing, INavigationSourceINavigationSupportICommandSourceIKeyboardFocus 
Visual Basic (Usage)Copy Code
Dim instance As GlassButton
C# 
[TemplatePartAttribute(Name="ShineGlow", Type=System.Windows.Controls.Border)]
[TemplateVisualStateAttribute(Name="Disabled", GroupName="CommonStates")]
[TemplatePartAttribute(Name="GlassElement", Type=System.Windows.Controls.Grid)]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")]
[TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")]
[TemplatePartAttribute(Name="GlassColor", Type=System.Windows.Controls.Border)]
[TemplatePartAttribute(Name="BaseColor", Type=System.Windows.Controls.Border)]
[TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")]
[TemplatePartAttribute(Name="SpreadColor", Type=System.Windows.Controls.Border)]
[TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Checked")]
[TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")]
[DescriptionAttribute("Provides a lightweight button control with a glass style.")]
[TemplatePartAttribute(Name="ContentPresenter", Type=System.Windows.Controls.ContentPresenter)]
public class GlassButton : Intersoft.Client.Framework.ISButton, IControlIFramework, ILicensing, INavigationSourceINavigationSupportICommandSourceIKeyboardFocus  
JScript 
TemplatePartAttribute(Name="ShineGlow", Type=System.Windows.Controls.Border)
TemplateVisualStateAttribute(Name="Disabled", GroupName="CommonStates")
TemplatePartAttribute(Name="GlassElement", Type=System.Windows.Controls.Grid)
TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")
TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")
TemplatePartAttribute(Name="GlassColor", Type=System.Windows.Controls.Border)
TemplatePartAttribute(Name="BaseColor", Type=System.Windows.Controls.Border)
TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")
TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")
TemplatePartAttribute(Name="SpreadColor", Type=System.Windows.Controls.Border)
TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)
TemplateVisualStateAttribute(GroupName="CommonStates", Name="Checked")
TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)
TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")
DescriptionAttribute("Provides a lightweight button control with a glass style.")
TemplatePartAttribute(Name="ContentPresenter", Type=System.Windows.Controls.ContentPresenter)
public class GlassButton extends Intersoft.Client.Framework.ISButton implements IControlIFramework, ILicensing, INavigationSourceINavigationSupportICommandSourceIKeyboardFocus 
Managed Extensions for C++ 
[TemplatePartAttribute(Name="ShineGlow", Type=System.Windows.Controls.Border)]
[TemplateVisualStateAttribute(Name="Disabled", GroupName="CommonStates")]
[TemplatePartAttribute(Name="GlassElement", Type=System.Windows.Controls.Grid)]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")]
[TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")]
[TemplatePartAttribute(Name="GlassColor", Type=System.Windows.Controls.Border)]
[TemplatePartAttribute(Name="BaseColor", Type=System.Windows.Controls.Border)]
[TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")]
[TemplatePartAttribute(Name="SpreadColor", Type=System.Windows.Controls.Border)]
[TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Checked")]
[TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")]
[DescriptionAttribute("Provides a lightweight button control with a glass style.")]
[TemplatePartAttribute(Name="ContentPresenter", Type=System.Windows.Controls.ContentPresenter)]
public __gc class GlassButton : public Intersoft.Client.Framework.ISButton, IControlIFramework, ILicensing, INavigationSourceINavigationSupportICommandSourceIKeyboardFocus  
C++/CLI 
[TemplatePartAttribute(Name="ShineGlow", Type=System.Windows.Controls.Border)]
[TemplateVisualStateAttribute(Name="Disabled", GroupName="CommonStates")]
[TemplatePartAttribute(Name="GlassElement", Type=System.Windows.Controls.Grid)]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")]
[TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")]
[TemplatePartAttribute(Name="GlassColor", Type=System.Windows.Controls.Border)]
[TemplatePartAttribute(Name="BaseColor", Type=System.Windows.Controls.Border)]
[TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")]
[TemplatePartAttribute(Name="SpreadColor", Type=System.Windows.Controls.Border)]
[TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Checked")]
[TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")]
[DescriptionAttribute("Provides a lightweight button control with a glass style.")]
[TemplatePartAttribute(Name="ContentPresenter", Type=System.Windows.Controls.ContentPresenter)]
public ref class GlassButton : public Intersoft.Client.Framework.ISButton, IControlIFramework, ILicensing, INavigationSourceINavigationSupportICommandSourceIKeyboardFocus  

Remarks

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");
}

Toggle Button

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>

Commanding

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.

Inheritance Hierarchy

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

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2012 All Rights Reserved.