How to binding and change VM property value when DataTrigger?

Hi all,
Please see the below code. The current work is when mouse over myButton then set textbox value as 3. Then binding this value to ViewModel property, at this time, the new value of ViewModel property also be 3.
The textbox just like a bridge. Can I remove this bridge and change the VM property directly when <setter..... in myTrigger style? thanks.
<Style x:Key="myTrigger" TargetType="TextBox">
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=myButton}" Value="True">
<Setter Property="Text" Value="3"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>

This definitely works:
<Button Height="50" Width="100">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.MouseEnter">
<BeginStoryboard>
<Storyboard
Storyboard.Target="{Binding}"
Storyboard.TargetProperty="MyNum">
<DoubleAnimation To="3.0" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
Viewmodel:
public class MainWindowViewModel : DependencyObject
public double MyNum
get { return (double)GetValue(MyNumProperty); }
set
SetValue(MyNumProperty, value);
// Using a DependencyProperty as the backing store for MyNum. This enables animation, styling, binding, etc...
public static readonly DependencyProperty MyNumProperty =
DependencyProperty.Register("MyNum", typeof(double), typeof(MainWindowViewModel), new PropertyMetadata(callBack));
static void callBack(DependencyObject d, DependencyPropertyChangedEventArgs e)
Console.WriteLine(e.NewValue.ToString());
Hope that helps.
Recent Technet articles:
Property List Editing ;  
Dynamic XAML

Similar Messages

  • How do I change the property value priceInfo.amount?

    How do I change the property value priceInfo.amount?
    After changing the quantity field in the shopping cart and submit the form, I need to convert the field value priceInfo.amount and then set it again.
    How do I?
    Thank´s.

    Why do you need to convert this value and set it again?

  • How do i run an external monitor with my macbook and change settings so that when i close the lid the signal to the monitor is not lost and i can continue using the mac with a mouse and a wireless keyboard?

    How do i run an external monitor with my macbook and change settings so that when i close the lid the signal to the monitor is not lost and i can continue using the mac with a mouse and a wireless keyboard?

    No, nothing will prevent the computer from going to sleep when you close its display except third-party hacks that are designed to do exactly that. I strongly advise against using any of those, as they may interfere with successful entry into clamshell mode (and they carry other downside risks as well). Just wait until the computer is asleep (with its sleep light pulsing), then press any key on the keyboard. It sounds as though your setup is working as it's designed to do.

  • How can create and change PCA line items.

    How can create and change PCA line items.
    Please tell me the process and t.codes.

    If you are in version < 4.7 ee then use 9KE0 tcode for passing profict center entries or trasnafer of balances from one profit center to another.
    If you are in new GL regular FI entry like FB50 will hold good for account types "S"

  • How to remove and change the color of Java cup and border

    Hi to all,
    How to remove and change the color of Java cup and border.
    Thanks in advance
    khiz_eng

    This is just an Image. You would need to create your own image and call setIconImage(Image) on your JFrame.

  • "How are local and state taxes setup/updated when employee's address change

    Hi All
    I wanted to know "How are local and state taxes setup/updated when employee's address changes . - How is it done in SAP? -
    Thanks in Advance

    This defeats the purpose of trying to centralize SAP-related web resources on the SAP server. Typically IIS/Apache or other non-SAP servers are under the control of IT and not the SAP BASIS group.
    We simply would like to have a centralized location to store static web files so that they are not overwritten during Portal support pack applications.

  • How to personalize and set rendered property false to poplist

    HI,
    could u please tell me that How to personalize and set rendered property false to poplist
    when poplist was developed initially it's user personalization property set as FALSE, that is why when i tried to personalize and set rendered property as flase, i could not able to find the property as rendered for that perticular item.
    Please provide me step by step process.
    Thanks,
    Ram.

    Hi Ram,
    you can do set rendered false through personalization as well as co extension.
    if you go for persoalization set the profile option Personalize Self Service Definitions and clik on personaliztion link
    then search for item and set its rendered property to false.
    If you go for co extension capture the poplist bean and and setRendered(false) to that field.
    If you are feeling difficulty by personalizatoin better go for CO extension.
    Thanks
    Amit Jaitly

  • I am trying to use the brightness adjustment on a grayscale photoshop CS6 file.  The preview shows the adjustment working and changes the brightness, but when you click to apply the change, it does not apply the adjustment.  I have run into this problem b

    I am trying to use the brightness adjustment on a grayscale photoshop CS6 file.  The preview shows the adjustment working and changes the brightness, but when you click to apply the change, it does not apply the adjustment.  I have run into this problem before, although rarely, with some other files over the years and with earlier versions of CS.  I would like to know how to overcome this problem?

    Make sure you are viewing your image at 100%. At smaller views, pixels and layers and the way they interact are approximate interpolations and won't show you the actual pixel-for-pixel changes.

  • How to update zero to a column value when record does not exist in table but should display the column value when it exists in table?

    Hello Everyone,
    How to update zero to a column value when record does not exist in table  but should display the column value when it exists in table
    Regards
    Regards Gautam S

    As per my understanding...
    You Would like to see this 
    Code:
    SELECT COALESCE(Salary,0) from Employee;
    Regards
    Shivaprasad S
    Please mark as answer if helpful
    Shiv

  • How to assign and display an attribute value from backing bean?

    Hello all,
    I am using Jdev 11g. I have a form page which has two inputText attributes The first one implements a valueChangeListener feature. When the user enters a value in the first field, a backing bean function will be invoked through the valueChangeListener . In this backing bean function, based on the value in the first field, I want to assign the value to the second field and display it on the page. Can somebody help me how to achieve this?
    Thanks,
    John

    Hi John,
    Here is small example.
    Create two string variables in your backing bean and generate accessors for them.
        private String text;
        private String text1;
        public void setText(String text) {
            this.text = text;
        public String getText() {
            return text;
        public void setText1(String text1) {
            this.text1 = text1;
        public String getText1() {
            return text1;
        }Bind this variables to the value property of the input texts you have. Add the valuechangedlistener for the first input text (and also set autosubmit to true for that item). Also, add the id of the first input text as partial triggers for the second input text. Like,
            <af:inputText label="Label 1"
                          binding="#{backingBeanScope.backing_untitled1.it1}"
                          id="it1"
                          valueChangeListener="#{backingBeanScope.backing_untitled1.textValueChanged}" autoSubmit="true"
                          value="#{backingBeanScope.backing_untitled1.text}"/>
            <af:inputText label="Label 2"
                          binding="#{backingBeanScope.backing_untitled1.it2}"
                          id="it2"
                          value="#{backingBeanScope.backing_untitled1.text1}"
                          partialTriggers="it1"/>Finally, put the logic on your value changed listener. Like,
        public void textValueChanged(ValueChangeEvent vce){
            this.setText1("Hi " + vce.getNewValue());
        }Now, when you run the page and enter your name in the first input text, the second input text will display Hi <your_name>
    HTH.
    -Arun

  • How to resize and change the resolution of a batch of photos using Automator

    I searched for a long time tonight looking for the answer to this (seemingly) simple question:
    How do I use Automator to scale and change the resolution of a batch of images?
    It was not so simple.
    Links to this question:
    https://discussions.apple.com/message/12341246#12341246
    https://discussions.apple.com/message/12342026#12342026
    https://discussions.apple.com/message/5785047#5785047
    https://discussions.apple.com/message/1173358#1173358
    https://discussions.apple.com/message/5641853#5641853
    https://discussions.apple.com/message/3207516#3207516
    These are just the links on this site - I found them all over the place at MacRumors, Apple Tips, Mac Help, etc.
    You can actually manage this in Automator.
    Here are the steps that worked for me:
    Create an Automator APPLICATION - not a workflow (this is due to the way that I'm batch converting images - workflows might be ok for some cases)
    Step 1 is Copy Finder Items
    My flow inserts an SD card, opens the DCIM folder that my Nikon creates, selecting the images that I click (command + click to multi-select) and once I have the photos highlighted, I drag them onto this Automator App we're creating.
    <==  You'll have this guy soon!
    As a result - I want to copy the originals to my computer as step 1.  I don't touch the originals on the SD card (and cards are cheap so I tend to leave them on the cards as well)
    Step 2 is the Scale Images action - you can search the library for this and find it quickly.  For my part, I found that scaling images to about 38.8 percent of their size on the SD card is good for uploading to a blog.  Change this value to whatever you wish.
    Step 3 is Run Shell Script - and here is where we marry the brilliance found at this link with our script.If you have a hard time reading the text in the image, it is as follows:
    #bin/bash
    for f in "$@"
    do
         /usr/bin/sips -s dpiHeight 72.0 -s dpiWidth 72.0 $f
    done
    Save this application (I named mine "Format Photos")
    Place the application inside the target folder where you want the images to end up.  I do this because when I have the SD card window open, I can also open my "Photos" window and see my App sitting there.  I select my images as I mentioned and drag them on top of this app.  The app copies the originals and the conversions into the folder.
    NOTES: When you open a converted pic in Preview, you will see Resolution = 300 dpi if you go to Tools --> Adjust Size...  This reading is explained by another brilliant discussion as sips only touches the JFIF properties inside the file's MetaData.  However, if you look at the bottom of the Adjust Size... window, you'll see the image size is probably around 500 kb (give or take depending on the original).  My goal was to get the images down from the 3.0 MB I shoot at to around 500 kb.  Therefore even though the MetaData still thinks that it is 300 DPI according to Preview, it has been changed to 72 (open it in some other applications mentioned at the links and you'll find different readings - it all depends on what the application reads from the Meta).
    This does not rename the files, so you'll get DSC_1000.jpg and DSC_1000 copy.jpg in all likelihood.  If that annoys you, add a step into the Automator Application that renames the file after the "Run Shell Script" action has run, and you can have each file renamed according to some convention that you like.
    This took a heck of a lot longer than I expected - so I decided to put in the effort to share this with the community and save others the hassle. 

    PPI is pixels per inch of the image.  It is difficult to increase resolution as you are trying to add data that is not there.
    But for printing purposes what you want is dpi or dots per inch.
    The image processor either accessed from Bridge (tools/photoshp) or PS is a good way to change a batch of images.

  • How to check and change the dafault session timeout of the Portal?

    Hello,
    When leaving a portal page open without using it for a certain amount of time and then accessing it again the Session times-out.
    Where can I check and change this default time-out time in case I would like to extand it for the end users?
    Roy

    Hi Roy,
    Session timeout includes multiple settings (J2EE setting and SSO setting at User Management).
    Defining the Timeout in J2EE Session
           1.      Open file web.xml (path depends on the version of EP6.0. If it is based on NW04, then
    ..\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF
           2.      Enter a value in minutes under <session-timeout>. The value should roughly correspond to the length of a synchronization cycle. The default is 30 minutes.
    After a successful login, it receives a SSO ticket which is valid for longer duration (generally 8 hrs, default which you can changed using  "System Admin" as mentioned by Yoel.
    Thanks,
    Swapan

  • How to select and change special characters

    Hi all,
    In my document wherever a, e, i, o, u comes in RED color that i want to add one black dot below that characters.
    Now what we do is place one dot then use baseline shift after that use kerning upto 400 like that only.
    Job font is Palatino Lt Std.
    Its time consuming a lot!!!
    Write now i am using GREP options only.
    or
    Myself creating script for wherever RED color comes it create a character style  after that i did it  manually without seeing the  Manuscript.
    My script follows:
    Any script is availble which i can select and change it.

    Can anyone look into my previous thread?
    Please find my attachment first, after that definitely you got an idea.
    Awating for your reply....
    by
    Learner

  • Illustrator cs5 changes Kuler color values when importing, Help!

    I am using Illustrator cs5. I access the Kuler Color theme feature for color themes. I will select a them from the Kuler feature
    and then choose to add that theme to my swatch panel. I then check the individual colors in the color panel. Here is the
    problem: when illustrator brings in the Kuler colors to the Illustrator color panel it will change the values of that color which
    changes the actual color. For instance a bright green becomes a muted turquoise. This conclusion is not by my sight,
    because I have opened the specific color theme at the Kuler Web sight and obtained the CMYK values for those colors,
    and then gone back to the Illustrator color panel and compared then values there. The values are changed which creates
    a different color --- obviously. So how can I use the Kuler feature when illustrator changes the values on me which then
    changes the color? Help

    I dont know what my color settings are at this point.
    I download the Kuler color theme straight from the Kuler panel open on my desktop. I open
    the drop down menu options and choose: add this theme to your color swatches. The
    theme is moved over to the swatch panel while I am using Illustrator.
    I don't know what you mean by your last question.

  • I am facing problem while accessing property value when i include a component inside another

    Hi Everyone,
    I am unable to access property value of richtext of a compoent that is included in another compoent.
    I have created a compoentA at following location myProject/components/componentA.
    I then created componentB at this location myProject/components/componentB
    ComponentB contains a design_dialog that has a richtext widget with following properties:-
    xtype=richtext
    name=./description
    titile=productdescription
    I have then included componentB in componentA.jsp using <cq:include path="productdescription" resourceType="myProject/components/componentB" />.
    I have then dropped componentA on a page. In design mode i could see the edit dialog for componentB and on edit I could see the rich text, but when i am trying to access the values entered in richtext inside componentB.jsp i am getting null/default value.
    <%=properties.get("description","Description not present")%>
    Can any one tell me why the property is not accessible on the included component.
    Thanks

    What is the tree structure created for the property of the componentB?
    Can you try the below code in your componentB jsp and check whether you are getting the property value
    Resource resource = slingRequest.getResource();
    String description = ((String) ResourceUtil.getValueMap(resource).get(
                        "./description", String.class));

Maybe you are looking for