c# - WindowsForm app with wpf windows is not working on other computers


Question: 

I'm new to WPF and c# programming, i have built a winform app with a database and some wpf forms.wpf forms contain some background images and componentone tab controls. To add wpf forms: i added a wpf user control and modified its code as a window.in that case i m unable to put background images from user directories. i mean

<ImageBrush ImageSource="\Images\carcar.jpg" />

this doesn't work

<ImageBrush ImageSource="G:\Management System\Management System\Images\carcar.jpg" />

this works

And i can't run my app on any other computer(i pasted Debug folder). how to run my application on another computer which does not have coponentone studio/& visual studio installed.




1 Answer: 

You need to set the Build Action for your images to Resource; this will embed them for WPF to consume.

To distribute your application, make sure you've set all non-standard dependencies to Copy Local.

 

More Articles


compact framework - Toolbar button sizes in windows mobile 6.5.3

We have a VB.net CF2.0 Apllication that up until now has run on windows mobile platforms from 2003 to 6.0 without any major issues. Our current team use HP iPAQ devices running winodws 6.0 and everything runs fine. There is a good, hardware related reson why we use these devices. We are looking to u

c++ - Windows Toolbar - Controlling button size and padding

I'm trying to understand the behaviour of a Windows toolbar - in particular how the following values interact:the size of the bitmap image usedthe effective size of a toolbar buttonthe padding between the image and the button edgethe height of the toolbarText displayed by a button is not relevant in

xamarin.android - How to align UI controls on a Custom Toolbar in Android xml

I'm creating a layout in Xamarin.Android and I'm working on a custom Toolbar with an image button a TextView and another label. What I need to do is Make sure the imagebutton BackButton is left aligned all the way to the left of the parent Contain, the TextView is Center Aligned and the MenuButton


java - Android Adding Buttons to Toolbar Programmatically

I am trying to create a toolbar programmatically and Add Left and Right Bar Button to it without using XML.But the button is not getting aligned to right.So kindly help me.Toolbar TopTulBarVar = new Toolbar(this);TopTulBarVar.setId(View.generateViewId());TopTulBarVar.setBackgroundColor(Color.parseCo

mfc - How do I handle toolbar messages in a dialog box

I am writing a MFC MDI application, which I started with the wizard, with visual studio 2017. In this application I have dialog boxes with toolbars. But when the dialog boxes are shown, the toolbar buttons are not enabled, even though the dialog classes contain handlers for the button IDs.For instan

configuration - PhpStorm configure to work remotely

Hi is there a way for PhpStorm to work directly on a remote server? No local files. Because as of the moment PhpStorm has local files wherein it just automatically uploads all files during save on remote.My problem is if someone changes something remotely I need to manually download it first before


wpf - Adding NAudio controls to toolbox

I am trying to use the controls from NAudio library such as WaveViewer, VolumeMeter, VolumeSlider, Fader, WaveformPainter etc. I am using Visual Studio 2012 and have net 4.5 installed. I have also downloaded and referenced NAudio 1.7 and its .dll to my project. When I right click on toolbox and clic

How to disable "Project Files Changes" alert in phpstorm?

How to disable this alert box in phpstorm.

How to show a Horizontal Android Indeterminate Progress Bar

How to show an indeterminate horizontal progress bar in android? The animation of the progress bar should start from 0 to 100 and then go back from 100 to 0 continuously. I am not looking for the wheel progress bar.

WPF Application - Visual Studio 2008 Toolbox Not Loading Correctly!

I'm pretty new to WPF however i've got a solid understanding of WindowsForms. When I create a new WinForms application in Visual Studio the Toolbox displays a huge list of different controls that can be used for developing the program.However, this is only the second time i've started to design stuf