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
524
Muliple styles to same columns..?
posted

Hello,

1)In xamDataGrid for some columns I have to allign cell value at center. And also for same columns I have to provide cell borders. But the style prepared below,when I assign to columns, the content get center alligned. But also cell borders moves with value and comes in center of column.

myStyle.Setters.Add(New System.Windows.Setter(CellValuePresenter.BorderThicknessProperty, New Windows.Thickness(0.099, 0, 0.05, 0.099)))

myStyle.Setters.Add(New System.Windows.Setter(CellValuePresenter.BorderBrushProperty, System.Windows.Media.Brushes.Black))

myStyle.Setters.Add(New System.Windows.Setter(CellValuePresenter.HorizontalAlignmentProperty, System.Windows.HorizontalAlignment.Center))

    xamGridBuybackByr.FieldLayouts(0).Fields(0).Settings.CellValuePresenterStyle = myStyle
    xamGridBuybackByr.FieldLayouts(0).Fields(1).Settings.CellValuePresenterStyle = myStyle

 I am not using xaml code.

2)Can we assign muliple styles to same column..?

Thanking You in advance.

Parents
No Data
Reply
  • 69686
    posted

    Hello,

    WPF supports only one local style so you cannot apply two different styles for  the same elements.
    You can use triggers to apply setters conditionally. 

Children