Click here to Skip to main content
15,877,051 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: How to design using MVVM for a GUI interacting with Hardware Pin
Praveen Raghuvanshi30-May-11 6:42
professionalPraveen Raghuvanshi30-May-11 6:42 
QuestionWPF/MVVM TextBox Width From DB Field Size Pin
Kevin Marois24-May-11 4:57
professionalKevin Marois24-May-11 4:57 
AnswerRe: WPF/MVVM TextBox Width From DB Field Size Pin
Pete O'Hanlon24-May-11 9:25
mvePete O'Hanlon24-May-11 9:25 
GeneralRe: WPF/MVVM TextBox Width From DB Field Size Pin
Kevin Marois24-May-11 12:58
professionalKevin Marois24-May-11 12:58 
GeneralRe: WPF/MVVM TextBox Width From DB Field Size Pin
SledgeHammer0124-May-11 13:36
SledgeHammer0124-May-11 13:36 
GeneralRe: WPF/MVVM TextBox Width From DB Field Size Pin
Pete O'Hanlon24-May-11 21:54
mvePete O'Hanlon24-May-11 21:54 
AnswerRe: WPF/MVVM TextBox Width From DB Field Size Pin
_Maxxx_24-May-11 21:22
professional_Maxxx_24-May-11 21:22 
QuestionChanging Image Source does not cause the image to be loaded Pin
Michael J. Eber23-May-11 10:58
Michael J. Eber23-May-11 10:58 
In this problem I have a screen displaying with the results of any operation a user performs.
It has an image control on it and the binding for source is as such:
<pre>
&lt;Image Height="150" HorizontalAlignment="Left" Margin="94,12,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="179" Source="{Binding ElementName=isFailure, Path=IsChecked, Mode=OneWay, Converter={StaticResource ImageConverter}}" /&gt;
</pre>

The ElementName isFailure is a hidden checkbox on the form. The ViewModel sets the value to checked or unchecked for the application being in an error state. The design approach is that the image changes from thumbs up to thumbs down for a failure and one lable's text changes as well.

The text change works great. It flips back and forth easily.
The image change leaves me with a blank image window. If I manually change it either image displays fine. But programmatic change of Source fails. (Yes the class name does not match ImageConverter....ImageConverter is the name given to the ImageStateConverter in the controls Resources definition.) My ImageConverter is as follows:

<pre>
/// &lt;summary&gt;
/// Determines which image resource to use based on the state of a hidden checkbox on the form
/// &lt;/summary&gt;
public class ImageStateConverter:IValueConverter
{

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return (bool)value == true
? "/SIMS;component/Views/images/thumbs_down.png"
: "/SIMS;component/Views/image/thumbs_up.png";
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
</pre>

Now I figure I have to call something on the control to force it to reload the image prior to doing a control.Show(); but I'm having trouble finding how to force it to reload the resource!

Suggestions?

Michael
AnswerRe: Changing Image Source does not cause the image to be loaded Pin
SledgeHammer0123-May-11 11:18
SledgeHammer0123-May-11 11:18 
GeneralRe: Changing Image Source does not cause the image to be loaded Pin
Michael J. Eber23-May-11 11:39
Michael J. Eber23-May-11 11:39 
GeneralRe: Changing Image Source does not cause the image to be loaded Pin
Mycroft Holmes23-May-11 14:02
professionalMycroft Holmes23-May-11 14:02 
GeneralRe: Changing Image Source does not cause the image to be loaded Pin
SledgeHammer0123-May-11 14:05
SledgeHammer0123-May-11 14:05 
GeneralRe: Changing Image Source does not cause the image to be loaded Pin
Michael J. Eber26-May-11 10:31
Michael J. Eber26-May-11 10:31 
GeneralRe: Changing Image Source does not cause the image to be loaded Pin
Mycroft Holmes26-May-11 12:36
professionalMycroft Holmes26-May-11 12:36 
QuestionSilverlight - Saving a file without the dialog? Pin
dbrenth23-May-11 7:56
dbrenth23-May-11 7:56 
AnswerRe: Silverlight - Saving a file without the dialog? Pin
Michael J. Eber23-May-11 10:56
Michael J. Eber23-May-11 10:56 
GeneralRe: Silverlight - Saving a file without the dialog? Pin
Mycroft Holmes23-May-11 14:04
professionalMycroft Holmes23-May-11 14:04 
GeneralRe: Silverlight - Saving a file without the dialog? Pin
Mark Salsbery23-May-11 14:13
Mark Salsbery23-May-11 14:13 
AnswerRe: Silverlight - Saving a file without the dialog? Pin
Pete O'Hanlon24-May-11 0:14
mvePete O'Hanlon24-May-11 0:14 
GeneralRe: Silverlight - Saving a file without the dialog? Pin
dbrenth24-May-11 3:07
dbrenth24-May-11 3:07 
GeneralRe: Silverlight - Saving a file without the dialog? Pin
Pete O'Hanlon24-May-11 3:32
mvePete O'Hanlon24-May-11 3:32 
QuestionSilverlight DataGrid unable to be edited when used with DataPager Pin
Steve Holdorf23-May-11 6:26
Steve Holdorf23-May-11 6:26 
AnswerRe: Silverlight DataGrid unable to be edited when used with DataPager Pin
Steve Holdorf25-May-11 3:23
Steve Holdorf25-May-11 3:23 
QuestionXBAP DragDrop System.ExecutionEngineException PROBLEM Pin
bhagyeshjoshi23-May-11 0:11
bhagyeshjoshi23-May-11 0:11 
GeneralRe: XBAP DragDrop System.ExecutionEngineException PROBLEM Pin
bhagyeshjoshi24-May-11 2:32
bhagyeshjoshi24-May-11 2:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.