Nest several properties in one expanded property - c#

I have some questions of property grid.
Originally, there are three properties in class "Light" (Light: Light Intensity/Light Intensity(Cadenla)/Intensity(Lumen)).
Now, I want to combine three properties with one property "Light Intensity Unit", the user can select those three in the dropdown list, after selecting, one slider shows up and let the user to edit the chosen property.
Any guidance of how to do that? It looks like something related expandableObjectConverter?
Here is a picture for better shown what I imagine.Picture of what I imagine

Related

Metro style: how to show filtering options for longlistbox in a proper way

I have a large collection of items with several parameters, so i'd like to give a user a possibility to have different filters: like order by time, by alphabet, or by categories.
How should i implement filter selection in Metro style? Should it be a menu items like this, but with "filter by alphabet" instead of "menuitem 1" ?
Edit:
Some more details: so, assume we have Movie items with 4 fields: name, year of release, genre and main actor's name. I'd like to allow user to set filtering by 1 of those 4 fields. Actually, it is not filtering or sorting, its more like categorizing.
Ok, i found this thing, looking quite nice.
Edit: though, be careful, it is not working the same as on the picture. At least, current version is not fading the screen, so other controls still would react on user input and Back button.
No way - the AppBar menu is not the way to go. For filtered content, you would normally use LongListSelector (both on WP7 and WP8). The filtering can be set by you when you group (or re-group) the items bound to the control - for the filter setter you could use any control (e.g. a auto-complete text input control or a ListPicker).

WinRT ListView grouping on multiple levels

I have a project where I have a list of appointments:
Appointment:
Name
City
Street
I want to display those in a ListView, and group them on 2 levels, first by city, and then by street. I also want to be able to collapse the items on both levels and style the header differently.
Is something like that possible in a ListView in WinRT?
I thought about using a ListView in a ListView. But that's not possible because I want to use single selection mode. Or is there some way I can enforce this?
Personally I would keep it simple.
In the Cineworld app I created, in cinema details xaml page, I give users options to view
* Films showing today (grouped by first char)
* Films grouped by date
* All films listed (grouped by first char).
These were all very different options and I settled on a combination of radio button and multiple grouped listview (within semantic zoom).
The solution has worked well so far.

C# propertyGrid miscellaneous questions about properties

I have several questions about properties displayed in propertyGrid i cant seem to find answers for:
1) What do i do if my property is a class? When multiple objects are edited, straaange things happen (when property is struct or simple type, its okay, but if property is class, it passes same class's reference to all edited members when value is applied, which is obviously awful, and it wont recognise two class with identical members, because they have different reference, etc)
2) How do i resize the custom dropdown Editor i created for a property?
3) Can i somehow differentiate between empty value and no value when multiple objects have different values? Like, so
if i have selected 2 objects with same "name" property, it would show name: TEXT
if i have selected 2 objects with "name" = "", it would show name:
if i have selected 2 objects with different "name", it would show name:
4) How do i show something when value is blank? It has to disappear when user starts editing! For example, i have property "name" and if its blank, it should have <> displayed in property grid, but as soon as user clicks to edit, when cursor appears, the <> should disappear
There is a good sample how to implement a custom editor for a property grid in the MSDN:
http://msdn.microsoft.com/en-us/library/ms171840.aspx
and a great article how to realize a custom dropdown, e.g. a dropdown with checklist controls in it on codeproject:
http://www.codeproject.com/Articles/21085/CheckBox-ComboBox-Extending-the-ComboBox-Class-and
If you combine the two articles, you're done ;)
Greetings,

Adding a ListViewItem to an already data-bound ListView in WPF

I'm currently working on making a point of sale and I got it to show items in a ListView that are in the current sale. I did this by DataBinding an ObservableCollection of "Item"-type objects in a static "Sale" class called CurrentSale. Not bad, eh? But I need to add coupons and discounts to my pos now, and it's proving to be difficult with the way WPF is set up.
This:
http://dl.dropbox.com/u/1330689/listnow.jpg
is how the listview currently looks. This:
http://dl.dropbox.com/u/1330689/listgoal.jpg
is my mockup of how I'd like a discount to show up. I think I've got the discount and coupon part of the program under control, I'd just like to make them show up. I'd be super thrilled if someone could show me some sample code demonstrating how to insert a custom listviewitem into a listview that's already bound with data, and with similar characteristics(multiple cells, black background)
I read through this:
Append Items to Databound ItemsControl in WPF
and it looks like that guy's got a similar problem. The solutions given to him were to add a special item to the bound list, or to use a CompositeCollection. I can't add a "special" item to the observablecollection, because it doesn't let me change the background color, and I wanted a cleaner solution. Also, I couldn't really find any documentation on CompositeCollections with ListViews, so maybe somebody can shed more light on it(if it's relevant to my problem)
Thanks :)
I think you should use ListBox instead of ListView and DataTemplateSelector
Create base abstract class and 2 subclasses, for instance: BaseListItem, ProductListItem and DiscountListItem. Then insert specific object in the specific place into ObservableCollection<BaseListItem> used as ItemsSource for your ListBox.

How do I show like-values in custom fields in a property grid?

I have a property grid that helps me manage all of the controls on a form. These controls are for designer-type folks, so I'm not really worried that much about the user interface... until someone selects multiple objects.
I have a UITypeEditor for the "BottomDiameter" property on these common objects. It keeps track of units (meters vs feet) and does some nice things on-the-fly. However, when someone selects two or three common objects, BottomDiameter is blank, even though it evaluates to the same text string.
The reason (I think) that it is blank is that it is actually three separate objDiameter objects. How can I tell the property grid to behave like all of the other properties and show the value if it evaluates to the same string???
UPDATE: For example, the "Anchor" property has a text output of "Top, Right" but when you pull it down it is an object. Yet, when you select five objects on your form that all have the same Anchor setting you can still see the string "Top, Right" in the property grid.
If your BottomDiameter is a class and not a simple primitive, then you have to override the Equals method in this class.
In the TypeConvertor of the Datatype which is attributed to BottomDiameter Property, you might want to create a vistor like class called say, BottomDiameterVistor which would take an array or a list of the selected BottomDiameter(s). Override the to string property on the BottomDiameterVistor to return your aggregrated text value for the property.

Categories

Resources