This is a migrated thread and some comments may be shown as answers.

RadButton EventSetter Help.

0 Answers 127 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ramjet
Top achievements
Rank 1
Ramjet asked on 05 May 2011, 04:52 PM
Hello,

I have a list as a datasource for my Combobox. Whenever the DataSource has an empty value my data trigger inserts the template seen in XAML below. This works perfectly and inserts my separator and radbutton into the combolist as a comboboxitem.

<ComboBox Name="cmbo_NewSME" SelectedValue="You can begin typing the name here..." Height="25" Width="300" Margin="5,6,5,0" Loaded="cmbo_NewSME_Loaded" SelectionChanged="cmbo_NewSME_SelectionChanged">
    <ComboBox.ItemContainerStyle>
        <Style TargetType="{x:Type ComboBoxItem}" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
            <EventSetter Event="PreviewMouseLeftButtonDown" Handler="PreviewMouseLeftButtonDown" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=AD_FullName}" Value="">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                                <StackPanel Name="FullUsrListWrap" Visibility="Visible" Width="300">
                                    <Separator Name="FullList" Margin="0,10,0,5" Height="10" Width="300"/>
                                    <telerik:RadButton Name="ShowAllUsrs" Width="220" Height="20" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,5" Content="Show All Authorize-IT Users..." />
                                </StackPanel>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </ComboBox.ItemContainerStyle>
</ComboBox>

The problem is that I am unable to handle any RadButton events. As you can see above the EventSetter is at the combobox level and while this works I have to first decipher if the person actually selected a username or the "Show More..." button. So I experimented and thought about an EventSetter at the Radbutton level but I keep getting an error.
Everything is same as above except:
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
   <StackPanel Name="FullUsrListWrap" Visibility="Visible" Width="300">
      <Separator Name="FullList" Margin="0,10,0,5" Height="10" Width="300"/>
         <telerik:RadButton Name="ShowAllUsrs" Width="220" Height="20" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,5" Content="Show All Authorize-IT Users...">
            <Style>
               <EventSetter Event="Click" Handler="Click" />
            </Style>
         </telerik:RadButton>
   </StackPanel>
</ControlTemplate>

I keep getting the property Content is set more than once.....but it isn't or I'm overlooking something VERY obvious.

So the error aside what I am after is handling the button click event which may or may not be possible cause it's "disguised" as a ComboboxItem....??

Thanks
JB

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Ramjet
Top achievements
Rank 1
Share this question
or