Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <TextBox Canvas.Top="{Binding ElementName=mySource, Path=myInt, Constant=5}"/>
- <TextBox Canvas.Top="{Binding ElementName=mySource, Path=myInt, Constant=8}"/>
- <TextBox Canvas.Top="{Binding ElementName=mySource, Path=myInt, Constant=24}"/>
- <TextBox Canvas.Top="{Binding ElementName=mySource, Path=myIntPlus5}"/>
- <TextBox Canvas.Top="{Binding ElementName=mySource, Path=myIntPlus8}"/>
- <TextBox Canvas.Top="{Binding ElementName=mySource, Path=myIntPlus24}"/>
- public class AddValueConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- object result = value;
- int parameterValue;
- if (value != null && targetType == typeof(Int32) &&
- int.TryParse((string)parameter,
- NumberStyles.Integer, culture, out parameterValue))
- {
- result = (int)value + (int)parameterValue;
- }
- return result;
- }
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- <Setter Property="Grid.ColumnSpan"
- Value="{Binding
- Path=ColumnDefinitions.Count,
- RelativeSource={RelativeSource AncestorType=Grid},
- Converter={StaticResource addValueConverter},
- ConverterParameter=1}"
- />
- <TextBox Canvas.Top="{Binding SomeValue,
- Converter={StaticResource MathConverter},
- ConverterParameter=@VALUE+5}" />
- Width="{Binding ElementName=RootWindow, Path=ActualWidth,
- Converter={StaticResource MathConverter},
- ConverterParameter=((@VALUE-200)*.3)}"
Add Comment
Please, Sign In to add comment