[DX_WPF] BarEditItem, Background
<dxb:BarEditItem x:Name="brushColorItem"
Content="Brush Color"
EditValue="{Binding Path=BackGround, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
EditWidth="{Binding RelativeSource={RelativeSource Self}, Path=(dx:ThemeManager.TreeWalker), Converter={local:EditWidthConverter EditWidth=100}}">
<dxb:BarEditItem.EditSettings>
<dxe:PopupColorEditSettings />
</dxb:BarEditItem.EditSettings>
</dxb:BarEditItem>
private Color backGround = Colors.Red;
public Color BackGround
{
get { return backGround; }
set { SetProperty(ref backGround, value); }
}
# Property type을 Color가 아니라 String으로 할 경우 UI에 반영이 안되는 문제
The Color property is of the String data type, while PopupColorEdit works with the System.Windows.Media.Color data type. Change your MyColor's property type to Color or use a custom converter to convert String to Color and back.
https://supportcenter.devexpress.com/ticket/details/t640210/bind-a-color-to-popupcoloreditsettings
Bind a color to PopupColorEditSettings
You have yet to view any tickets. Your search criteria do not match any tickets. A server error occurred while processing your request. Please try again at a later time.
supportcenter.devexpress.com
background={Binding BackGround} 시에는 property type이 string으로 작동
Color로 바인딩하고자 할때는 아래같은 예시로 작성
<Button>
<Button.Background>
<SolidColorBrush Color="{Binding BackGround}" />
</Button.Background>
</Button>
OR
Brush로 바인딩
private Brush Color = Colors.Red;
public Brush Color
{
get { return backGround; }
set { SetProperty(ref backGround, value); }
}
#문제점(차이점)
Background="{Binding Path=DataContext.BackGroundColor, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay,
RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
이렇게 바인딩하면 UpdateSourceTrigger=PropertyChanged 기능이 잘 작동하는 반면
<dxdiag:DiagramContainer.Background>
<SolidColorBrush Color="{Binding Path=DataContext.BackGroundColor, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay,
RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"/>
</dxdiag:DiagramContainer.Background>
이렇게 하면 UpdateSourceTrigger=PropertyChanged 기능이 동작안함( 중간에 프로퍼티 값 변경 시 UI반영이 안됨)