user2140577
user2140577

Reputation: 7

Link Combobox and datagrid

I have a comboBox which is filled using this query

 SELECT DISTINCT SUBSTRING(LogTime, 0, 12) AS Expr1
 FROM   SSISLog

I have a datagrid which contains 5 columns

Name , ID , Event ID , EventType , LogTime

I have a function which I have used on other comboboxes so that when an item is picked the datagrid then goes to this item simply using

      private void comboBox9_SelectedIndexChanged(object sender, EventArgs e)
     {

     }

But this time it's not working as the datasources are different , can anyone show me how to do this ?

Upvotes: 0

Views: 84

Answers (1)

Sheridan
Sheridan

Reputation: 69985

If you are looking to find a 'selection changed' event for a DataGrid, please take a look at the WPF datagrid selected row clicked event? post here at StackOverflow. In short, you can attach a handler to the DataGridRow.Selected event:

<DataGrid ... >
    <DataGrid.ItemContainerStyle>
        <Style TargetType="DataGridRow">
            <EventSetter Event="MouseDoubleClick" Handler="Row_DoubleClick"/>
        </Style>
    </DataGrid.ItemContainerStyle>
    ...
</DataGrid>

From the linked post.

Upvotes: 1

Related Questions