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.
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.
Hello...
Thanks for quick reply.
A) I have to achieve both 1)display cell borders. 2)Bring the cell contents at center. at a time.
Is there any other way..?
B) Without using style can we set cell content(Alignment) of particular column to middle.
Thanking You...
Also, in above (top most post) I am using same style, to achive both the tasks.But Only content get aligned at center.But gridlines get moved.