This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
The data grid shows the current selected row with a gray background. This does not work well visually when the grid uses different background colors for different rows (like the image). How can I change the way the current row is indicated from the current gray background, to a white border around the row? (see image) |
|
|
Hello Nestor To change the selection state, you can take the Alloy data-grid-row style and modify it however you like. As there is no property on the DataGrid to set the style, you can add the style to the Resources of the DataGrid (or window etc) and don't set the Key, just set the TargetType. Below is an example of how to do this which includes a modification to get you the white border selection. In the ControlTemplate is an element called "Border" which is used for the mouse-over and selected visuals. The very last control template trigger sets the borderthickness and borderbrush of that border. You can modify this code further if there are any other changes you want to make.
Jason Fauchelle |
|
|
Perfect! One more question: how can I disable the black border around the current cell inside the selected row? I suspect it might be in DataGridRowPanel, but I could not find that in the Theme files... |
|
|
Hello Nestor This is actually controlled in the DataGridCellContainer styles. You'll find the code you need for this from line 510 to 644 in Alloy.DataGrid.xaml. There is a bit more code you need to copy here because it is split into 3 parts: The ExpandableCellTemplate which includes the hierarchical toggle button, the DetailedDataGridCellTemplate which is the normal cell template, and the Style which starts off with a very light-weight cell template. The style includes triggers for mouse over and selected etc which switches to one of the more complex template. You will need to modify both ExpandableCellTemplate and DetailedDataGridCellTemplate. These both contain an element called "Border" which is used for the black highlight. This is activated using the Triggers that listen to the IsHighlighted property. You could either remove these triggers in the 2 templates, or adjust it to create a different highlighted effect. Jason Fauchelle |
|
|
I'll try it out. Thanks |
|
|
It works like a charm. Nothing like a well architected control! One final question: see attached images. |
|
|
Never mind... I solved it. Thanks. |
|