This question is locked. New answers and comments are not allowed.
I want to add a "FileOpen" editor to the propertygrid.
My datatemplate contains a textbox and a radbutton, i want to be able to hook the buttonclick event so i can popup a filedialog. I can create the template and put it in the propertygrid.
<Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="TextBox"> <Grid x:Name="RootElement"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="20" /> </Grid.ColumnDefinitions> <Border x:Name="Border" Grid.ColumnSpan="3" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{StaticResource ControlOuterBorder_CornerRadius}" Opacity="1" /> <Border x:Name="ReadOnlyVisualElement" Grid.ColumnSpan="3" Background="{StaticResource ControlBackground_ReadOnly}" CornerRadius="{StaticResource ControlOuterBorder_CornerRadius}" Opacity="0" /> <Border x:Name="DisabledVisualElement" Grid.ColumnSpan="3" Background="{StaticResource ControlBackground_Disabled}" BorderBrush="{StaticResource ControlOuterBorder_Disabled}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{StaticResource ControlOuterBorder_CornerRadius}" IsHitTestVisible="False" Opacity="0" /> <ScrollViewer x:Name="ContentElement" Grid.ColumnSpan="2" BorderThickness="0" IsTabStop="False" Padding="{TemplateBinding Padding}" /> <Border x:Name="FocusVisualElement" Grid.ColumnSpan="3" BorderBrush="{StaticResource ControlOuterBorder_Focused}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{StaticResource ControlOuterBorder_CornerRadius}" IsHitTestVisible="False" Opacity="0" /> <!-- SearchButton --> <telerik:RadButton Grid.Column="2" Margin="5 3" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Style="{StaticResource SearchButton}" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>My datatemplate will then be:
<DataTemplate x:Key="SearchFileTextBox"> <TextBox Text="{Binding Path, Mode=TwoWay}" Style="{StaticResource SearchTextBoxStyle}" /> </DataTemplate>I can not figure out how i can hook the click event on the button.