¿Puedo usar enlaces con extensiones de marcado SL5 RC?
-
30-10-2019 - |
Pregunta
¿Puedo usar enlaces con extensiones de marcado SL5 RC?
Aquí está mi xaml:
...
<TextBlock>
<TextBlock.Text>
<local:LengtherMarkupExtension Test="{Binding ElementName='MyTextBox', Path='Text'}" />
</TextBlock.Text>
</TextBlock>
...
Y el yo:
public class LengtherMarkupExtension: FrameworkElement,
IMarkupExtension<string>
{
public LengtherMarkupExtension()
{
//this.DataContext = this;
}
public static readonly DependencyProperty TestProperty =
DependencyProperty.Register("Test",
typeof(string),
typeof(LengtherMarkupExtension),
new PropertyMetadata("DefaultValue",
(o, e) =>
{
System.Diagnostics.Debugger.Break();
}));
public string Test
{
get { return (string)this.GetValue(LengtherMarkupExtension.TestProperty); }
set { this.SetValue(LengtherMarkupExtension.TestProperty, value); }
}
public string ProvideValue(IServiceProvider serviceProvider)
{
return this.Test.Length.ToString();
}
}
La propiedad de prueba de mi yo no se establece a través de la vinculación, pase lo que pase, ¿estoy haciendo algo mal?
No hay solución correcta
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow