Up vote 0 down vote favorite share g+ share fb share tw.
I have searched for a solution to this in the forum. There are several similar questions and solutions but I cannot really understand them. Pardon me for asking again... :P Let me explain my setup... I have a UserControl which is developed as a separate dll from the Main application.
Within this rather complicated UserControl, I have several child controls. One of them is a Image. I declared a DependencyProperty at the UserControl code-behind to expose the Source property of the Image.
Public static DependencyProperty MyImageSourceProperty = DependencyProperty. Register("MyImageSource", typeof(ImageSource), typeof(MyUserControl), new UIPropertyMetadata(null)); public ImageSource MyImageSource { get { return (ImageSource)GetValue(MyImageSourceProperty); } set { SetValue(MyImageSourceProperty, value); } } Then in my Main Application, I placed the UserControl in my MainWindow and rigged it up as such... MySource is declared in my MainWindow's ViewModel. Public string MySource { get { return this.
MySource; } set { if (value == mySource) return; this. MySource = value; OnPropertyChanged("MySource"); } } Basically, the program is supposed to function as such : 1) User clicks on a Button in the MainWindow. 2) An openFileDialog pops up and he selects an image file to load.
3) Once he confirms the selection, the image should load up in MyUserControl's Image control. I.e. MySource is updated, which triggers a whole ripple of events resulting in the Image's Source property being updated.
The compilation went without errors. But when I tried to execute the program, and selects the image I want to load, image does not show at all... Hope someone can enlighten me on this. Really banging against walls for hours trying to figure out what went wrong.... Thanks a lot in advance... c# wpf image data-binding dependency-properties link|improve this question asked Apr 5 at 7:17bbdaffy61.
For example, you could do that in the constructor. – Thorsten Dittmar Apr 5 at 7:25 1 You can't bind the ImageSource propety directly to string. See Binding Image.
Source to String in WPF for more details – DmitryG Apr 5 at 7:39.
Add the following line to the constructor: this. DataContext = this; This tells the form that it is its own data context. Otherwise the user control doesn't know which object "hosts" the MySource property.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.