Inserting RadButton in silverlight DataForm

2 posts, 0 answers
  1. Zeeshan
    Zeeshan avatar
    12 posts
    Member since:
    Dec 2010

    Posted 01 Dec 2010 Link to this post

    I have manually inserted the Telerik RadButton in the DataForm of silverlight by editing the default style template but unable to find the option to handle the event on that button. Style.xaml do not have a .cs file attached to it so where to place the event handler ?
    attached picture shows how the button looks like on dataform, below is the style.xaml for the dataform.
    This question is also asked on silverlight.net http://forums.silverlight.net/forums/p/211401/498211.aspx#498211
    Thanks in advance.

    <Style x:Key="DataFormStyle1" TargetType="toolkit:DataForm">
    <Setter Property="AutoCommit" Value="True"/>
    <Setter Property="AutoGenerateFields" Value="True"/>
    <Setter Property="Background">
    <Setter.Value>
    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFF3F7FA" Offset="0"/>
    <GradientStop Color="#FFFFFFFF" Offset="0.1"/>
    </LinearGradientBrush>
    </Setter.Value>
    </Setter>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="BorderBrush">
    <Setter.Value>
    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
    <GradientStop Color="#FFA3AEB9" Offset="0"/>
    <GradientStop Color="#FF8399A9" Offset="0.375"/>
    <GradientStop Color="#FF718597" Offset="0.375"/>
    <GradientStop Color="#FF617584" Offset="1"/>
    </LinearGradientBrush>
    </Setter.Value>
    </Setter>
    <Setter Property="DescriptionViewerPosition" Value="Auto"/>
    <Setter Property="LabelPosition" Value="Auto"/>
    <Setter Property="HeaderVisibility" Value="Visible"/>
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="toolkit:DataForm">
    <Grid toolkit:DataField.IsFieldGroup="True">
    <Grid.Resources>
    <Style x:Key="ButtonGeneric" TargetType="Button">
    <Setter Property="Background" Value="#00000000"/>
    <Setter Property="Foreground" Value="#FF000000"/>
    <Setter Property="BorderBrush" Value="#FFFFFFFF"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Padding" Value="1"/>
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="Button">
    <Grid>
    <VisualStateManager.VisualStateGroups>
    <VisualStateGroup x:Name="CommonStates">
    <VisualState x:Name="Normal"/>
    <VisualState x:Name="MouseOver">
    <Storyboard>
    <ColorAnimation Duration="0" To="#FFFFFFFF" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="OuterBtnBorder"/>
    <ColorAnimation Duration="0" To="#7FA9A9A9" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="InnerBtnBorder"/>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="Pressed">
    <Storyboard>
    <ColorAnimation Duration="0" To="#7FA9A9A9" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="InnerBtnBorder"/>
    <ColorAnimation Duration="0" To="#7FA9A9A9" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="InnerBtnBorder"/>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="Disabled">
    <Storyboard>
    <DoubleAnimation Duration="0" To="0.3" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="contentPresenter"/>
    </Storyboard>
    </VisualState>
    </VisualStateGroup>
    <VisualStateGroup x:Name="FocusStates">
    <VisualState x:Name="Focused">
    <Storyboard>
    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisualElement"/>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="Unfocused"/>
    </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
    <Border x:Name="OuterBtnBorder" BorderBrush="#00FFFFFF" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="3">
    <Border x:Name="InnerBtnBorder" BorderBrush="#00A9A9A9" BorderThickness="{TemplateBinding BorderThickness}" Background="#00A9A9A9" CornerRadius="2">
    <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="Center" Height="Auto" VerticalAlignment="Center" Width="Auto"/>
    </Border>
    </Border>
    <Border x:Name="FocusVisualElement" BorderBrush="#FF6DBDD1" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="2" Margin="1" Opacity="0"/>
    </Grid>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>
    <Style x:Key="CustomScrollViewerStyle" TargetType="ScrollViewer">
    <Setter Property="HorizontalContentAlignment" Value="Left"/>
    <Setter Property="VerticalContentAlignment" Value="Top"/>
    <Setter Property="BorderThickness" Value="0,1"/>
    <Setter Property="BorderBrush">
    <Setter.Value>
    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFA3AEB9" Offset="0"/>
    <GradientStop Color="#FF8399A9" Offset="0.375"/>
    <GradientStop Color="#FF718597" Offset="0.375"/>
    <GradientStop Color="#FF617584" Offset="1"/>
    </LinearGradientBrush>
    </Setter.Value>
    </Setter>
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="ScrollViewer">
    <Grid>
    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="0,-1" Opacity="0.2" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}">
    <Border.OpacityMask>
    <LinearGradientBrush EndPoint="1.07,0.5" StartPoint="-0.07,0.5">
    <GradientStop Color="#FF000000"/>
    <GradientStop Color="#7FFFFFFF" Offset="0.5"/>
    <GradientStop Color="#FF000000" Offset="1"/>
    </LinearGradientBrush>
    </Border.OpacityMask>
    </Border>
    <Grid Background="{TemplateBinding Background}">
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="*"/>
    <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
    <RowDefinition Height="*"/>
    <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <ScrollContentPresenter x:Name="ScrollContentPresenter" Cursor="{TemplateBinding Cursor}" ContentTemplate="{TemplateBinding ContentTemplate}" Margin="{TemplateBinding Padding}"/>
    <Rectangle Grid.Column="1" Fill="#FFE9EEF4" Grid.Row="1"/>
    <ScrollBar x:Name="VerticalScrollBar" Grid.Column="1" IsTabStop="False" Maximum="{TemplateBinding ScrollableHeight}" Margin="0,-1" Minimum="0" Orientation="Vertical" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{TemplateBinding VerticalOffset}" ViewportSize="{TemplateBinding ViewportHeight}" Width="18"/>
    <ScrollBar x:Name="HorizontalScrollBar" Grid.Column="0" Height="18" IsTabStop="False" Maximum="{TemplateBinding ScrollableWidth}" Margin="-1,0,-1,-1" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{TemplateBinding HorizontalOffset}" ViewportSize="{TemplateBinding ViewportWidth}"/>
    </Grid>
    </Grid>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>
    </Grid.Resources>
    <VisualStateManager.VisualStateGroups>
    <VisualStateGroup x:Name="CommonStates">
    <VisualState x:Name="Normal"/>
    <VisualState x:Name="Disabled">
    <Storyboard>
    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="DisabledVisual"/>
    </Storyboard>
    </VisualState>
    </VisualStateGroup>
    <VisualStateGroup x:Name="ModeStates">
    <VisualState x:Name="ReadOnly"/>
    <VisualState x:Name="Empty">
    <Storyboard>
    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="IsHitTestVisible" Storyboard.TargetName="ContentPresenter">
    <DiscreteObjectKeyFrame KeyTime="0" Value="False"/>
    </ObjectAnimationUsingKeyFrames>
    <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentPresenter"/>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="Edit">
    <Storyboard>
    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="IsEnabled" Storyboard.TargetName="EditButton">
    <DiscreteObjectKeyFrame KeyTime="0" Value="false"/>
    </ObjectAnimationUsingKeyFrames>
    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="CommitButton">
    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
    </ObjectAnimationUsingKeyFrames>
    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="CancelButton">
    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
    </ObjectAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    </VisualStateGroup>
    <VisualStateGroup x:Name="ValidationStates">
    <VisualState x:Name="Valid"/>
    <VisualState x:Name="Invalid"/>
    </VisualStateGroup>
    <VisualStateGroup x:Name="CommittedStates">
    <VisualState x:Name="Committed"/>
    <VisualState x:Name="Uncommitted">
    <Storyboard>
    <DoubleAnimation Duration="0" To="0.9" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ChangeIndicator"/>
    </Storyboard>
    </VisualState>
    </VisualStateGroup>
    <VisualStateGroup x:Name="ScopeStates">
    <VisualState x:Name="Entity"/>
    <VisualState x:Name="Collection"/>
    </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
    <Border x:Name="DataFormBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="2">
    <Grid>
    <Grid.RowDefinitions>
    <RowDefinition Height="Auto"/>
    <RowDefinition/>
    <RowDefinition Height="Auto"/>
    <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <Grid MinHeight="27" Visibility="{TemplateBinding HeaderVisibility}">
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto"/>
    <ColumnDefinition/>
    <ColumnDefinition Width="Auto"/>
    <ColumnDefinition Width="8"/>
    </Grid.ColumnDefinitions>
    <StackPanel Orientation="Horizontal">
    <ContentControl x:Name="HeaderElement" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Foreground="{TemplateBinding Foreground}" FontWeight="Bold" Margin="10,0,0,0" VerticalAlignment="Center"/>
    <TextBlock x:Name="ChangeIndicator" Foreground="{TemplateBinding Foreground}" FontWeight="Bold" Margin="3,-2,8,2" Opacity="0" Text="*" VerticalAlignment="Center"/>
    </StackPanel>
                                        <telerik:RadButton Grid.Column="0" x:Name="SearchButton" Content="Search" IsEnabled="True" Width="60" Height="23" HorizontalAlignment="Left" Margin="10,10,0,0" Click="SearchButton_Click" />
    <StackPanel Grid.Column="2" Margin="0,3,0,2" Orientation="Horizontal">
                                           <Button x:Name="FirstItemButton" Style="{StaticResource ButtonGeneric}">
    <Grid Height="9" Margin="6,5,5,5" Opacity="1" Width="8">
    <Grid.Effect>
    <DropShadowEffect BlurRadius="8" Color="#FFFFFFFF" Direction="100" Opacity="1" ShadowDepth="0"/>
    </Grid.Effect>
    <Grid.OpacityMask>
    <LinearGradientBrush EndPoint="0.6,1" StartPoint="0.4,0">
    <GradientStop Color="#7FFFFFFF" Offset="0"/>
    <GradientStop Color="#BF000000" Offset="0.25"/>
    <GradientStop Color="#FF000000" Offset="1"/>
    </LinearGradientBrush>
    </Grid.OpacityMask>
    <Path Data="M1,0 L1,2 L0,1 Z" Fill="{TemplateBinding Foreground}" HorizontalAlignment="Right" Height="9" Margin="0" Opacity="0.85" Stretch="Fill" Width="5"/>
    <Rectangle Fill="{TemplateBinding Foreground}" HorizontalAlignment="Left" Opacity="0.85" Width="2"/>
    </Grid>
    </Button>
    <Button x:Name="PreviousItemButton" Style="{StaticResource ButtonGeneric}">
    <Path Data="M1,0 L1,2 L0,1 Z" Fill="{TemplateBinding Foreground}" Height="9" Margin="6,5,8,5" Opacity="0.85" Stretch="Fill" Width="5">
    <Path.Effect>
    <DropShadowEffect BlurRadius="8" Color="#FFFFFFFF" Direction="100" ShadowDepth="0"/>
    </Path.Effect>
    <Path.OpacityMask>
    <LinearGradientBrush EndPoint="0.6,1" StartPoint="0.4,0">
    <GradientStop Color="#7F000000" Offset="0"/>
    <GradientStop Color="#BF000000" Offset="0.25"/>
    <GradientStop Color="#FF000000" Offset="1"/>
    </LinearGradientBrush>
    </Path.OpacityMask>
    </Path>
    </Button>
    <Button x:Name="NextItemButton" Style="{StaticResource ButtonGeneric}">
    <Path Data="M0,0 L1,1 L0,2 Z" Fill="{TemplateBinding Foreground}" Height="9" Margin="8,5,6,5" Opacity="0.85" Stretch="Fill" Width="5">
    <Path.Effect>
    <DropShadowEffect BlurRadius="8" Color="#FFFFFFFF" Direction="100" ShadowDepth="0"/>
    </Path.Effect>
    <Path.OpacityMask>
    <LinearGradientBrush EndPoint="0.6,1" StartPoint="0.4,0">
    <GradientStop Color="#7F000000" Offset="0"/>
    <GradientStop Color="#BF000000" Offset="0.25"/>
    <GradientStop Color="#FF000000" Offset="1"/>
    </LinearGradientBrush>
    </Path.OpacityMask>
    </Path>
    </Button>
    <Button x:Name="LastItemButton" Style="{StaticResource ButtonGeneric}">
    <Grid Height="9" Margin="6,5,5,5" Opacity="1" Width="8">
    <Grid.Effect>
    <DropShadowEffect BlurRadius="8" Color="#FFFFFFFF" Direction="100" ShadowDepth="0"/>
    </Grid.Effect>
    <Grid.OpacityMask>
    <LinearGradientBrush EndPoint="0.6,1" StartPoint="0.4,0">
    <GradientStop Color="#7F000000" Offset="0"/>
    <GradientStop Color="#BF000000" Offset="0.25"/>
    <GradientStop Color="#FF000000" Offset="1"/>
    </LinearGradientBrush>
    </Grid.OpacityMask>
    <Path Data="M0,0 L1,1 L0,2 Z" Fill="{TemplateBinding Foreground}" HorizontalAlignment="Left" Height="9" Opacity="0.85" Stretch="Fill" Width="5"/>
    <Rectangle Fill="{TemplateBinding Foreground}" HorizontalAlignment="Right" Opacity="0.85" Width="2"/>
    </Grid>
    </Button>
    <Border x:Name="ButtonSeparator" BorderBrush="#59FFFFFF" BorderThickness="1,0,1,0" Background="{TemplateBinding BorderBrush}" Margin="2,4,2,4" Opacity="0.2" Width="3"/>
    <Button x:Name="EditButton" Style="{StaticResource ButtonGeneric}" ToolTipService.ToolTip="Edit">
    <Button.OpacityMask>
    <LinearGradientBrush EndPoint="0.57,0.76" StartPoint="0.42,0.01">
    <GradientStop Color="#7F000000" Offset="0"/>
    <GradientStop Color="#BF000000" Offset="0.442"/>
    <GradientStop Color="#FF000000" Offset="1"/>
    </LinearGradientBrush>
    </Button.OpacityMask>
    <Grid HorizontalAlignment="Center" Height="19" VerticalAlignment="Center" Width="19">
    <Canvas HorizontalAlignment="Stretch" Margin="2,2,0,0" VerticalAlignment="Stretch">
    <Path Data="F1 M 2.53,9.96L 4.96,11.1L 6.08,13.50L 13.09,6.50L 9.6,3L 2.53,9.96 Z " Fill="{TemplateBinding Foreground}" Height="10.5" Canvas.Left="2.53" Stretch="Fill" Canvas.Top="3.01" Width="10.56">
    <Path.OpacityMask>
    <LinearGradientBrush EndPoint="0.76,0.77" StartPoint="0.21,0.18">
    <GradientStop Color="#7F000000" Offset="0"/>
    <GradientStop Color="#59000000" Offset="0.106"/>
    <GradientStop Color="#3F000000" Offset="0.387"/>
    <GradientStop Color="#99000000" Offset="0.703"/>
    <GradientStop Color="#CC000000" Offset="1"/>
    </LinearGradientBrush>
    </Path.OpacityMask>
    </Path>
    <Path Data="M1.41,1.83 L0.71,2.54 L4.20,6.03 L4.91,5.33 z M3.24,0 L6.81,3.42 L3.5,6.74 L0,3.24 z" Fill="{TemplateBinding Foreground}" Height="6.74" Canvas.Left="7.47" Stretch="Fill" Canvas.Top="1.89" Width="6.81"/>
    <Path Data="F1 M 13.77,4.22L 11.73,2.18C 11.12,1.78 10.46,2.15 10,2.5L 3.04,9.45C 2.65,9.86 2.53,10.47 2.53,10.73L 2.53,13.5L 5.32,13.5C 5.57,13.5 6.33,13.36 6.64,12.93L 13.54,6.03C 13.86,5.72 14.17,4.74 13.77,4.22 Z" Height="12.5" Canvas.Left="2.03" Stretch="Fill" Stroke="{TemplateBinding Foreground}" StrokeLineJoin="Round" Canvas.Top="1.50" Width="12.43"/>
    <Path Data="F1 M 2.033,11.71L 4.33,14L 2.62,14C 2.17,13.93 2.09,13.79 2,13.31L 2.03,11.71 Z" Fill="{TemplateBinding Foreground}" Height="2.29" Canvas.Left="2.58" Stretch="Fill" Canvas.Top="11.18" Width="2.33"/>
    </Canvas>
    </Grid>
    </Button>
    <Button x:Name="NewItemButton" Style="{StaticResource ButtonGeneric}" ToolTipService.ToolTip="Add">
    <Path Data="F1 M18.41,61.67 L19.56,60.52 L21.92,62.88 L24.22,60.57 L25.36,61.72 L23.06,64.03 L25.43,66.4 L24.22,67.60 L21.87,65.25 L19.56,67.56 L18.41,66.41 L20.73,64.08 L18.41,61.67 z" Fill="{TemplateBinding Foreground}" HorizontalAlignment="Center" Height="9" Margin="5" Opacity="0.85" RenderTransformOrigin="0.5,0.5" Stretch="Fill" VerticalAlignment="Center" Width="9">
    <Path.Effect>
    <DropShadowEffect BlurRadius="8" Color="#FFFFFFFF" Direction="100" ShadowDepth="0"/>
    </Path.Effect>
    <Path.OpacityMask>
    <LinearGradientBrush EndPoint="0.35,0.5" StartPoint="-0.27,0.05">
    <GradientStop Color="#7F000000" Offset="0"/>
    <GradientStop Color="#BF000000" Offset="0.25"/>
    <GradientStop Color="#FF000000" Offset="1"/>
    </LinearGradientBrush>
    </Path.OpacityMask>
    <Path.RenderTransform>
    <TransformGroup>
    <ScaleTransform/>
    <SkewTransform/>
    <RotateTransform Angle="45"/>
    <TranslateTransform X="0.18" Y="-0.07"/>
    </TransformGroup>
    </Path.RenderTransform>
    </Path>
    </Button>
    <Button x:Name="DeleteItemButton" Style="{StaticResource ButtonGeneric}" ToolTipService.ToolTip="Delete">
    <Path Data="F1 M24.32,60.48 L25.60,61.76 L19.65,67.75 L18.37,66.46 z" Fill="{TemplateBinding Foreground}" HorizontalAlignment="Center" Height="9" Margin="5,5,5,5" Opacity="0.85" RenderTransformOrigin="0.5,0.5" Stretch="Fill" VerticalAlignment="Center" Width="9">
    <Path.Effect>
    <DropShadowEffect BlurRadius="8" Color="#FFFFFFFF" Direction="100" ShadowDepth="0"/>
    </Path.Effect>
    <Path.OpacityMask>
    <LinearGradientBrush EndPoint="0.74,0.66" StartPoint="-0.44,-0.11">
    <GradientStop Color="#7F000000" Offset="0"/>
    <GradientStop Color="#BF000000" Offset="0.25"/>
    <GradientStop Color="#FF000000" Offset="1"/>
    </LinearGradientBrush>
    </Path.OpacityMask>
    <Path.RenderTransform>
    <TransformGroup>
    <RotateTransform Angle="45"/>
    <TranslateTransform X="0.06" Y="-0.01"/>
    </TransformGroup>
    </Path.RenderTransform>
    </Path>
    </Button>
                                           
    </StackPanel>
    </Grid>
    <ScrollViewer Background="{x:Null}" IsTabStop="False" Padding="{TemplateBinding Padding}" Grid.Row="1" Style="{StaticResource CustomScrollViewerStyle}" VerticalScrollBarVisibility="Auto">
    <ContentPresenter x:Name="ContentPresenter" Margin="12,12,6,12"/>
    </ScrollViewer>
    <sdk:ValidationSummary x:Name="ValidationSummary" BorderThickness="0" MaxHeight="100" Grid.Row="2"/>
    <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.Row="3">
    <Button x:Name="CommitButton" Content="OK" HorizontalContentAlignment="Center" Margin="0,5,8,5" MinWidth="71" MinHeight="17" Visibility="Collapsed" VerticalContentAlignment="Center"/>
    <Button x:Name="CancelButton" Content="Cancel" HorizontalContentAlignment="Center" Margin="0,5,8,5" MinWidth="71" MinHeight="17" Visibility="Collapsed" VerticalContentAlignment="Center"/>
    </StackPanel>
    </Grid>
    </Border>
    <Border x:Name="DisabledVisual" Background="#8CFFFFFF" CornerRadius="2" IsHitTestVisible="False" Opacity="0"/>
    </Grid>
    </ControlTemplate>
    </Setter.Value>
    </Setter>





    </Style>








     
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 06 Dec 2010 Link to this post

    Hi Zeeshan,

    I noticed that there is a possible solution offered in the silverlight.net thread. However, another approach is to add a handler for the RadButton.ClickEvent, like so:
    this.AddHandler(RadButton.ClickEvent, new RoutedEventHandler(SearchButton_Click));
    I attached a sample project illustrating this.

    Yet, another approach is to bind the RadButton Command property.

    Also, please keep in mind that walking through the VisualTree (for example by implementing the FindChildByType() method) is an expensive operation and therefore it is best to implement one of the above mentioned approaches. Furthermore, when using MVVM it is best to bind the Command property of the RadButton thus keeping all the logic in the ViewModel.

    I hope this info will help you. Let us know if we can further assist you.

    Regards,
    Tina Stancheva
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
Back to Top