0
我有一些代码,使颜色拾取:WPF颜色拾取从WPF/XAML /工具结合属性错误
<xctk:ColorPicker Grid.Row ="10" Grid.ColumnSpan="2" Margin="5, 5, 5, 5" Height="30" DisplayColorAndName="True"
SelectedColor="{Binding SelectedItem.TransparentColor, ElementName=ItemsListBox, Converter={StaticResource BrushColorConverter}, Mode=TwoWay}"/>
这东西时绑定到的ElementName =窗口和路径=背景,但是当我的作品财产System.Windows.Media.Color米创建对象,它显示
Value produced by BindingExpression is not valid for target property.; Value='<null>' BindingExpression:Path=SelectedItem.TransparentColor; DataItem='ListBox' (Name='ItemsListBox'); target element is 'ColorPicker' (Name=''); target property is 'SelectedColor' (type 'Color')
物业TransparentColor是新对象(新System.Windows.Media.Color())... 我应该怎么做,使之加工?
其他的东西,如:
<TextBox Grid.Column="7" Text="{Binding SelectedItem.ForbiddenArea.Height, ElementName=ItemsListBox, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
作品...
只是为了检查:有一个System.Windows.Media.Color和一个System.Drawing.Color。 SelectedColor不是一个System.Drawing.Color? – Nzc
不,这是S.W.M.C ... –