1

Topic: DataGridColumn does not change the size after change of the size of a window

At me is DataGrid. I fill columns and that columns were on the size , I use binding in property DataGrid of its parameter ActualWidth. Without it it does not work.
If not to change the size of the window of the browser all works as it is necessary, but after  the width does not change any more as thanking  DataGrid has fixed size.
What to make, that all worked correctly both at loading and at .
My code:

<Grid Name = "gridForDataGridNames">
<Grid. ColumnDefinitions>
<ColumnDefinition Width = "*"> </ColumnDefinition>
</Grid. ColumnDefinitions>
<Grid. RowDefinitions>
<RowDefinition MinHeight = "240" Height = "*"> </RowDefinition>
</Grid. RowDefinitions>
<sdk:DataGrid AutoGenerateColumns = "False" x:Name = "dataGridForNames"
Width = "{Binding ElementName=gridForDataGridNames, Path=ActualWidth}"
Grid. Row = "0" Grid. Column = "0" HeadersVisibility = "None"
ItemsSource = "{Binding Path=Names}">
<sdk:DataGrid. Columns>
<sdk:DataGridTemplateColumn Header = "Image" Width = "*">
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content = "{Binding LastName}"> </Button>
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>
</sdk:DataGrid. Columns>
</sdk:DataGrid>
</Grid>

The moderator: we Learn to use tags of design of the code - FAQ

2

Re: DataGridColumn does not change the size after change of the size of a window

mbrdrg wrote:

Width = "{Binding ElementName=gridForDataGridNames, Path=ActualWidth}

Here it what for? DataGrid and so it will be expanded for the width Grid

3

Re: DataGridColumn does not change the size after change of the size of a window

Shocker. Pro wrote:

it is passed...
Here it what for? DataGrid and so it will be expanded for the width Grid

I know. DataGrid it will be expanded, but not a column. This decision I  earlier.

4

Re: DataGridColumn does not change the size after change of the size of a window

In a column costs Width = "*" - it too will be expanded for the width DataGrid. So, while it is not clear, in what a problem.
However, not clearly that such sdk: can you use not box , but forgot about it to tell to us?

5

Re: DataGridColumn does not change the size after change of the size of a window

Try to disconnect horizontal scrolling at DataGrid' forcedly.
Then try to make all columns fixed are long or a car, and last *.

6

Re: DataGridColumn does not change the size after change of the size of a window

Shocker. Pro wrote:

in a column costs Width = "*" - it too will be expanded for the width DataGrid. So, while it is not clear, in what a problem.
However, not clearly that such sdk: can you use not box , but forgot about it to tell to us?

In sdk it is registered following namespace - "xmlns:sdk ="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
Upon if I do not make given binding that in a column there is Width = "*" it it will be expanded completely on all page. As I understand, it happens that Width it is not set also is expanded for all width.

7

Re: DataGridColumn does not change the size after change of the size of a window

mbrdrg wrote:

Upon if I do not make given binding that in a column there is Width = "*" it it will be expanded completely on all page. As I understand, it happens that Width it is not set also is expanded for all width.

Is not present. The column (if it one) will correspond to width DataGrid. That, in turn, will correspond to width Grid which, in turn, will correspond to width of page.
And what behavior is required to you - a riddle, but go not that way.

8

Re: DataGridColumn does not change the size after change of the size of a window

Roman Mejtes wrote:

try to disconnect horizontal scrolling at DataGrid' forcedly.
Then try to make all columns fixed are long or a car, and last *.

Tried your idea. The column extends completely till the end of page.
Here the same decision is described.

9

Re: DataGridColumn does not change the size after change of the size of a window

mbrdrg wrote:

Tried your idea.

I do not know, I yet did not offer any ideas. Because

mbrdrg wrote:

what to make, that all worked correctly

is not uncovered. You want to receive not clearly, what result, you stated only the attempt to make SOMETHING

10

Re: DataGridColumn does not change the size after change of the size of a window

Shocker. Pro wrote:

it is passed...
I do not know, I yet did not offer any ideas. Because it is passed...
It is not uncovered. You want to receive not clearly, what result, you stated only the attempt to make SOMETHING

Now I will state all explicitly.
I have an application with DataGrid th.
In it there is one column, but it is not expanded for all width DataGrid.
I tried to create in the pure project DataGrid, without specifying its width, but to specify in column Width = "*" and all works. At change of the sizes of a window, it also works.
In my application at loading of page DataGrid it is expanded on width, but the data inside (one column) is not present. What can be a consequence of such behavior? In the pure project all is good, and here is not present. Probably because of attributes of parents.

11

Re: DataGridColumn does not change the size after change of the size of a window

Well so you also answered. The code resulted by you the worker, and the code of "your application" we did not see.
Be debugged. If the working variant, is the unoperated. Result  one of them in another - find, in what a problem.

12

Re: DataGridColumn does not change the size after change of the size of a window

And for what it is necessary? That selection was FullRow? It can be implemented at template level
Or for what the last empty column? To me its sense is not so clear.
Without crutches it will not work. Columns should be exactly so much, how many it is displayed the data, remaining areas can be defined in a template.