Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

buttons with images.

$
0
0

I am new to this forum and programming. I have advised the developer community to clarify my doubts. I apologize because my English is not good, so I have to use the google translator and possibly the text is not perfect, and the lack of information on my part. I've been searching my question before posting my message, but I have not found anything.

I want to put images in buttons, so far I have managed to make a query in which I show in a listbox addresses the images you want to put the buttons.

            var obtenerImagen = (from n in basedeDatos.tablaProductos               
                                 select n.imagenProducto);                         

            listBox1.ItemsSource = obtenerImagen;


Now my idea is to put the images on buttons from the query.

            ImageSourceConverter conversor = new ImageSourceConverter();

            image1.Source = (ImageSource)conversor.ConvertFromString(obtenerImagen);  /**/

            image1 = obtenerImagen.FirstOrDefault();  /**/

this gives me the following error lines: (/**/)

- Argument 1: cannot convert from 'System.Linq.IQueryable<string>' to 'string'
- Cannot implicitly convert type 'string' to 'System.Windows.Controls.Image'    
- The best overloaded method match for 'System.ComponentModel.TypeConverter.ConvertFromString(string)' has some invalid arguments

What am Idoing wrong?

Thanks.

                

Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>