Applying binding after the Windows's Initialization?

I searched a lot to find a solution to get the ActualWidth of an image in a ViewModel class. The solution is [Link]. I am trying to change the
width/height of the Image at runtime using a slider. When the image is inserted, I want to get the actualHeight of the Image and increase/decrease the size according to slider in percentage so that it'll stay in correct aspect ratio. As I have set the Image
width/height to bind to the property in the VM and until the image is loaded I won't know the image size, it sets it to 0. Henceforth the percentage increase of 0  = 0! 
Here is the code:
<Image x:Name="GraphImage" Source="{Binding ImageSrc,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="{Binding ImageWidth,UpdateSourceTrigger=PropertyChanged}" Height="{Binding ImageHeight,UpdateSourceTrigger=PropertyChanged}">
<pb:PushBindingManager.PushBindings>
<pb:PushBinding TargetProperty="ActualHeight" Path="Height"/>
<pb:PushBinding TargetProperty="ActualWidth" Path="Width"/>
</pb:PushBindingManager.PushBindings> </Image>
public double ZoomValue
get { return _ZoomValue; }
set
_ZoomValue = value;
ImageHeight = (_ZoomValue / 100 * Height) + Height;
ImageWidth = (_ZoomValue / 100 * Width) + Width;
NotifyPropertyChanged();

>>I have bind the Width and Height of Image to the VM properties, before initializing the image, its width and height are set to 0. Thereafter, the ActualWidth and ActualHeight are set to 0 also.
Of course the ActualWidth and ActualHeight are 0 if you have set the height and width properties to 0...you can specify default values in the view model class if you want the image to have a default size before the sliders have been touched, e.g:
private int _imageWidth = 50; //default width
public int ImageWidth
get { return _imageWidth; }
set { _imageWidth = value; }
>>I need to somehow send the ActualWidth before setting its Width.
Why? The ActualWidth will always 0 before the Width has been set anyway. If you want to know the value of the ActualWidth property whenever the Width property changes, you could handle the SizeChanged event for the Image and send a message to the VM in the
event handler:
<Image x:Name="GraphImage" Source="..."
SizeChanged="GraphImage_SizeChanged"
Width="{Binding ImageWidth,UpdateSourceTrigger=PropertyChanged}"
/>
private void GraphImage_SizeChanged(object sender, SizeChangedEventArgs e)
Image image = sender as Image;
double actualWidth = image.ActualWidth;
//send to VM using messenger....
This event is invoked whenever the size changes.
The other option is to keep a loose reference to the view (the view implements an interface with a "GetActualWidth" method which is implemented to return the ActualWidth of the Image element) in the view model class and get the ActualWidth in the
setter of the ImageWidth source property:
public int ImageWidth
get { return _imageWidth; }
set
_imageWidth = value;
double actualWidth = _viewReference.GetActualWidth();
//do whatever...
You pass the view reference to the view model class when you create it:
this.DataContext = new ViewModel(this);
Please remember to mark helpful posts as answer and/or helpful.

Similar Messages

  • HP Envy dvd drive issues after the Windows 8.1 update

    I have a HP Envy and after the Windows 8.1 update the dvd drive is not working. I can see the drve but it is difficult to get the drive to open or recognise there is a disc in it. What can I do?

    Hello @Jenino,
    I understand that you are having issues with the Optical Drive on your HP ENVY 7 PC. I would be happy to assist you, but first I would encourage you to post your product number for your computer. I am linking an HP Support document below that will show you how to find your product number. As with this I can provide you with accurate information.
    How Do I Find My Model Number or Product Number?
    Please re-post with the requested information and I would be happy to provide you with assistance. Thank you for posting on the HP Forums. Have a great day!
    Please click the "Thumbs Up" on the bottom right of this post to say thank you if you appreciate the support I provide!
    Also be sure to mark my post as “Accept as Solution" if you feel my post solved your issue, it will help others who face the same challenge find the same solution.
    Dunidar
    I work on behalf of HP
    Find out a bit more about me by checking out my profile!
    "Customers don’t expect you to be perfect. They do expect you to fix things when they go wrong." ~ Donald Porter

  • HT3986 How do I start up Mac after the Windows has been installed.

    How do I start up Mac after the Windows has been installed? And after I installed the Windows, my Audio is gone. How can I get it back?

    Welcome to the Apple Support Communities
    1. To boot into Mac OS X, press X key while your computer is starting.
    2. Install Boot Camp drivers

  • T60p, can't go to desktop after the Windows Logo, only the cursor stays here and can move[pic]

    My Thinkpad T60p can't go to desktop after the Windows logo, it has fingerprint, but never appears, only the cursor stays here and can move, the back ground is not black, nothing happens pressing Ctrl+Alt+Del or Win button.
    Can go to safe mode but the same situation, the cursor is here, black background, nothing happens pressing Ctrl+Alt+Del or Win button.
    After a long time of searching I guess the very most possible reason is system updating many patches guided by a software that lead me did that.
    Thanks!
    Dan
    Link to image
    Moderator note: images totalling more than 50k converted to links per forum rules:  Lenovo Community Participation Rules

    If I was given this laptop to diagnose the first thing I would do is swap in another harddrive and confirm all the hardware works. If you don't have another drive to boot from you can use a Linux live-cd, it'll pretty much tell you the same thing and if the laptop works, your solution would be to either fix your operating system or reformat and start over with a new installation. 
    ThinkPad W-510 i7-820QM(1.73-3.06GHz) Quad Core... ThinkPad T500, T9900, 8gb SSD...FrankNpad T-60p/61p (X9000 2.8ghz) 8gb SSD ips FlexView...ThinkPad T-61p (T9300 2.5ghz) 8gb ram...Thinkpad X-61 Tablet 4gb ram...ThinkPad A-31 (1.9ghz P4 1.5gb ram)

  • Satellite A210 - Screen turs off after the Windows startup screen

    when I boot my windows there is the startup screen. After this my screen turns off and can't login to windows.
    Satellite A210
    ATI Mobility Radeon HD2600
    Where can I get some old drivers for the ATI Mobility Radeon HD2600, which I can install without starting windows?

    > Where can I get some old drivers for the ATI Mobility Radeon HD2600, which I can install without starting windows?
    Please dont understand me wrong but I think you are on the wrong way.
    Device drivers (graphic card, LAN, etc.) have to be installed within running system (i.e: Windows OS, etc)
    Im sure; driver isnt the problem if nothing is visible on the screen.
    First of all I would recommend you to connect the notebook to an external screen/monitor just to check if something would be visible on the 2nd display.
    But just one question: did you try to boot the notebook using a bootable disk (windows installation disk, Toshiba recovery disk or similar???).
    Maybe the Windows system is muddled up and therefore you are not able to boot up the system? In my opinion you should test this option.

  • Boot Camp crashes after the windows software support download is finished and before the software is installed on the thumb drive

    I have previously installed Boot Camp on this Computer (MBP mid 2012, 15" 2.6 GHZ).  I recently replaced the hard drive and was reestablishing bootcamp again.  While Boot Camp is writing to the USB thunb drive it crashes and rebootrs.  The crash does not generate and message other than a note that there has been an error and the computer is restarting.  I have tried several different thumb drives all with the same result.  It makes me think that the new hard drive (a Seagate Momentus XT 750GB 7200 rpm unit) does not work with Boot Camp.  Does anyone have any thoughts or solutions?

    Hi,
    I solved the problem myself. This might help others.
    Recap:
    The Windows XP Pro CD was always ejected by Boot Camp and it wouldn't mount at all when inserted in the CD slot. The CD was however readable on a Windows Machine.
    It was not easy to detect but the Windows CD was physically deformed. It wasn't flat. It was a little convex (the outer edge was higher than its center). My iMac wasn't able to read it at all but a PC was able until I decided to test it with a full install on the PC. About half way during the installation, it stopped and an error message was displayed by Windows Setup "Disc Read Error - Disc might be damaged".
    I ejected the CD and discovered the deformation. So I carefully placed the outer edge of the CD over a ring and put some weight on its center to try to undo the deformation. I've waited 2 days then retested the CD and it worked at the first attempt. My iMac was happy and so was I. I made a security copy of the CD while it's still readable in case I have to re-install later.
    I find Microsoft cheap of putting their Installation CD in a paper sleeve. If the CD have been stored in a CD case this would not have happened.
    End of the story.

  • Yoga 13 users - what is your graphics driver version after the Windows 8.1 upgrade?

    I just noticed something interesting - it looks like the Windows 8.1 installation installed a very new version of the graphics driver.  Mine is showing as version 10.18.10.3316, dated 10/1/2013 (Oct 1).
    Anyone else seeing this?
    I should mention that I had previously updated the graphics driver about a month ago using Intel's generic HD 4000 driver. To do that, I just went to the Intel site and ran their driver update tool from the browser - it scans your machine for Intel hardware and displays available updates. This driver tool recognized my HD 4000 and updated the driver. But the Windows 8.1 installation updated to an even newer version.
    I'm wondering if my previous update was a factor in why I have this updated graphics driver, or is everyone seeing this?

    I guess you're asking 8.1 users, but i must say that intel upgrade seemed to help my 8.0... thanks for the heads up.

  • Issue in Web Service after the Windows migration from 2003 to 2008

    My application is a web service and it was working fine in windows server 2003 .after it was migrated to 2008 ,the web service is working fine and but when its consumed in another web application which is also migrated to windows server 2008 ,its saying
    "request channel  timed out while waiting for a reply for 00:30:29.9820000.Increase the time out value passed to the request or increase the SendTimeout value on the binding .the time alloted to this operation may have been a portion of
    a longer time out" error.The iis setting of my application in production has anonymous authentication enabled but the kerberos is not generating tokens and hence its also not working fine.When we disable the anonymous authentication the kerberos
    token is generated but the application is prompting for credentails.Please help me to resolve the issue

    Hi,
    Since this issue is more related to IIS, I suggest you refer to IIS forum below to get more efficient support:
    http://forums.iis.net/
    Best Regards,
    Amy

  • I am trying to download and install firefox and I get the window to click on run, I click on it and it says it is downloading and after the window closes there is no logo to click on for installation

    I have tried to download several times over the past three days and the above always happens

    You can try using this tool to first remove all traces of Reader from your computer:
    http://labs.adobe.com/downloads/acrobatcleaner.html
    Then, you can download the full offline Reader installer from
    http://get.adobe.com/reader/enterprise/
    After downloading, restart your computer and run the installer before doing anything else.

  • My Acer Aspire E 15 fails to boot up after the Windows 10 upgrade.

    Hello , im having a problem booting up my laptop. i just upgraded to Windows 10 from Windows 8.1 recently. my laptop won't boot up the first time ( the Acer logo appears and the cycling dots turn but then the screen goes black ) so then i turns the laptop off ( pressing the on/off button for several seconds until the blue indicator light turns off ) and then it boots up ok the second time when pressing the on button. haven't the faintest idea on what to do. Anyone willing to help out is appreciated. Thank you. Bye , Neil

    Thanks.  My Acer E5-511 works fine when I used the the Win 10 recovery and go back to Win 8.1.  When I reinstalled Win 10 it had the same problem with the brightness bar. I will try the Microsoft Win 10 Reset today and report back.  Until then changing the brightness settings works ok for me. Thanks,Dale

  • WIFI doesnt work after the windows 10 upgrade

    hi i'm having a wifi problem once i've  upgraded to windows 10to be short , my wifi is disabled and i cant activate it neither manually ( Fn + F12 ) or authomatically (via windows )i tried to update my drivers ( they are all updated ) and the strange thing is that my bluethoot works perfectely !i'm having also a driver that says it is damaged it has a yellow triangle in it , this is its name ACPI\HPQ6001\2&DABA3FF&3thanks for your help

    Finally I've solved it! I have a "HP Pavilion dv6 Notebook", I used to turn on/off mi WIFI with FN+FN12 combination in Windows 7. When I've installed Windows 10, I realized that this combination does not work anymore, it only enables/disables the Airplane Mode.  My assumption for the root of the issue is; if somehow if you forget the WIFI turned off during Windows 10 installation, it stays turned off from the BIOS, and if you dont have a hard switch (not a key combination) to turn it on you will not be able to turn it on via the keyboard, because FN+FN12 combination will not trigger it anymore.  For my Pavillion solution was (as someone mentioned it in the forums earlier) to load the default options from the BIOS, which will reconfigure your BIOS and WIFI will be "Hard Enabled" as it was in Factory Defaults. Don't forget to "Save and Exit" when exiting the BIOS menu.  Good Luck! 

  • Can't boot my T500 anymore... just getting to a black screen after the XP logo

    I have a big problem with my Lenovo T500. Never had any problems before. Then yesterday, I could not open OpenOffice anymore, neither convert to pdf from an already open OpenOffice document. I got error messages saying the programmes can't be openend. After trying to re-install Adobe Reader failed, I simply wanted to restart the computer, seeing if that oculd help. And now the big problems started...
    Re-booting was not possible. For 20 seconds, it seemed normal. But directly after the Windows XP logo (using
    Windows XP Professional 1), the screen went black and that was it. I see the mouse cursor and can move it, but that's it.
    After waiting some time, I turned the laptop off with the power button. And restarted it. This time getting to the screen where I could choose "safe mode" or normal startup, because the computer had been shut down improperly. First I tried normal mode, which lead to the same black page. Then I did the same again and tried "safe mode", which didn't work either - I just got the black screen with the "safe mode" notifier in every corner.
    What I tried then was the ThinkVantage button directly when starting the computer. Which lead me to the "rescue and recovery" menu where I could choose what to do: Complete recovery, losing personal files (it's about music, pictures, text documents for me) or quick recovery without losing files. Also there was the option of saving files before through USB. This is what I tried first. I marked 50GB of files and wanted to transfer them. Problem: Every external harddrive or USB stick I connected was not identified. So this failed.
    I chose to go with "quick recovery" first then. This took about 20mins. When it was done there was an automatic re-start which unfortunately got stuck at the black screen again...
    3 more re-starts using the power button did not bring anything either. The ThinkVantage button does not let me access the rescue and recovery menu anymore. It just says something like "checking the system" and then there is an automatic re-boot, which ends up at the black page.
    I am mighty scared now that I lost my computer and the data on it (I have backups for most things, but still).
    Does anyone know anything that could be done now? I do not have XP or anything, by the way. I bought this computer used a year ago and got it complete with XP installed (although I do have the product key). The warranty from the place expired 5 days ago and the place is in Germany, but I live in Sweden. They told me they can't help me but I should contact a local repair place.
    If anyone has an idea about what the problem could be (virus??) and maybe some help, I would be VERY VERY thankful.

    Maybe I should add that I probably didn't do the best thing with anti virus programs. I used Microsft Security Essentials, which was installed when I bought the computer.
    When downloading some program (not sure whether it was Acrobat Reader), I was asked to get McAfee. Kind of weird, I had said no. But McAfee somehow checked my computer and told me my MP4 player contained a trojan. That was 5 days ago. Security Essentials couldn't find it, even scanning the MP4 player directly. I guess I should have switched right away and to get McAfee to remove the thing? Maybe this is what caused all the trouble...

  • When I begin to attempt to download the windows support software in boot camp, it says the windows support software is unavailable. Is there any other place I can download it for a Macbook Pro 5,5 intel core 2 duo without the original CD?

    When I begin to attempt to download the windows support software in boot camp, it says the windows support software is unavailable. Is there any other place I can download it for a Macbook Pro 5,5 intel core 2 duo with snow leopard without the original CD?

    Hi,
    apart from the MacBook Air this feature is of no use for other Macs right now.
    Simply ingnore it (click "I already have the Drivers...) and continue with the installation.
    Sorry to say but you need the OSX Install DVD for the BootCamp Driver installation.
    The 3.0 version of the BootCamp Drivers is only avaiable on the disc.
    Later updates (3.1 and 3.2) can be downloaded from Apples Support website.
    Call Apple and ask for a replacement and they usually send you one for a small fee.
    And have the Serial-Number of your Mac at hand when calling.
    And since the OSX Install DVD can also be vital for maintenance and repair it is best to have one.
    The needed BootCamp Drivers are on the OSX Install DVD 1 that came with your Mac.
    Insert that disc while in Windows after the Windows installation to install the drivers.
    Regards
    Stefan

  • Just got a new Macbook Pro... I want to install the drivers on the Windows partition I made through Boot Camp

    but can't seen to find the disc. Does it even come with the computer??

    In the OSX BootCamp Assistant did you download the "Windows Support Software" (aka BootCamp Windows Drivers) and installed them after the Windows Installation ?
    The Boot Camp - Installation & Setup Guide (OS X Lion) describes how-to do this.
    OSX 10.7 Lion does not come on a disc.
    Stefan

  • Folder Redirection policy is not applied to a user, when the server target is changed, but works after resetting the windows profile.

    Folder Redirection policy is not applied to a user, when the server target is changed. 
    After server target is changed via group policy, when user login  (roaming profile)first time, the the new server target has not been applied, instead it's pointing to the old folder redirection path.
    But if we reset the windows profile (roaming ), the new folder redirection works, can you please specify a solutions that the new folder redirection works when the user login for the first time. so it reduce the time on resetting users profile.
    it seems that we need to delete the old folder redirection path from the user profile (roaming user profile) via group policy or similar solutions..
    Many Thanks

    >   But when the specific users login they all get the same error, it
    Is the old server removed from the domain? Seems so - or some other
    authentication related issue, hard to tell from here...
    > seems that the roaming user profiles still keeps the old server details,
    Yes - if you change redirection targets, FR moves content from old to
    new, and only if this ends sucessfully, it will update the redirection
    target.
    Make the old redirection target accessible to the user and you'll be fine.
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))

Maybe you are looking for