發表文章

目前顯示的是 1月 15, 2019的文章

How to properly bind multiple ViewModels when using DataTemplateSelector [duplicate]

圖片
0 This question already has an answer here: How to use DataTemplateSelector with ContentControl to display different controls based on the view-model? 2 answers I'm trying to write a simple dialog that would accept a value in a SpinEdit or a text in a TextEdit. I'm using multiple VMs and I made a selector that should view a proper control based on the logic in the c++/cli file. XAML: xmlns:local="clr-namespace:asd" Title="Binding Path=Title, Mode=OneTime" <dx:DXWindow.Resources> <DataTemplate x:Key="TInputValueVM" DataType="x:Type local:TInputValueVM"> <dxe:SpinEdit Height="23" Width="200" Text="Binding Value, Mode=TwoWay" Mask="Binding Mask, Mode=OneWay" MaxLength="Binding Path=InputLength" /> </DataTemplate> <DataTemplate x:Key="TInputTextVM" DataType="x:Type local:TInputTextVM"> <dxe:TextEdit Height=&q