Custom Control Xaml Elements - silverlight-4.0

I have
controls :
ControlX :IControlX and ControlY:IControlY
ControlZ has a List Property of ControlX
Interfaces :
IControlX and IControlY:IControlX
The Tags I am getting is:
<ControlZ>
<ControlY>
<ControlX></ControlX>
<ControlX></ControlX>
</ControlY>
</ControlZ>
Here I can access the ControlY in the List but Not able access Control X.
But If I change the tag sequence as :
<ControlZ>
<ControlY> </ControlY>
<ControlX></ControlX>
<ControlX></ControlX>
</ControlZ>
I can Get the all the object in the list.
But it is not logical so I need to maintain the tag sequece.
Can you please suggest me . How can I get access of the inner tags ?
Thank You

You can't do that. XAML does not allow you to access properties of properties unless you initialize them in XAML.
<Control:MyControl>
<Control:MyControl.Property1>
<!-- Assuming that Property1 is of type MyOtherControl -->
<Control:MyOtherControl Property="somevalue" />
</Control:MyControl.Property1>
</Control:MyControl>

In order to set a value of a property of Property1, you have to instanciate it first. Let's say that Property1 os of type Property1Type which exists in the same namespace, and the type of the inner property (Property) is InnerPropertyType which is also in the same namespace. You code should be something like:
<Control:MyControl>
<Control:MyControl.Property1>
<Control:Property1Type>
<Control:Property1Type.Property>
<Control:InnerPropertyType />
</Control:Property1Type.Property>
</Control:Property1Type>
</Control:MyControl.Property1>
</Control:MyControl>
this is similar to, for example:
<ListBox>
<ListBox.BorderBrush>
<ImageBrush>
<ImageBrush.Transform>
<ScaleTransform ScaleX="5"/>
</ImageBrush.Transform>
</ImageBrush>
</ListBox.BorderBrush>
</ListBox>
This should solve some of the issues, if other persist, please update your question ;)
Hope this helps :)

Related

How to format label in Xamarin XAML Listview based on a viewmodel attribute

I am trying to create a ListView cell data template with a label that shows either a "detailed" description or a "short" description based on whether another variable ViewLevel is "Detailed" or "Short".
I am using an IValueConverter and trying to bind the ConverterParameter, but that does not work as I don't think the ConverterParameter is bindable.
Is there a best practice for doing this?
The label I currently have is:
<Label Binding Options, Converter={viewModels:DetailLabelConverter}, ConverterParameter='Detail'}" />
It works, but obviously has the hardcoded Detail view. I've also tried:
<Label Text="{Binding Options, Converter={viewModels:DetailLabelConverter}, ConverterParameter={Binding Source={x:Reference BasePage}, Path=BindingContext.ViewLevel}}"/>
Which works, insomuch as it calls the DetailLabelConverter. Unfortunately the parameter is not loaded with the value of ViewLevel but a Xamarin.Forms.Binding object.
It seems like this should be a fairly common pattern but I can't find a reasonable solution.

Using multiple string resources from .resw file into ContentDialog

I would like to set the PrimaryButtonText, SecondaryButtonText and Title attributes of a ContentDialog with strings from my .resw file. Unfortunately Ι can do this only for one attribute using x:Uid, since setting x:Uid two times inside ContentDialog can not be accepted. I even tried to do something like that:
<ContentDialog>
<ContentDialog.PrimaryButtonText x:Uid="DialogConfirm" />
<ContentDialog.SecondaryButtonText x:Uid="DialogCancel" />
</ContentDialog>
But I got an exception
XBF generation error code 0x09c8
Is there any way to accomplish this?
Set x:Uid only for ContentDialog then in resources file set apropriate properties (take a look at MSDN):
<ContentDialog x:Uid="myDialog">
<!--your dialog-->
</ContentDialog>
In Resources.resw set:
myDialog.PrimaryButtonText -> text for primary button
myDialog.SecondaryButtonText -> text for secondary button
As for more guidelines and help, see MSDN.

Accessing 'Modified By' field in a reusable workflow

I'm creating a reusable workflow in SharePoint designer 2010. I've created a custom content type with all the necessary fields that I'll be used in the workflow. But I'm not able to get the Modified By field (Editor) inside the workflow.
<FieldRef ID="{d31655d1-1d5b-4511-95a1-7a09e9b75bf2}" ReadOnly="TRUE" Name="Editor" DisplayName="Last Updated By" FromBaseType="TRUE" Required="FALSE" PITarget="" PrimaryPITarget="" PIAttribute="" PrimaryPIAttribute="" Aggregation="" Node="" />
I really doubt whether the ID is matching with the inbuilt editor field. How can I cross-verify this? Any ideas?
Not sure but do you really need to include it explicitly? Editor is part of base content type : Item, and down the hierarchy all other content types should be inheriting it without the need to explicitly include it.
Regards,
Nitin Rastogi

Variable in an attribute in Struts custom tag

I am trying to use a variable inside a custom Struts tag something like follows -
for(String currentMacro : (List<String>)(request.getAttribute("individualMacros"))) {
name = currentMacro.<some-operation>
<html:mce name = "hmtl_<%= name %>" />
Something like this. But <%=name%> is not replaced with the variable value. It works when I am using the variable with a pure HTML tags.
Is there any any way to accomplish this in this case?
Thanks.
Use JSP EL (assuming JSP 2.0, and you put "name" into scope). You could also check to the if the TLD allows rtexprs.
<html:mce name="html_${name}"/>
But why use scriptlets? There's rarely (ever?) a good reason.
Since we are taking about a custom tag, my guess is that in the TLD file there isn't the rtexprvalue option set to true for that particular tag attribute:
<attribute>
<name>name</name>
<rtexprvalue>true</rtexprvalue>
.......
</attribute>
The rtexprvalue specifies that the attribute value may be dynamically evaluated at runtime.
If set to "false" it means that the attribute has a static value which is evaluated at translation; if set to "true" it means the value can be determined dynamically at runtime. Default is "false".
If the scriptlet does not work, it most likely means rtexprvalue is false. If you don't have the liberty to change that, then expressions won't work on that particular attribute.

How to display data in a textarea using struts application

How do you display data in a 'textarea' using struts application,
This is my code:
<html:textarea property="comments" </html:textarea>
<bean:write name="FormBean" property="comments"/>
where FormBean is my beanclass and comment is a property in beanclass.
But I cannot get it too work.
Thanks in advance for your help.
If you use Struts action forms and you have the html:textarea tag inside your html:form tag (this tag is only valid when nested inside a form tag body) then the following code is all you need:
<html:textarea property="comments" />
Don't know what you are trying to do with bean:write but if you want to display that inside your html:textarea I'm not sure you can. The property attribute is mandatory for the html:textarea tag and will use that as the content.