Hi All,
I have a datagrid with one of datacolumn contains a combobox.
DataGrid contains a RowDetails template attached to it.
When i add a row into datagrid on click of button or delete a row from datagrid, selection change event of combobox gets called.
RowDetails template also contains a combobox with a selection change event.
When i am trying to click somewhere inside the rowdetailstemplate or trying to use a template scroll bar, combobox selection change event is getting fired.
Please provide the solution how we can avoid selection change event of combobox in above cases.
Please find below piece of code:
<telerik:RadGridView ItemsSource="{Binding Path=Customers}"
IsReadOnly="{Binding IsChecked, Mode=TwoWay, ElementName=IsReadOnlyCheckBox}" RowDetailsVisibilityMode="{Binding RowDetailsTemplateVisibilityMode, Mode=TwoWay}"
SelectionMode="Multiple" AutoGenerateColumns="False" VerticalAlignment="Stretch"
ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Visible" MinHeight="100" MaxHeight="350">
<telerik:RadGridView.Columns>
<telerik:GridViewToggleRowDetailsColumn Width="30"/>
<telerik:GridViewSelectColumn Width="30"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding SlNo}" Header="S.no" IsReadOnly="True" IsEnabled="False" Width="20" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Product}" Header="Product" IsReadOnly="True" IsEnabled="False" Width="250"/>
<telerik:GridViewDataColumn Header="Customer" Width="Auto">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding Path=Customer}" HorizontalAlignment="Left" DisplayMemberPath="RunDesc" SelectedItem="{Binding RunsSelected}" IsEnabled="{Binding IsEnabledRun}" Style="{StaticResource SmallComboBox}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<cmd:EventToCommand Command="{Binding Path=LoadCustomersCommand}" PassEventArgsToCommand="False" CommandParameter="{Binding Path=DataContext,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ComboBox}}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</ComboBox>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
<telerik:RadGridView.RowDetailsTemplate >
<DataTemplate>
<Grid Background="{StaticResource MainBackgroundColor}" >
<ComboBox ItemsSource="{Binding Path=Customer}" HorizontalAlignment="Left" DisplayMemberPath="RunDesc" SelectedItem="{Binding RunsSelected}" IsEnabled="{Binding IsEnabledRun}" Style="{StaticResource SmallComboBox}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<cmd:EventToCommand Command="{Binding Path=LoadCustomersCommand}" PassEventArgsToCommand="False" CommandParameter="{Binding Path=DataContext,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ComboBox}}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</ComboBox>
</Grid>
</DataTemplate>
</telerik:RadGridView.RowDetailsTemplate>
</telerik:RadGridView>