问题描述
大家好,
i我在WPF应用程序中使用MVVM架构,现在它的工作正常,因为当我在Costcenter单元格中进行一些更改onlostfocus时,bordercolor或背景颜色会发生变化,就像明智一样当数据在gris中填充时,颜色应该被更改,而它的绑定本身应该突出显示。我怎么能这样做呢?我的工作代码在下面。我对此非常感兴趣。
< Style x:Key =costCenterStyleTargetType ={x:Type igDataPresenter:CellValuePresenter}BasedOn ={StaticResource isEditableStyle}>
< Style.Triggers>
< DataTrigger Binding ={绑定路径= DataItem.IsChanged [CostCenter]}Value =已更改>
< Setter Property =BackgroundValue =LightSalmon/>
< / DataTrigger>
< DataTrigger Binding ={Binding Path = DataItem.IsChanged [CostCenter]}Value =ChangedButNotCommited>
< Setter Property =BorderThickness值=2/>
< Setter Property =BorderBrushValue =LightSalmon/>
< / DataTrigger>
< /Style.Triggers>
< / Style>
< igDataPresenter:Field Name =CostCenterLabel =Cost Center>
< igDataPresenter:Field.Settings>
< igDataPresenter:FieldSettings
CellValuePresenterStyle ={StaticResource costCenterStyle}/>
< / igDataPresenter:Field.Settings>
< / igDataPresenter:Field>
谢谢
Kannabiran B
Hi all,
i am using MVVM architecture in WPF application, right now its working fine as when i made some changes in the Costcenter cell onlostfocus the bordercolor or background color will get change, like wise the color should get changed while its binding itself when the data is populated in the gris itshould be highlighted. How can i do that any idea? My working code is below.since im very new to this getting struck.
<Style x:Key="costCenterStyle" TargetType="{x:Type igDataPresenter:CellValuePresenter}" BasedOn="{StaticResource isEditableStyle}" >
<Style.Triggers>
<DataTrigger Binding="{Binding Path=DataItem.IsChanged[CostCenter]}" Value="Changed">
<Setter Property="Background" Value="LightSalmon"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=DataItem.IsChanged[CostCenter]}" Value="ChangedButNotCommited">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="LightSalmon"/>
</DataTrigger>
</Style.Triggers>
</Style>
<igDataPresenter:Field Name="CostCenter" Label="Cost Center">
<igDataPresenter:Field.Settings>
<igDataPresenter:FieldSettings
CellValuePresenterStyle="{StaticResource costCenterStyle}"/>
</igDataPresenter:Field.Settings>
</igDataPresenter:Field>
Thanks
Kannabiran B
这篇关于突出显示单元格边框/背景颜色WPF,MVVM XamDataGrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!