How to get the file to open on Double Click in DataGrid WPF with DirectoryInfo

  • Thread starter Thread starter Matt wade Simmons
  • Start date Start date
M

Matt wade Simmons

Guest
I have a DataGrid in WPF with the code:
<DataGrid x:Name="myDataGrid" AutoGenerateColumns="False" Margin="483,304,0,10" SelectedValue="{Binding Name}" MouseDoubleClick="MyDataGrid_MouseDoubleClick_1" FontFamily="{DynamicResource pack://application:\,\,\,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto}" GridLinesVisibility="All" HorizontalGridLinesBrush="Black" VerticalGridLinesBrush="Black" AlternatingRowBackground="#FFE6E4E4" SelectedIndex="0">
<DataGrid.Columns>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding Name}" Header="Name" CanUserResize="False" SortDirection="Ascending"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding LastWriteTime}" Header="LastWriteTime" CanUserResize="False"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding Length}" Header="Length" CanUserResize="False"/>
</DataGrid.Columns>
</DataGrid>
my code behind is:

myDataGrid.ItemsSource = new DirectoryInfo(@"c:\logs").GetFiles();

I am trying to get the file to open when its doubleclicked on in the row. (to view a log)

Could someone please help me out?

Thanks!

Continue reading...
 
Back
Top