wpf - Bind width of popup to width of other control with some margin -


i want popup have same width width of control, margin.

what want is

 <popup x:name="profilepopup" height="auto"          width="{binding actualwidth, elementname=headercontainer}" -10 > 

but how do '-10' part in wpf ? or possible in code?

you'll need converter you:

public class sumconverter : imultivalueconverter {     public object convert(object[] values, type targettype, object parameter, cultureinfo culture)     {         if (parameter != null && values != null)         {             double result = 0;             foreach (object objectvalue in values)             {                 double value = 0;                 double.tryparse(objectvalue.tostring(), out value);                 if (parameter.tostring() == "add" || parameter.tostring() == "+")                      result += value;                 if (parameter.tostring() == "subtract" || parameter.tostring() == "-")                      result -= value;             }             return result;         }         return null;     }      public object[] convertback(object value, type[] targettypes, object parameter, cultureinfo culture)     {         return null;     } } 

you'd need add property containing amount want subtract (named borderinnerthickness in example) , use this:

<popup x:name="profilepopup" height="auto">     <popup.width>         <multibinding converter="{staticresource sumconverter}" converterparameter="-">             <binding path="actualwidth" elementname="headercontainer" />             <binding path="borderinnerthickness" />         </multibinding>     </popup.width> </popup> 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -