How to identify whether the control is going inside the window / tab control bounds in WPF -


I make the control height as double when the mouse is on that control and the control height should be normal when the mouse Control.

Consider when the button is on a button, so I am using the following style to make the height of the button twice.

: type button} "& gt; Style.Triggers & gt; Trigger Property =" Ismouth Over "Value =" True "& gt; Setter Estates = "RenderTransform"> Setster.Value> & lt; /Setter.Value> & lt; / Setter & gt; ; & Lt; Setter Property = "Render TransformAgren" value = "0.5,0.5" /> gt; Setter property = "Panel.ZIndex" value = "99999" /> & gt; & gt; / catalyst & gt; LT; /Style.Triggers>

If the button is placed near the window / tab control limit, then the button controls the tab control / window boundary When it is spread (when it is on the mouse button)

I do not want the button to go inside the tab control / window boundary.

Should be taken inside the window (render transformer organs should be replaced) when the button touches the tab control / window border.

I have attached my sample app for your reference. / P>

You can convert your RenderTransformOrigin Setter to Try to use

Convert the converter as a parameter and check to see that the position of the control within its parent is between 0 and (control / 2) and If it is calculated and returns a different Render Transformor value to the value. If not, just default (0.50.5)

Edit: To answer your comment, I'm not sure about the exact syntax because I do not test it I am thinking, but I was thinking something like the following:

Create your converter This would probably be a multi-binding converter

  Public class RenderTransformConverter: IMultiValueConverter {public Object convert (object [] value, target Type Rkar, object parameters, CultureInfo culture) Get {// parameter - you want to include "Maybe validation and default values ​​UIElement control = (UIElement) value [0]; UIElement parent = (UIElement) value [1]; Int controlHeight = control.Height; Int controlXPositionInParent = control.TranslatePoint (new point (0, 0), parent) .x; If (controlXPositionInParent & lt; (controlHyight * .5)) // // Calculate a new render transformer. I should verify that I am correcting the math, I did not get too much sleep last night, new point (0.5 , Control XPositionInParent / controlHeight); } And {new point (0.5, 0.5); }} Public Object [] Convertback (Object Value, Type [] Target Type, Object Parameter, CultureInfo Culture) {New Non Imulated Expansion (); }}  

Your XAM will include a line to include the converter namespace and create an object of the new converter.

  & lt; LocalNamespace: RenderTransformConverter x: key = "rendertransformconverter /";  

Then your style will use something like this:

MultiBind Converter = "{Static Resources Reader Transformer}" & gt; Binding Path = "{Binding Relative Soros = Self}" /> gt; & lt; Binding Path = "{Binding Relative Soros = Self, Path = Parent}" /> gt; & lt; / multibinding & gt; & lt; /etter.value>

I am positive If you can control the parameters as a parameter for a converter, but if not, you may need to rearrange the parameters to obtain the required value for calculation.

< / Html>

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -