К сожалению, Point
является структурой, и структуры не поддерживают наследование. От MSDN
Примечание Структуры не поддерживают
наследование, но они могут реализовать
интерфейсы. Для получения дополнительной информации см.
Интерфейсы (Руководство по программированию в C #) .
Возможно, это не отвечает на ваш вопрос напрямую, но вы можете легко связать Point
с помощью конвертера. В вашем случае это будет похоже на
<SomeControl.SomePointProperty>
<MultiBinding Converter="{StaticResource PointConverter}">
<Binding ElementName="ParentControlName"
Path="Width"/>
<Binding ElementName="ParentControlName"
Path="Height"/>
</MultiBinding>
</SomeControl.SomePointProperty>
PointConverter
public class PointConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double xValue = (double)values[0];
double yValue = (double)values[1];
return new Point(xValue, yValue);
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
Если вы просто хотите связать значение X и иметь статическое значение Y, вы можете сделать это как
<SomeControl SomePointProperty="{Binding Path=Width,
ElementName=ParentControlName,
Converter={StaticResource PointXConverter},
ConverterParameter=20}"/>
PointXConverter
public class PointXConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double progressBarValue = (double)value;
double yValue = System.Convert.ToDouble(parameter);
return new Point(progressBarValue, yValue);
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}