Setting Width and Height in runtime

Thread ID:

Created:

Updated:

Platform:

Replies:

I'm trying to set the desiredwidthindockedmode and desiredheightindockedmode of contentcontrol in XAML based on the sideindockedmode property during runtime. I've tried using the triggers to achieve this functionality but it doesnt work. Can you please provide a solution for this?

At the run time we have some issues with the SetDesiredHeightInDockedMode and SetDesiredWidthInDockedMode. To overcome this constraint We have implemented a new methods for setting the hosted element’s Height and Width. You can make use of this. This can be achieved by using the following code snippets.

As we said in my previous update, we have some issues with the DesiredHeightInDockedMode, DesiredWidthInDockedMode properties while we change in run time. You can easily use those properties in the trigger as follows.

[XAML]

But currently due to this defect we will not be able to change the DesiredHeightInDockedMode, DesiredWidthInDockedMode properties dynamically. So you will not be able to use it in the XAML. This will be fixed in our upcoming releases.Asas As work around you can make use of the SetHostHeight and SetHostWidth methods, using which you can dynamically iterate through the each and every element of the Docking Manager check for the corresponding side in Docked Mode for the frame work element and apply the host height and width for the corresponding element.

//iterate through each and every elementforeach (FrameworkElement felement in dockingmanager.Children){//check the SideInDockedMode