public ViewModeViewModel(string viewMode) { _viewMode = viewMode; _viewModeIcon = new Lazy <ImageSource>( () => { try { Stream imgStream = Application.GetResourceStream( new Uri(String.Format(iconPathMask, ViewMode.ToLower()))).Stream; BitmapDecoder decoder = IconBitmapDecoder.Create(imgStream, BitmapCreateOptions.None, BitmapCacheOption.None); return(decoder.Frames[0]); } catch (Exception ex) { throw ex; } }); }