Change WF4 ActivityDesigner theme - workflow-foundation-4

I want to change my rehosted activities look to:
Already tried ActivityDesignerTheme
Need to do it without using WorkflowViewElement because I don't want to lose it's behaviors (breakpoint, expanding).
If it's not possible, is there a way to change ActivityDesigner header background color?

#Will
I was annoyed too by the default behavior of the ActivityDesigner header when editing the DisplayName (especially the part where it positions the caret at the beginning of the string). I used Reflector to peek (System.Activities.Presentation.dll) at the implementation and I noticed that some of this behavior is defined in OnApplyTemplate. By just overriding this method in my custom designer class and NOT calling base.OnApplyTemplate(), I was able to make the DisplayName read only in the header (in my case that was all I needed, but I think one can play with some custom event handlers in there and tweak the behavior).
#Davi Fiamenghi
Digging around some more with Reflector in the same assembly, I found the controls used in OnApplyTemplate defined under system/activities/presentation/workflowelementdesignerdefaulttemplate.baml (System.Activities.Presentation.g.resources). That seems to be the default control template used for ActivityDesigner (<ControlTemplate x:Key="WorkflowElementDesignerDefaultTemplate" x:Uid="ControlTemplate_1" ControlTemplate.TargetType="{x:Type swd:ActivityDesigner}">). I guess one way to change the header color would be to try to "re-create" this template in your application and set it explicitly in your custom activity designer. Of course it's more involved than just copying it, since it appears to be referencing other resources defined in that assembly.
Hope this helps.

Related

How to add android attributes like android:id on Xamarin Forms(XAML)?

I've already tried setting android attributes like contentdescription by creating a custom element and setting the attribute on the renderer using the control.
Control.ContentDescription = ((MyEntry)e.NewElement).ContentDescription;
Is there a way to do it on the XAML rather than custom renderer?
Another, how can I set the android:id attribute? I've tried it change it on custom render but I think it's not working.
Sidenote: I'm using a RealWear device which can generats a script which has the UI elements of the page. The UI elements will contain the id attribute if it exists.
Hello and welcome to StackOverflow.
you can't add Android descriptions to xamarin forms elements.
Xamarin forms abstracts the ui to a non-native format (xaml) and converts the abstract definition of an element to a native one. However this happens "under the hood" and therefore you don't have direct access to that from xamarin.forms.
What you could do is, if you really need an element with a set id, you can either find a way to hack in your id using a custom renderer or you create and embed native elements.
For the latter please see the following microsoft article, which is a bit too much to include within this answer: https://msdn.microsoft.com/en-us/magazine/mt790186.aspx

Informing RactiveJS about new object properties in magic mode

I'm new to Ractive.js and using "magic mode" so that updates to my JS objects automatically trigger updates to my UI. Everything is working great except that I have some properties which are added to my bound objects after my Ractive instances are rendered. This means that Ractive doesn't see changes to those properties, so the "magic" doesn't work for them.
As a workaround, I've found that I can just initialize those properties with 'empty' values before passing them to Ractive, but it feels a little unnatural.
Is there a preferred way to inform Ractive that I've added a new property to an object that it should start tracking?
My experince is that you can du that in 2 ways.
The first is the one you describe in your post.
The second is to "add" the property through the template that you use to render the object.
What ractive actually do when you set magic mode to true is "wrapping/replacing" your field with a property wich monitores the changes to the field.
I have had som issues using magicmode when i use Object.DefineProperty on my data objcect. (stuff get called twice)
I would go for soulution 1, and define all fields ahead of time.
Also be aware of setting your field(wich is actually now a property replaced by ractive) to something that is not a valuetype as that will again overwrite the property and mess up magicmode.

Fastest way to render dijit widgets

What's the fastest way to render dijit widgets?
I know that the programmatic way is faster than the declarative. (Some reference)
I have a custom widget that loads too slowly (it's a datagrid with combobox, buttons and other small dijit widgets used for adding filters, etc).
Looking at the source, I see that all the dijit widgets are created programmatically, but the DOM nodes where they are inserted into are created programmatically as well.
Is it the "right" way?
I'm trying to speed up the rendering of this widget, and currently my choice would be to combine a velocity template (my company uses struts2 + velocity) to create the DOM nodes, with programmatically created widgets (using placeAt and similar methods to insert the widgets into the already built DOM nodes).
It would work fine, but sadly all the css classes are overwritten by dijit, so I have to overwrite them again, which causes a sensible overhead.
In the template I write something like this:
<input id="idOfAnExistingDomNode" class="myCssClass" />
And to insert a FilteringSelect in that DOM node I have to write this:
var fieldSelect = new dijit.form.FilteringSelect({
store : jsonStore,
searchAttr : "caption",
labelAttr : "caption",
selectOnClick : true,
value : "Content"
}, "idOfAnExistingDomNode");
fieldSelect.domNode.className += " myCssClass";
The last line is necessary because myCssClass is overwritten during the creation of the FilteringSelect.
Is there any way to avoid this issue?
Or, perhaps, I'm trying to do this thing the wrong way? I'm not completely sure about that "velocity template" thing.
Note: Dojo version is 1.5 and no, sadly we can't upgrade it to newer versions.
Please forgive me for my TERRIBLE English.
Often one of the faster ways to instantiate widgets is to create them in a temporary div and then move that div onto the DOM. Have you tried profiling what exactly is slow in this instantiation? Part of me wonders if too much time is being spent waiting for data, as a few widgets + a grid with reasonable pagesize params shouldn't take long to load.
As for your class issue, it is strange that dojo is not mixing in the existing class. That said, you could do a lookup on the node first, get the class attribute, and then specify it as
the class attribute in your mixin object when creating the FilteringSelect. If you do so, be sure you wrap class in quotes or older IE's will reject it.

ASP.NET 3.5 - Making a field readonly/unmodifiable without "disabling" it

I have a web application with a form that has disabled fields in it. It allows a "Save As" function which basically means the settings can be copied into a new configuration (without being modified) and in the new configuration they can be changed to something else. The problem I am running into with this is that since the fields are disabled, they are not getting posted through and do not appear in the context object on the server side.
When I removed the logic to disable the fields, that part works fine. So the remaining problem is, how to "disable" the fields (not allow any change of the data in any of the entry fields) without really "disabling" them (so that the data gets posted through when saving)?
I was originally looking for a way to do this in CSS but not sure if it exists. The best solution is of course, the simplest one. Thanks in advance!
(Note: by 'disabled' I mean "The textboxes display but none of the text inside of them can be modified at all". It does not matter to me whether the cursor appears when you click inside it, though if I had a preference it would be no cursor...)
http://www.w3schools.com/TAGS/att_input_readonly.asp
readonly attribute is what you want.
i would suggest that instead of using the non-updateable field values from the page's inputs, you retrieve the original object from the DB and copy them from there. It's pretty trivial using something like Firebug to modify the contents of the page whose form will be posted back to modify the values, even if they are marked as readonly. Since you really want the values from the original, I would simply reget the object and copy them. Then you don't need to worry about whether the original (and non-updateable) properties get posted back at all.

Flex component access other component

I have 2 components for example (editor.mxml using mx:windows), when I click an edit button, I want to get the current value from the other component's datafield? (datagrid.mxml using mx:window)
I do know how to access the main MXML's datagrid by parentDocument or Application.application method, but stumped block if I want to access other way as mentioned above. Keep the code as simple as possible.
You could either do dependency injection, that is, give component A a reference to component B so that they can communicate directly (example of tighter coupling,) or have both components communicate through a common mediator using events (example of more loose coupling.)
Both of those options would be implemented wherever it is that you're creating those components (A and B in this example) and adding them to the display list.
This might be more complicated than it deserves, and it smacks of Pattern-Fever, but you could use a mediator class that listens for the CLICK event from the button and knows enough about the other component to query its property. It could even transmit that data using a custom event, which the button listens for.
While this involves three classes instead of two, it often turns out to be easier to have two components that focus on looking good and one that worries about coordination.
Cheers
Try this:
FlexGlobals.topLevelApplication
This points Your root. From the root You can grab every element You want.
You can also add an id to the custom component like this,
<custom:Editor id="myCustomComponent">
</Editor:AddressForm>
and
access your datagrid's value like this,
var data:ArrayCollection = myCustomComponent.DatagridID.dataProvider;

Resources