Can't set selectionMode in TreeView - qml

I am using the TreeView (v2) from the marketplace. I wish to set the 'selectionMode' property in the treeview but this property is not recognized.
How can I set the selectionMode for this TreeView? Has QQC2 moved selection completely under manual control (i.e. my code has to add/remove items to a SelectionModel?)
Seems strange, particularly since the QAbstractItemModel holds flags for 'selectable'...which come to think of it really belongs with the view

Related

How to override system default label forecolor in VB.NET

Is it possible to change the "default" forecolor of a label?
I know I can change each control one-by-one in either design time or run time but I wonder if there is a better way.
I can do this at run time
lblCompanyName.ForeColor = color.darkblue
I could also have a loop to look at all of my controls on the form and change them in one small bit of code, but there must still be a better way.
I see at design time that the "default" label forecolor is "ControlText" so can I change ControlText perhaps to equal color.darkblue and then all of my labels will be dark blue without needing to code it one control at a time (or within a loop).
Thankyou
David.
You can't change it for a standard Label control but you can always create your own class that inherits Label and then sets the ForeColor property in the constructor. You would then use that control instead of a Label.
EDIT:
If you want to change the text colour for all your Label controls at run time then you should use a bound application setting. On the Settings page of the project properties, add a setting of type Color with User scope and name it LabelForeColor or something else if you prefer. Now, select a Label in the designer, open the Properties window and use the (ApplicationSettings) -> (PropertyBindings) node to bind the ForeColor property to the setting you created.
You can then access that setting in code via My.Settings.LabelForeColor and any Label bound to it will be updated automatically. You can bind as many different Label controls on as many different forms as you like. You can only bind one at a time though, so I would recommend copying and pasting an existing bound Label rather than adding a new one each time. If you have existing Label controls and you're confident enough, you can copy, paste and edit the binding code in the designer code file(s).
There's really no point your using a custom control in this case because the setting will control each control anyway. No matter what value you set in the constructor, it will still be set by the bound setting afterwards. Note that any change you make to a setting will be automatically saved at shutdown and reloaded at startup.

Exposing internal objects of a user control in the properties view of the designer?

I've already had success exposing a collection of items in the vb.net designer using DesignerSerializationVisibility(Content). Now I have a new twist. The items in my collection for a certain custom control are immutable--i.e. items can neither be added nor removed. All I want is to expose the items of my collection in the properties panel of the designer so that a developer can tweak the individual properties of each item in the predefined collection of items.
When I tried DesignerSerializationVisibility(Content) it allows the developer to manage the items but rather than editing the existing items it attempts to re-add the items to the collection, which causes key collisions.
As a result I figured it might make sense to expose each item of the collection as its own property. I used DesignerSerializationVisiblity(Visible) and (Content) and both just display the type name in the properties window but the object it exposes is not visible in a way that it can have its properties manipulated.
Am I missing something or can this not be done? I read somewhere about using a TypeConverter. Is this right?
If I understand your Question correctly, you want to change a property to expandable property that has several sub-property.
If I understand properly, you must create a class that is derived from ExpandableObjectConverter. And use this class with TypeConverterAttribute for your property or that class that is related with your property.
For more information, please see my question that its link is offered in below:
Hide ellipsis (…) button of expandable property like “…” button of font property in the property grid

Datagrid View in a custom control

I am trying to add datagridview control in my custom control but i failed.
I started creating new project[windows custom control library], added datagridview control on it and also added a property naming "DGVMain" which refers to datagridview control.
I compiled it.
While testing i find its properties like visible and other working but when i click on columns property it doesn't work. i.e i cannot add/edit columns into the datagridview of my custom control.
Did i miss any steps or do i need to add some more actions?
As you don't have other control within your custom control, maybe an inherited user control would be more appropriate in this case and I'm sure it will also fix your problem.

Force Silverlight DataForm into Normal mode

I'm trying to use the DataForm to display data. The CurrentItem is bound to a property on my ViewModel. The property it is bound to is a simple poco. I've created a custom readonly template. Everything works fine except I can't figure out how to make the DataForm appear "Enabled" or in the Normal state. The data isn't editable, it's displayed as readonly.
The only way I've been able to get it to display in the Normal state was to edit the template and set the Opacity to 100% for the DisabledVisual border.
Is there a better way to do this or use the DataForm for displaying data that isn't editable but still appear enabled?
This fixed it: jedwards14.blogspot.com/2011/02/silerlight-data-forms-with.html. I do have a busy indicator, apparently this is still and issue: silverlight.codeplex.com/workitem/4729

vb.net: Why all contained controls within a groupbox do NOT respond to Enabling/disabling?

I'm working on a winform which contains several controls like textboxes, radio buttons, datagridviews... All of these controls have been added to a main group box called gbDataEntry.
My problem is when the user is seeing the form, I set gbDataEntry.Enabled = False but I want to enable some controls like DataGridviews so the user can scroll them. After disabling gbDataGridview I set DataGridView1.Enabled = True but it seems that the datagridview does not respond to this line. Why?
Is anything wrong with it?
This is standard .NET behaviour (as mentioned in the comment): if a container is disabled then all controls it contains are disabled and cannot be enabled separrately:
When a container control has its enabled property set to false, all its contained controls are disabled, as well. For example, if the user clicks on any of the controls contained in a disabled GroupBox control, no events are raised.
(from Control.Enabled Property on MSDN)
Why do you want to implement this in such a way? The messy solution to this is to enable/disable controls individually.