|
When I select 'Add reference', there is no "Assemblies" tabitem in the tablist. The available ones are - .Net, COM, Projects, Browse and Recent.
|
|
|
|
|
Try. Net then. I didn't know that the express editions were so different.
|
|
|
|
|
It's under the .NET tab and only takes a couple of seconds to find it.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi... So I want to change the item template for the selected item of a listbox. I know I need to use the VisualStatemanager to do this, but I'm not sure how to do it. All of the example I've found seem to be much more complicated than I need and/or I can't get them to work.
Basically, for an unselected item, I need to display the name property. And for a selected item I need to display a few other things. So My understanding is that I should use two different grids, and use the VisualState to turn toggle the visibility of the "detail" info. Can someone throw me a simple example?
Thanks.
|
|
|
|
|
USAFHokie80 wrote: Hi... So I want to change the item template for the selected item of a listbox.
I know I need to use the VisualStatemanager to do this, but I'm not sure how to
do it. All of the example I've found seem to be much more complicated than I
need and/or I can't get them to work. Basically, for an unselected
item, I need to display the name property. And for a selected item I need to
display a few other things. So My understanding is that I should use two
different grids, and use the VisualState to turn toggle the visibility of the
"detail" info. Can someone throw me a simple example?
No, you do not use VisualStateManager for this. There are two ways to go about this. If you want to keep your selected item and unselected item template completely separate, you can define two separate DataTemplates (selected & unselected) and swap them out in ListBoxItem via a trigger. It sounds like what would be better in your case is to have a single template where you just collapse visibility on the stuff you don't want to show via a trigger.
|
|
|
|
|
Modify the style of the ListBox. Check this[^] out for a listing of styles / templates associated to the ListBox item.
|
|
|
|
|
Hi,
How do I make hierarchical menu in silverlight 4 please?
Thanks
|
|
|
|
|
|
Thanks for the link.
SL4PopupMenuDemo v1.46 Beta.zip
Downloaded it but it gives an error message:
The project SL4PopupMenu is under source control. An error occured registering this project with source control.
When I check the files, none of them are readonly and there does not seem to be any source safe files attached.
Any thoughts please?
Thanks
|
|
|
|
|
There is a way to remove code from a source control.
You can use go to File->Source Control->Change Source Control and remove the project.
|
|
|
|
|
I have not added it to the source control.
And that is why I do not see it connected to source control.
|
|
|
|
|
Hi,
Do you know how to play a DVD in WPF platform?
The MediaElement doesn't support this format, and i try to use the VLC Component.
The MediaToolkit that many people suggest me doesn't work.
Thanks for your attention,
Regards,
Alessio.
|
|
|
|
|
I have a sneaky feeling this is going to be one of those DRM issues. I'm pretty sure the reason for the media player control not being able to read DVD formats is the encoding and that is due to DRM copyrights.
I could be wrong but I feel correct about this.
|
|
|
|
|
I have three UI elements on my View that are Bound to a Property in my ViewModel:
...
xmlns:myViewModel="clr-namespace:....ThisViewModel"
<TextBlock Text="{Binding Path=LengthProperty.Name}" .../>
<TextBlock Text="{Binding Path=LengthProperty.Value}" .../>
<TextBlock Text="{Binding Path=LengthProperty.UOM}" .../>
This works as expected and shows no data when the LengthProperty is Nothing.
I want to modify this so that when the LengthProperty is Nothing, the view displays data from an alternative CavityProperty property in the ViewModel.
Can this be done in xaml? or should I code it in the ViewModel?
Any pointers are most appreciated.
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
Sounds like a job for a multi value converter.
|
|
|
|
|
I think you are right. It is the implementation I am struggling with. I assume the Converter lives with the ViewModel, however, accesing it in the view is proving probematic...
...
<TextBock.Text>
<MultiBinding Converter="{ ??? }">
<Binding Path="lenProp"/>
<Binding Path="cavProp"/>
</MultiBimding>
</TextBlock.Text>
How do I access the Converter (<MultiBinding Converter="{ ??? }"/> ) ?
\_{"/)_/
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
The converter doesn't live in your VM. It's a completely separate standalone class.
namespace TheSameNameSpaceAsYourVMForConvience
{
public class MyMultiValueConverter : IMultiValueConverter
{
}
}
then in your XAML, in your resources section (assuming local is pointing to your namespace):
<Window.Resources>
<local:MyMultiValueConverter x:Key="MyMultiValueConverter" />
</Window.Resources>
to access it:
<MultiBinding Converter="{StaticResource MyMultiValueConverter}">
</MultiBinding>
The logic in your convert function is going to be something like:
if ((string)values[0] != null && (string)values[0] != "")
return values[0];
return values[1];
|
|
|
|
|
I have solved this (temporarily) in the ViewModel by creating a Public MultiProperty() As ProdPropertyItem which calls a Function ValueConverter() As ProdPropertyItem that resolves the correct property.
I call the function in the Property Setter when a new Parent Item is seleted and the correct values are displayed in the UI . However, this enables OneWay binding only.
I will re-investigate the MulitiBinding Converter stuff when I get more time.
(Infact I have tried pretty similar code to what you have posted, although I am not yet seeing the fields of the converted property)
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
Alternatively set up 2 sections, 1 binding to the Length and the other binding to the Cavity, another 2 properties determining the visibility of the 2 sections based on the content.
Not sure if this is the most appropriate solution but it does seem logical and possibly simpler.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks Mycroft, this is what I have basically done by exposing a Single "SharedProperty" Item and wiring up the visibility in the ViewModel.
I still feel that I should be able to detrmine the appropriate Object in xaml and then display the(3) public properties in the UI without creating extra Public Properties in the ViewModel.
(Disclaimer: I am a novice to this and have only just recently had my MVVM + WPF LightBulb Moment[^] so I may have this a bit screwed!)
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
Andy_L_J wrote: I still feel that I should be able to detrmine the appropriate Object in xaml and then display the(3) public properties in the UI
I wonder why? While the converter may be the technically correct method I feel the VM should do whatever it needs to service the views requirements. I often create a bunch bool(s) in the VM to manage the state of the view based on the data content.
I also consider the use of a converter to be more obscure from a support point of view which for me is a large consideration.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: I still feel that I should ...
Thats it, it's just a "feeling", due no doubt to my inexperience with this pattern. I have been coding (3/4 Tier) Windows Apps using CSLA and have found the transition a little difficult at first. I am also digging into Entity Framework and Linq to Entities so am having a great time of it.
From my point of view, it was very easy to accomplish my goal in the VM. And as for two-way binding, since I dont intend updating the Model from this view there is no issue. There will be a separate view to performm the New/Edit operations.
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
I have to admit, I cheat with the multiple view/VM structure. I often service 2 different views from the same VM. The list is fairly simple, 1 observable collection with a selected item. The dialog (Add/Edit) is also serviced by the same view using the IEditable from the underlying model to determine the state. A bunch of standard CRUD methods and the VM is done for simple operations. Takes about 15 minutes for a table/model/WCF DAL/VM/2 Views for a simple operation.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: I often create a bunch bool(s) in the VM to manage the state of the view based
on the data content.
Which is often extremely silly, unnecessary, unmaintainable and not the right way to go.
1) If you write a generic converter, you can often re-use it, not only for multiple properties, but multiple views.
By generic converter, no, I don't mean one that converts empty strings to "(Empty)" and another one that converts falses to "Off" for example. I mean, one that say could convert any object & value to any other object & value.
A few EXCELLENT examples of true GENERIC converters: a map converter and a math converter
Too often I see BoolToVisibilityConverter and InverseBoolToVisibilityConverter, etc. when you could have done both and then some with the generic MapConverter.
2) Other then the generic converters, the other option is of course triggers. I'm betting I could re-write 90% of your bool view state properties as one line triggers.
|
|
|
|
|
SledgeHammer01 wrote: I'm betting I could re-write 90% of your bool view state properties as one line triggers.
I will decline that bet thanks.
How would you handle setting the visibility based on the value of a field?
Never underestimate the power of human stupidity
RAH
|
|
|
|