Binding multiple index from a collection in XAML - wpf

Despite having read similar questions, I could not find any one that worked well in my case.
Basically, in order to extend the functionality of the TableRow class, I created a new one in which I have registered a DependencyProperty to clear the cells, and according to Msdn, I am trying to bind two index from a collection, as follows:
<my:myExtendedClass myProperty="{Binding Path=MyCollection[index1,index2]}">
However, I get the following error when I try to pass more than one index:
Error in Template: 'Unexpected token 'String' in rule: 'MarkupExtension ::= '{' TYPENAME (Arguments)? #'}'', in '{Binding Path=MyCollection[index1,index2]}'.'
Other approach would be bind the whole object MyCollection, but, in this way, I would not know which items I have to check each time I call the method.
So, how should I proceed? Thanks in advance!

Related

Getting extended properties on users objects

I try to query a user including extended properties:
/users/xxx#xx.dk?$expand=properties
However I get following error:
Could not find a property named 'properties' on type 'microsoft.graph.user.
Is it possible in one request to get a user object with all of it's extended properties?
Best scenario would be something like following where I query for the departmentNumber from the extended properties with direct properties:
/users/xx#xx.dk?$select=companyName,officeLocation,departmentNumber&$expand=properties
This is because, as the message states, there is no property named properties.
How you retrieve custom properties depends on how they were created. There are two types: Open Extensions and Schema Extensions. Each is stored and behaves a little differently so you'll want to refer to the documentation I linked to for help determining which type you want to use.

How do I get the Name of a block in EpiServer?

How do I get the name, set in the CMS, of a certain block in an MVC view?
I guess that it should be #Model.Name but I can't find it.
You have to cast your block instance to IContent to access the Name property.
For details on why, you can have a look at: Episerver - Why BlockData doesn't implement IContent
The syntax to get the Name property is
(Model as IContent).Name
or
((IContent)Model).Name
Be careful with this cast as handling a Block which is a property as opposed to a ContentReference will not work and throws an exception.
If you want to display the name in the view - you can cast the model inside PropertyFor:
#Html.PropertyFor(m => ((IContent)m).Name)

Why using the this.$(selector).method() syntax with backbone?

I have seen this bunch of code in a tutorial:
var searchTerm = this.$('#searchTerm').val().trim();
I would like to understand the utility of the this. in front of the selector, it's the first time i see that.
In a Backbone.View, this.$ gives a scoped version of jQuery. It is in fact equivalent to using this.$el.find which is in turn equivalent to using $(this.el).find.
Anyhow, the reason it is a good idea to use it is that it will only access html elements from within the view's element/rendered template. Thus, you don't have to worry about the rest of the html page and you will always select the element you expect to.
Imagine that you have a view that spawns sub-views and that each of these have an editable field. If you don't use the scoped version of jQuery to get the right editable field, you will have to give a unique id to each of these html elements to make sure you will select the right one when retrieving it's content. On the other hand, if you use the scoped version, you will just have to give this editable field a class attribute and selecting this class will give you a unique element, the right one.
This is the same query as this.$el.find('#searchTerm').val().trim();
You haven't given any context to that code, but assuming it's a method inside a View, this refers to the View object.
this.$ is a shortcut to access jQuery from the View object, and is equivalent to the method this.$el.find.

backbone.js AssociatedModel Error: type must inherit from Backbone.AssociatedModel

I was looking for a library to follow sub models and came across backbone-associative
I created Model and set the relations. The structure looks like
GatewayModel have relation to GradeModel
GradeModel have relation to ButtonModel
I create obj of GatewayModel and add GradeModel. but when I try to add ButtonModel to GradeModel it throws error
Uncaught Error: type must inherit from Backbone.AssociatedModel
I checked the declaration of all Models and they are correctly extending AssociatedModel
Please could someone help with what the issue could be
I have created JSFiddle here
jsfiddle.net/5d4Fa
[EDIT]
I noticed if i change the type to Backbone.One it works fine. Please could some one explain what is the difference between One and Many.
My understanding is if a Model contains multiple record for relation Model I have to use Backbone.Many but as soon as I use Backbone.Many it start to throw errors
I solved this problem. The issue was related to incorrect type of data passed in collectionType. It expects string and I was passing the value as class
type: Backbone.Many,
key: 'grade',
relatedModel: Model,
collectionType: 'Collection'

How to access the attributes of a class in sencha.........?

i'm very new to sencha.i have a bit problem in accessing the data from framework..
what i planned is to access the attribute "selectedIndex" from the class Ext.Picker.Slot
so that i can place it the index.js file and loop the "selectedIndex" attribute so that i can create a rotating effect to my list , i'm trying to dynamically change the value of "selectedIndex" so that my list seems to be rotating so please do help me........
Thankyou,
........
Ext.Picker is not an extjs class. You should provide more info so I can help you. In any way there must be a method which puts selectedIndex to desired value. Js don't have properties like in other OOP languages. It's just a variable. Changing value of it don't do any "action". So, there must be method which do the "action" and sets selectedIndex.

Resources