Hi,
I'm a new with both C# and Pro SDK. I have to convert my vb.net ArcMap addin to Pro. I'm taking baby steps here so please bear with me. Today I'm trying to write codes for the addin for user to open an excel file and import a column to a list view which I put inside a dockpane.
I got errors at
lstviewAllAcct.View = View.Details; //error: View does not exist in the current context
lstviewAllAcct.GridLines = true; //error: 'ListView' does not contain a definition for
GridLines and no accessible extension method
lstviewAllAcct.FullRowSelect = true; //error: same as above
How to I access the properties of my listview? Thanks for your help.
<SPAN class="keyword token">using</SPAN> ArcGIS<SPAN class="punctuation token">.</SPAN>Desktop<SPAN class="punctuation token">.</SPAN>Catalog<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> Microsoft<SPAN class="punctuation token">.</SPAN>Win32<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> OfficeOpenXml<SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//reference EPPlus (excelpackage)</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Collections<SPAN class="punctuation token">.</SPAN>Generic<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Linq<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Text<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Threading<SPAN class="punctuation token">.</SPAN>Tasks<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Windows<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Windows<SPAN class="punctuation token">.</SPAN>Controls<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Windows<SPAN class="punctuation token">.</SPAN>Data<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Windows<SPAN class="punctuation token">.</SPAN>Documents<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Windows<SPAN class="punctuation token">.</SPAN>Input<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Windows<SPAN class="punctuation token">.</SPAN>Media<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Windows<SPAN class="punctuation token">.</SPAN>Media<SPAN class="punctuation token">.</SPAN>Imaging<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Windows<SPAN class="punctuation token">.</SPAN>Navigation<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Windows<SPAN class="punctuation token">.</SPAN>Shapes<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">namespace</SPAN> ProAppApril92
<SPAN class="punctuation token">{</SPAN>
<SPAN class="comment token">/// <summary></SPAN>
<SPAN class="comment token">/// Interaction logic for Dockpane1View.xaml</SPAN>
<SPAN class="comment token">/// </summary></SPAN>
<SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">partial</SPAN> <SPAN class="keyword token">class</SPAN> <SPAN class="token class-name">Dockpane1View</SPAN> <SPAN class="punctuation token">:</SPAN> UserControl
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">public</SPAN> <SPAN class="token function">Dockpane1View</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="token function">InitializeComponent</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">BtnOpenExcelFile_Click</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">object</SPAN> sender<SPAN class="punctuation token">,</SPAN> RoutedEventArgs e<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
Microsoft<SPAN class="punctuation token">.</SPAN>Win32<SPAN class="punctuation token">.</SPAN>OpenFileDialog openFileDialog1 <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">OpenFileDialog</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
openFileDialog1<SPAN class="punctuation token">.</SPAN>InitialDirectory <SPAN class="operator token">=</SPAN> <SPAN class="string token">@"c:\";
openFileDialog1.Filter = "</SPAN>XLSX Files <SPAN class="punctuation token">(</SPAN><SPAN class="operator token">*</SPAN><SPAN class="punctuation token">.</SPAN>xlsx<SPAN class="punctuation token">)</SPAN><SPAN class="operator token">|</SPAN><SPAN class="operator token">*</SPAN><SPAN class="punctuation token">.</SPAN>xlsx<SPAN class="operator token">|</SPAN>XLS Files <SPAN class="punctuation token">(</SPAN><SPAN class="operator token">*</SPAN><SPAN class="punctuation token">.</SPAN>xls<SPAN class="punctuation token">)</SPAN><SPAN class="operator token">|</SPAN><SPAN class="operator token">*</SPAN><SPAN class="punctuation token">.</SPAN>xls<SPAN class="operator token">|</SPAN>All files <SPAN class="punctuation token">(</SPAN><SPAN class="operator token">*</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="operator token">*</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="operator token">|</SPAN><SPAN class="operator token">*</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="operator token">*</SPAN>"<SPAN class="punctuation token">;</SPAN>
openFileDialog1<SPAN class="punctuation token">.</SPAN>FilterIndex <SPAN class="operator token">=</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">;</SPAN>
openFileDialog1<SPAN class="punctuation token">.</SPAN>RestoreDirectory <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">;</SPAN>
openFileDialog1<SPAN class="punctuation token">.</SPAN><SPAN class="token function">ShowDialog</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> package <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">ExcelPackage</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> workbook <SPAN class="operator token">=</SPAN> package<SPAN class="punctuation token">.</SPAN>Workbook<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>workbook <SPAN class="operator token">!=</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> sheet <SPAN class="operator token">=</SPAN> workbook<SPAN class="punctuation token">.</SPAN>Worksheets<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> firstColumnRows <SPAN class="operator token">=</SPAN> sheet<SPAN class="punctuation token">.</SPAN>Cells<SPAN class="punctuation token">[</SPAN><SPAN class="string token">"A1:A"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">object</SPAN> cell<SPAN class="punctuation token">;</SPAN>
lstviewAllAcct<SPAN class="punctuation token">.</SPAN>View <SPAN class="operator token">=</SPAN> View<SPAN class="punctuation token">.</SPAN>Details<SPAN class="punctuation token">;</SPAN>
lstviewAllAcct<SPAN class="punctuation token">.</SPAN>GridLines <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">;</SPAN>
lstviewAllAcct<SPAN class="punctuation token">.</SPAN>FullRowSelect <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">else</SPAN>
System<SPAN class="punctuation token">.</SPAN>Windows<SPAN class="punctuation token">.</SPAN>MessageBox<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Show</SPAN><SPAN class="punctuation token">(</SPAN>openFileDialog1<SPAN class="punctuation token">.</SPAN>Title<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>