Ribbon buttons icon

Sep 28, 2010 at 8:31 PM

hi, i wanna add icon to my ribbon button programmatically , can you help me?

i am doing this

 String packUri = "pack://application:,,,/Management;component/Icons/" + task[k][2];          // here Icons is the folder name where icons are stored, Management is the project name folder & task[][] is the list where contains name of the icon                                

btn.Icon = new ImageSourceConverter().ConvertFromString(packUri) as ImageSource;          // btn is the object of the ribbon button               

btn.LargeIcon = new ImageSourceConverter().ConvertFromString(packUri) as ImageSource;  

Oct 4, 2010 at 8:23 AM
Try:
btn.Icon = new BitmapImage(new Uri(@"pack://application:,,,/Management;component/Icons/" + tasks[k][2]));
btn.LargeIcon = new BitmapImage(new Uri(@"pack://application:,,,/Management;component/Icons/" + tasks[k][2]));