Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
905
Wrapping HorizontalContentAlignment on XamTextEditor
posted

Hello,

I want to write an UserControl which is included XamTextEditor and Label. I put XamTextEditor in order to my Usercontrol and I try to wrap it's HorizontalContentAlignment property. For doing this I write a dependency property into my BTextEditorLabeled.xaml.cs file and bind it in BTextEditorLabled.xaml file to XamtextEditor. When I set the BTextEditorLabeled usercontrols HorizontalContentAlignment to HorizontalAlignment.Right, it raises  invalid cast exception on runtime. I attached sample project file. İs it a bug ?

WpfApplication2.zip
  • 17559
    posted

    Hello okkesemin,

     

    It has been a while since you have made your post, in case you still need of support I will be glad to assist you on the matter. I have been looking into your sample and I believe that the exception is rising because the two properties HorizontalContentAlignment are from different type. I can suggest you use Converter for the value you provide to XamTextEditor and convert the HorizontalAlignment.Right value to TextAlignment. Right value using class that inherits IValueConverter interface.

     

    If you still need any assistance on this, please do not hesitate to ask.