MahApps.Metro icon indicating copy to clipboard operation
MahApps.Metro copied to clipboard

DataGridTemplateColumn head style errors

Open chengyuzhi opened this issue 13 years ago • 10 comments

<DataGrid Name="dataGrid1" Height="228" CanUserAddRows="False" AutoGenerateColumns="False" FrozenColumnCount="3" ItemsSource="{Binding}">
    <DataGrid.Columns>
        <DataGridTemplateColumn Width="30" CanUserReorder="False" CanUserResize="False" CanUserSort="False">
            <DataGridTemplateColumn.HeaderTemplate>
                <DataTemplate>
                    <CheckBox VerticalAlignment="Center" HorizontalAlignment="Center" x:Name="ckbSelectedAll"></CheckBox>
                 </DataTemplate>
                 </DataGridTemplateColumn.HeaderTemplate>
                     <DataGridTemplateColumn.CellTemplate>
                         <DataTemplate>
                             <CheckBox  VerticalAlignment="Center" HorizontalAlignment="Center" IsChecked="{Binding isChecked}"/>
                         </DataTemplate>
                     </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn Header="序号" Binding="{Binding 序号}" Width="50"/>
                <DataGridTextColumn Header="档案编号" Binding="{Binding 档案编号}" Width="100"/>
                <DataGridTextColumn Header="姓名" Binding="{Binding 姓名}" Width="80"/>
                <DataGridTextColumn Header="性别" Binding="{Binding 性别}" Width="50"/>
                <DataGridTextColumn Header="年龄" Binding="{Binding 年龄}" Width="50"/>
                <DataGridTextColumn Header="日期" Binding="{Binding 日期, StringFormat=yyyy-MM-dd HH:mm:ss}" Width="140"/>
                <DataGridTextColumn Header="费别" Binding="{Binding 费别}" Width="100"/>
                <DataGridTextColumn Header="初复诊" Binding="{Binding 初复诊}" Width="100"/>
            </DataGrid.Columns>
        </DataGrid>

chengyuzhi avatar Jul 11 '13 01:07 chengyuzhi

the checkbox can not display

chengyuzhi avatar Jul 11 '13 01:07 chengyuzhi

qq20130711100046

chengyuzhi avatar Jul 11 '13 02:07 chengyuzhi

What do you mean 'can not display'? Could you explain a little more, please?

AzureKitsune avatar Jul 11 '13 12:07 AzureKitsune

qq20130711211852

chengyuzhi avatar Jul 11 '13 13:07 chengyuzhi

There is a checkbox in the first column head:

<DataGridTemplateColumn Width="30" CanUserReorder="False" CanUserResize="False" CanUserSort="False">
  <DataGridTemplateColumn.HeaderTemplate>
    <DataTemplate>
      <CheckBox VerticalAlignment="Center" HorizontalAlignment="Center" x:Name="ckbSelectedAll">
    </DataTemplate>
  </DataGridTemplateColumn.HeaderTemplate>
  <DataGridTemplateColumn.CellTemplate>
    <DataTemplate>
      <CheckBox VerticalAlignment="Center" HorizontalAlignment="Center" IsChecked="{Binding isChecked}"/>
    </DataTemplate>
  </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

chengyuzhi avatar Jul 11 '13 13:07 chengyuzhi

Would this work without MahApps.Metro in plain old WPF?

EDIT: Nevermind, yes it does work in normal WPF: m2

However, the checkbox is there in the metro app. The checkbox does not exist in the visual tree with MA.M. m1

I'll look into this.

AzureKitsune avatar Jul 11 '13 14:07 AzureKitsune

yes,that is the bug,How to solve te problem?

chengyuzhi avatar Jul 12 '13 02:07 chengyuzhi

I have no idea at the moment.

AzureKitsune avatar Jul 12 '13 02:07 AzureKitsune

I think this should be fixed with https://github.com/MahApps/MahApps.Metro/pull/561

flagbug avatar Jul 12 '13 12:07 flagbug

Please test with version 0.11.0.38-ALPHA

shiftkey avatar Jul 13 '13 00:07 shiftkey