Question: How to resize the “RadTileViewItem” in “RadTileView” to the half of ActualWidth of window, while minimizing.
Solution 1-RenderTransform of FrameworkElement
Using FrameworkElement and setting up RenderTransform to perform the necessary arithmetic/calculations required.
- Create a “FrameworkElement” and define the transform that will render the actual mathematics behind the scene.
- By binding the ActualWidth of the page and assembling constants of 0.50, the resultant composite transform has an OffsetX value equal to 1/2 of the page width.
- You can try the transform multiplications to assure yourself that's what's happening.
- Now, bind the “MinimizedColumnWidth” property of RadTileView to FrameworkElement’s OffsetX value which is get calculated as described above.
Solution 2-Converters
<Window.Resources> <Local:appendKB x:Key="adjustValue"/> <Window.Resources> <Setter Property="Width" Value="{Binding Path=ActualWidth, Converter={StaticResource adjustValue}}"/> |
Converter Class:
using System; using System.Collections.Generic; using System.Text; using System.Windows.Data; namespace Simple123 { public class adjustValue: IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { double s = (value/2) + 300; return (s); } public object ConvertBack(object value, Type targetTypes, object parameter, System.Globalization.CultureInfo culture) { throw new NotSupportedException("ConvertBack should never be called"); } } } |
For more details : http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/08e73076-4d88-468b-a402-1e6c9429c5e1
No comments:
Post a Comment