|
Thanks for all your help. I appreciate it. It's working great. I added a ShowMessageBox method.
So now that I have this done, I was thinking of writing an article. I know it's been done before, but what do you think?
If it's not broken, fix it until it is
|
|
|
|
|
|
Kevin Marois wrote: I was thinking of writing an article
Excellent - it would save me at least 2 bookmarks and chasing through the thread. I have been looking for a simple dialog service and this seems to meet the requirements without delving too deep (I LIKE simple).
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello,
I found this class in my research but I do not know how to use it. Moreover, it seems to me that the ConvertBack () method is not completely completed.If someone has already used his help will be invaluable for me.
here is the class
[ValueConversion(typeof(byte[]), typeof(ImageSource))]
public class ByteArrayToImageSource : IValueConverter
{
#region Implementation of IValueConverter
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var byteArrayImage = value as byte[];
if (byteArrayImage != null && byteArrayImage.Length > 0)
{
var ms = new MemoryStream(byteArrayImage);
var bitmapImg = new BitmapImage();
bitmapImg.BeginInit();
bitmapImg.StreamSource = ms;
bitmapImg.EndInit();
return bitmapImg;
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
#endregion
}
|
|
|
|
|
This is a converter - it's meant to be used in your XAML to convert from one type to another - in this case, to take a series of bytes and to return an image from it. If you're using this in XAML and you aren't updating the image on the screen, you don't need to worry about the ConvertBack method - it's there to support Binding back from the XAML to the property you're binding to.
|
|
|
|
|
a small code example or a case already studied help me please!
|
|
|
|
|
I am working on this[^] app.
The area in red is a ContentPresenter in the MainWindow. When the user clicks a link in the left Recent Items area, I send a message to the MainWindow to load the view.
That gives me this[^].
I am defining my Views/VM in my resource file:
<DataTemplate DataType="{x:Type vm:HomeViewModel}">
<vw:HomeView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:ClientViewModel}">
<vw:ClientView/>
</DataTemplate>
The first question is this...How can the Save button on the MainWindow know that the current view is dirty?
Second, given how I'm designing this... view inside a view in a ContentPresenter, is messaging the right way to communicate?
I'm open to suggestion on my design.
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
I recently discovered CompositeCommand and find it works great for this scenario. It's part of Prism, but I just ripped it out since I don't use Prism.
https://prism.svn.codeplex.com/svn/V1/spikes/AGCompositeApplicationLibrary/AGComposite.Wpf/Commands/CompositeCommand.cs[^]
The toolbar will bind to a static CompositeCommand (i.e. in something like a GlobalCommands.cs) and then a view would attach to it with a RelayCommand. Something like:
GlobalCommands.SaveCommand.RegisterCommand(SaveCommand);
Multiple views can attach to the same command and all get notified when the button is clicked. The one gotcha though is the IActiveAware portion. Your ViewModelBase class needs to be tweaked to properly set the IsActive flags in the commands somehow.
Basically the way the CompositeCommand works is that say vmA and vmB attach... by default, the button will only enable if both return true for canExecute. By setting the IsActive flag on the commands properly, you can make it work in a way where the inactive commands are ignored. For example, if vmA.SaveCommand is not active, only vmB.SaveCommand will get the canexecute/execute calls.
|
|
|
|
|
Just curious, what does your moniker, 'SledgeHammer' refer to?
Could it be this?>>[^]
If it's not broken, fix it until it is
|
|
|
|
|
I would like to add certificate in local machine through Silverlight. I can able to add certificate using X509Store in vb.net windows application.
But how it is possible with Silverlight Application?
|
|
|
|
|
1) usercontrol.xaml.cs
public event RoutedEventHandler CustomClick;
private void btn_Click(object sender, RoutedEventArgs e)
{
if (CustomClick != null)
CustomClick(this, new RoutedEventArgs());
}
2)MainWindow.xaml
<controls:Button CustomClick="btn1_CustomClick" ButtonText="Click Here" Name="btn1" Margin="61,105,93,128"></controls:Button>
3)MainWindow.xaml.cs
private void btn1_CustomClick(object sender, RoutedEventArgs e)
{
MessageBox.Show("Custom control CLicked");
}
Click Event Not working for mybutton
|
|
|
|
|
So have you set breakpoints in the debugger and determined which part of the process isn't happening as you expect?
The CustomClick event in usercontrol.xaml.cs or the btn1_CustomClick in MainWindow.xaml.cs ?
|
|
|
|
|
what is the silver light application? where we can use it..?
|
|
|
|
|
Silverlight is a plugin, similar to Flash, that allows you to run richer web based applications. It's named after my good friend David Silverlight.
|
|
|
|
|
You name dropper you!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Oh yes indeedy. Just think, someday I may be telling people I knew the other, other Mycroft Holmes.
|
|
|
|
|
Silverlight is, as Pete said correctly, something like the Microsoft-Version of Flash. However, Microsoft has abandoned the technology, meaning that they are not going to support it for a long time. Therefore Silverlight should be left aside in favor of trqaditional Web technologies, as Javascript, HTML etc. are.
Source[^]
Veni, vidi, caecus
|
|
|
|
|
Apart from its just plugin it is used to create Rich UI, games and media based application on internet. It works at client side so there is lot saving of network bandwidth until you are not requesting any data to the server.
Mohit Dharmadhikari
|
|
|
|
|
Mohit Dharmadhikari wrote: It works at client side so there is lot saving of network bandwidth until you are not requesting any data to the server.
Wat, you imply the data is on the client - wrong, the UI and presentation code is on the client, the data is still requested from the server - but only the data.
I'm pretty sure there is some saving in bandwidth but I don't think it is a huge amount.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Please read it correct. I said it works on client side. Again it depends on where you store the data if its in database it may be in server. However we may save data in-memory collections as well which will be reside in client side. It totally depends on requirement.
|
|
|
|
|
Mohit Dharmadhikari wrote: However we may save data in-memory collections
And where does the data come from so you can save it in a local collection.
As I ONLY do LOB projects I may be missing something as ALL my data is stored in a database and has to be dragged out of the server.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am looking at building a very simple schedule display layout something like the telerik TV schedule[^]. Basically a row header with multiple textblock fields and 1 month on a grid display that show a max of 1 event per day per row (no scheduling required).
Both the ScheduleView and PivotGrid are way over the top for what I want to achieve, but between the templated row header and the dynamic date columns I can't decide which control to use.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Why not just use that one? Easier then writing your own. If I was bored and wanted to write my own...
The left two columns would each be an ItemsControl styled with a vertical font and some borders.
The top row would be another ItemsControl styled with the time and tick marks, etc.
The grid would be 2 ItemsControls... one for the rows that contains another ItemsControl for the columns.
I'd package the control to hide all that though from the developer.
I wouldn't really reuse any control besides the ItemsControl. Doesn't seem like there is much functionality that can be reused from other controls.
|
|
|
|
|
SledgeHammer01 wrote: Why not just use that one Both the controls are monsters for something very simple. I don't need the row and column grouping, the vertical text is not required just the data laid out in a similar structure.
I was going to "I have decided to create a model of objects (RowHeader object and 31 DateEvent objects), I can then bind that to a templated gridview."
SledgeHammer01 wrote: The grid would be 2 ItemsControls... one for the rows that contains another ItemsControl for the columns. However this idea got me to thinking more sensibly - thank you.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
how to use validations with in a textbox it should not allow me to enter a 11 value my requirment is it only should accept 10 digit number if i tryed to press 11 value it has to be show an error message
|
|
|
|