110,499
社区成员
发帖
与我相关
我的任务
分享
<DataGrid Grid.Row="2" Name="dataGrid_CalTask" Style="{StaticResource dataGridCalTask}">
<DataGrid.Columns>
<DataGridTextColumn Header="name" Width="*" Binding="{Binding name}"/>
<DataGridTextColumn Header="value" Width="2*" Binding="{Binding value}"/>
</DataGrid.Columns>
</DataGrid>
<dxdo:LayoutPanel Caption="计算过程监控" Name="lp_calculate">
<Grid>
<Frame Name="CalculateFrame" Source="CalInfoPage.xaml" NavigationUIVisibility="Hidden"/>
</Grid>
</dxdo:LayoutPanel>
DataGrid在CalInfoPage.xaml里,Page_Loaded事件里进行数据绑定[/quote]
我靠我知道了,我把数据绑定放在Page的构造函数里就不会出现这个问题了,放在Page_Loaded里就会这样。
这是为啥。。。难道这种操作不是应该放在Load里才对嘛??[/quote]
j解释不了。。。。。。
<dxdo:LayoutPanel Caption="计算过程监控" Name="lp_calculate">
<Grid>
<Frame Name="CalculateFrame" Source="CalInfoPage.xaml" NavigationUIVisibility="Hidden"/>
</Grid>
</dxdo:LayoutPanel>
DataGrid在CalInfoPage.xaml里,Page_Loaded事件里进行数据绑定[/quote]
我靠我知道了,我把数据绑定放在Page的构造函数里就不会出现这个问题了,放在Page_Loaded里就会这样。
这是为啥。。。难道这种操作不是应该放在Load里才对嘛??
<dxdo:LayoutPanel Caption="计算过程监控" Name="lp_calculate">
<Grid>
<Frame Name="CalculateFrame" Source="CalInfoPage.xaml" NavigationUIVisibility="Hidden"/>
</Grid>
</dxdo:LayoutPanel>
DataGrid在CalInfoPage.xaml里,Page_Loaded事件里进行数据绑定
DataTable dt = new DataTable();
dt.Columns.Add("name", typeof(string));
dt.Columns.Add("value", typeof(string));
for (int i = 0; i < filelist.Length; i++)
{
string line = filelist[i];
string name = line.Split('\t')[0];
string value = line.Split('\t')[1];
dt.Rows.Add(name, value);
}
dataGrid_CalTask.ItemsSource = dt.DefaultView;
你dev的版本是多少啊?[/quote]
13.1 的。 测试的 拖动自如。 应该是 某一个样式的问题吧,这跟你的数据源有么有关系。
DataTable dt = new DataTable();
dt.Columns.Add("name", typeof(string));
dt.Columns.Add("value", typeof(string));
for (int i = 0; i < filelist.Length; i++)
{
string line = filelist[i];
string name = line.Split('\t')[0];
string value = line.Split('\t')[1];
dt.Rows.Add(name, value);
}
dataGrid_CalTask.ItemsSource = dt.DefaultView;
你dev的版本是多少啊?
<!--dataGrid的基本样式-->
<Style x:Key="dataGridBaseStyle" TargetType="{x:Type DataGrid}">
<Setter Property="AutoGenerateColumns" Value="False"></Setter>
<Setter Property="IsReadOnly" Value="True"></Setter>
<Setter Property="CanUserSortColumns" Value="False"></Setter>
<Setter Property="CanUserReorderColumns" Value="False"></Setter>
</Style>
<!--列表的dataGrid中所有的样式-->
<!--datagrid单元格内容居中-->
<Style x:Key="gridCellCenter" TargetType="DataGridCell">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridCell">
<TextBlock TextAlignment="Center" VerticalAlignment="Center" >
<ContentPresenter />
</TextBlock>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--datagrid行列头的样式-->
<Style x:Key="gridRowHeader" TargetType="DataGridRowHeader">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Height" Value="26"/>
</Style>
<!--dataGrid的样式-->
<Style x:Key="dataGridStyle" TargetType="{x:Type DataGrid}" BasedOn="{StaticResource dataGridBaseStyle}">
<Setter Property="CellStyle" Value="{StaticResource gridCellCenter}"></Setter>
<Setter Property="ColumnHeaderStyle" Value="{StaticResource gridColumnHeader}"></Setter>
<Setter Property="RowHeaderStyle" Value="{StaticResource gridRowHeader}"></Setter>
<Setter Property="FontSize" Value="15"/>
<Setter Property="Margin" Value="20"></Setter>
<Setter Property="Background" Value="{x:Null}"></Setter>
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="BorderBrush" Value="Black"></Setter>
<Setter Property="AlternatingRowBackground" Value="#8C81C5CE"></Setter>
<Setter Property="RowBackground" Value="#8C2D77B7"></Setter>
</Style>
<!--任务表的dataGrid的样式-->
<Style x:Key="dataGridCalTask" TargetType="{x:Type DataGrid}" BasedOn="{StaticResource dataGridStyle}">
<Setter Property="FontSize" Value="20"/>
<Setter Property="BorderBrush" Value="{x:Null}"></Setter>
<Setter Property="ColumnHeaderStyle">
<Setter.Value>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Visibility" Value="Collapsed" />
<Setter Property="Height" Value="0"/>
</Style>
</Setter.Value>
</Setter>
</Style>
<dxdo:DockLayoutManager Grid.Row="1" x:Name="dockLayoutManager" Background="{x:Null}" FloatingMode="Desktop" DockItemClosed="dockLayoutManager_DockItemClosed" EnableWin32Compatibility="True">
<dxdo:LayoutGroup Orientation="Horizontal">
<dxdo:LayoutGroup x:Name="MenuGroup" HorizontalAlignment="Left" ItemWidth="140" VerticalAlignment="Center">
<dxdo:LayoutPanel Caption="首页" ShowCloseButton="False" ShowControlBox="False" ShowMaximizeButton="False" ShowRestoreButton="False" Name="lp_menu" Visibility="Collapsed">
<Grid Width="140" VerticalAlignment="Center" Background="{StaticResource ParentBG}">
</Grid>
</dxdo:LayoutPanel>
</dxdo:LayoutGroup>
<dxdo:DocumentGroup x:Name="documentContainer" DestroyOnClosingChildren="False" ShowDropDownButton="False" FontSize="15" SelectedItemChanged="documentContainer_SelectedItemChanged">
<dxdo:DocumentGroup.Background>
<ImageBrush/>
</dxdo:DocumentGroup.Background>
<dxdo:LayoutPanel Caption="首页" Name="lp_index" ShowCloseButton="False" AllowClose="False" AllowFloat="False" AllowDrag="False">
<Grid>
</Grid>
</dxdo:LayoutPanel>
<dxdo:LayoutPanel Caption="计算过程监控" Name="lp_calculate" Visibility="Collapsed">
<Grid>
<Frame Name="CalculateFrame" Source="CalInfoPage.xaml" NavigationUIVisibility="Hidden"/>
</Grid>
</dxdo:LayoutPanel>
</dxdo:DocumentGroup>
</dxdo:LayoutGroup>
</dxdo:DockLayoutManager>
这个datagrid是在CalInfoPage.xaml这个page里