SketchFlow原型:带有网格控件的页面会抛出错误,而带有草图流样式的页面则不会。 [英] SketchFlow prototype: Pages with grid control throws error whereas thoses with sketchflow styles do not.
问题描述
我正在尝试使用Sketchflow构建原型。我用了一个网格。完成数据绑定步骤。当我尝试运行项目时,除了我使用网格控件的页面之外,所有其他页面都使用草图流样式正确显示。
下面是Xaml文件和我得到的错误。我是否需要使用除Sketchflow样式之外的其他控件进行任何其他设置。
< UserControl
xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation "
xmlns:x =" http://schemas.microsoft.com/winfx/2006/xaml "
xmlns:d =" http://schemas.microsoft.com/expression/blend/2008 "
xmlns:mc =" http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable ="d"
xmlns:data ="clr-namespace:System.Windows.Controls; assembly = System.Windows.Controls.Data"
xmlns:i ="clr-namespace:System.Windows.Interactivity; assembly = System.Windows.Interactivity"xmlns:pb ="clr-namespace:Microsoft.Expression.Prototyping.Beha vior; assembly = Microsoft.Expression.Prototyping.Interactivity"
x:Class ="DirtyHands1Screens.Screen_1_3"
Width ="640"Height ="480">
  ;< UserControl.Resources>
< ResourceDictionary>
< ResourceDictionary.MergedDictionaries>
< ResourceDictionary Source ="ProjectDataSources.xaml"/>
< /ResourceDictionary.MergedDictionaries>
< / ResourceDictionary>
< / UserControl .Resources>
I am trying to build a prototype using Sketchflow. I have used a grid. Completed the data binding step. When I try to run the project all other pages with sketchflow styles showup properly except the pages where I have used a grid control.
Below is the Xaml file and the error I am getting. Do I need to do any additional setting for using controls other than the Sketchflow styles.
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:pb="clr-namespace:Microsoft.Expression.Prototyping.Behavior;assembly=Microsoft.Expression.Prototyping.Interactivity"
x:Class="DirtyHands1Screens.Screen_1_3"
Width="640" Height="480">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ProjectDataSources.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
< Grid x:Name ="LayoutRoot"Background ="White"DataContext ="{Binding Source = {StaticResource JobReview}}">
< TextBlock Height ="14"HorizontalAlignment ="Left"Margin ="117,66,0,0"Style ="{StaticResource SubtitleLeft-Sketch}"VerticalAlignment ="Top"Width ="148"FontSize = "13.333"Text ="职务"TextWrapping ="Wrap"/>
< data:DataGrid Margin ="140,95,41,0"ItemsSource ="{Binding Collectio n,Mode = OneWay}"Height ="134"VerticalAlignment ="Top">
< data:DataGrid.Columns>
< ; data:DataGridCheckBoxColumn />
< / data:DataGrid.Columns>
< / data:DataGrid>
< ; ComboBox Height ="17"HorizontalAlignment ="Right"Margin ="0,61,42,0"Style ="{StaticResource ComboBox-Sketch}"VerticalAlignment ="Top"Width ="105"FontSize ="10.667">
< ComboBoxItem Height ="100"Style ="{StaticResource ComboBoxItem-Sketch}"Width ="100"Content ="All& #xa; Open& #xa; Closed"FontSize = "10.667"/>
< / ComboBox>
< Button HorizontalAlignment ="Left"Margin ="142,237,0,220"Style ="{StaticResource Button-Sketch }"Width ="93"Content ="Show Detail"FontSize ="10.667"/>
< ScrollViewer Height ="32"Margin ="143,0,0,167"Style ="{ StaticResource ScrollViewer-Sketch-List}"VerticalAlignment ="Bottom"HorizontalAlig nment ="Left"Width ="167">
< ListBoxItem FontSize ="8"Margin ="0"Style ="{StaticResource ListBoxItem-Sketch}"Content ="Completed。 doc& #xd;& #xa; Completed.jpg& #xd;& #xa; Completed.wav"/>
< / ScrollViewer>
< Button FontSize ="8"Height ="13"Margin ="276,0,0,151"Style ="{StaticResource Button-Sketch}"VerticalAlignment ="Bottom"Content ="Download"HorizontalAlignment ="Left"Width =" 33"/>
< Button Margin ="247,237,300,220"Style ="{StaticResource Button-Sketch}"Content ="Award points"FontSize ="10.667">
< i:Interaction.Triggers>
< i:EventTrigger EventName ="Click">
< pb:NavigateToScreenAction TargetScreen ="DirtyHands1Screens.Screen_1_5"/>
< / i:EventTrigger>
< / i:Interaction .Triggers>
< / Button>
< / Grid>
< / UserControl>
错误:Silverlight应用程序中未处理的错误
代码:4004 &NBSP;&NBSP;
分类:ManagedRuntimeError
消息:System.ArgumentNullException:[ArgumentNull_Generic]
参数:
调试资源字符串不可用。通常,密钥和参数提供了足够的信息来诊断问题。请参阅 http://go.microsoft.com /fwlink/?linkid=106663&Version=3.0.40818.0&File=mscorlib.dll&Key=ArgumentNull_Generic
参数名称:binding
在System.Windows.Data.BindingOperations.SetBinding(DependencyObject目标,DependencyProperty dp,BindingBase绑定)
在System.Windows.FrameworkElement.SetBinding(DependencyProperty dp,Binding binding)
在System.Windows.Controls.DataGridCheckBoxColumn.ConfigureCheckBox(CheckBox checkBox)
在System.Windows.Controls.DataGridCheckBoxColumn.GenerateElement(DataGridCell cell,Object dataItem)
在System.Windows.Controls.DataGridColumn.GenerateElementInternal(DataGridCell cell,Object dataItem)
在System.Windows.Controls.DataGrid.PopulateCellContent(Boolean isCellEdited,DataGridColumn dataGridColumn,DataGridRow dataGridRow,DataGridCell dataGridCell)
在System.Windows.Controls.DataGrid.AddNewCellPrivate(DataGridRow行,DataGridColumn列)
在System.Windows.Controls.DataGrid.CompleteCellsCollection(DataGridRow dataGridRow)
在System.Windows.Controls.DataGrid.GenerateRow(Int32 rowIndex,Int32 slot,Object dataContext)
在System.Windows.Controls.DataGrid.GenerateRow(Int32 rowIndex,Int32 slot)
在System.Windows.Controls.DataGrid.InsertDisplayedElement(Int32 slot,Boolean updateSlotInformation)
在System.Windows.Controls.DataGrid.GetExactSlotElementHeight(Int32 slot)
在System.Windows.Controls.DataGrid.UpdateDisplayedRows(Int32 newFirstDisplayedSlot,Double displayHeight)
在System.Windows.Controls.DataGrid.ComputeScrollBarsLayout()
在System.Windows.Controls.DataGrid.MeasureOverride(Size availableSize)
在System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget,Single inWidth,Single inHeight,Single& outWidth,Single& outHeight)
<Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource JobReview}}">
<TextBlock Height="14" HorizontalAlignment="Left" Margin="117,66,0,0" Style="{StaticResource SubtitleLeft-Sketch}" VerticalAlignment="Top" Width="148" FontSize="13.333" Text="Job Title" TextWrapping="Wrap"/>
<data:DataGrid Margin="140,95,41,0" ItemsSource="{Binding Collection, Mode=OneWay}" Height="134" VerticalAlignment="Top">
<data:DataGrid.Columns>
<data:DataGridCheckBoxColumn/>
</data:DataGrid.Columns>
</data:DataGrid>
<ComboBox Height="17" HorizontalAlignment="Right" Margin="0,61,42,0" Style="{StaticResource ComboBox-Sketch}" VerticalAlignment="Top" Width="105" FontSize="10.667">
<ComboBoxItem Height="100" Style="{StaticResource ComboBoxItem-Sketch}" Width="100" Content="All
Open
Closed" FontSize="10.667"/>
</ComboBox>
<Button HorizontalAlignment="Left" Margin="142,237,0,220" Style="{StaticResource Button-Sketch}" Width="93" Content="Show Detail" FontSize="10.667"/>
<ScrollViewer Height="32" Margin="143,0,0,167" Style="{StaticResource ScrollViewer-Sketch-List}" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="167">
<ListBoxItem FontSize="8" Margin="0" Style="{StaticResource ListBoxItem-Sketch}" Content="Completed.doc
Completed.jpg
Completed.wav"/>
</ScrollViewer>
<Button FontSize="8" Height="13" Margin="276,0,0,151" Style="{StaticResource Button-Sketch}" VerticalAlignment="Bottom" Content="Download" HorizontalAlignment="Left" Width="33"/>
<Button Margin="247,237,300,220" Style="{StaticResource Button-Sketch}" Content="Award points" FontSize="10.667">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<pb:NavigateToScreenAction TargetScreen="DirtyHands1Screens.Screen_1_5"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</Grid>
</UserControl>
*******
Error: Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.ArgumentNullException: [ArgumentNull_Generic]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=3.0.40818.0&File=mscorlib.dll&Key=ArgumentNull_Generic
Parameter name: binding
at System.Windows.Data.BindingOperations.SetBinding(DependencyObject target, DependencyProperty dp, BindingBase binding)
at System.Windows.FrameworkElement.SetBinding(DependencyProperty dp, Binding binding)
at System.Windows.Controls.DataGridCheckBoxColumn.ConfigureCheckBox(CheckBox checkBox)
at System.Windows.Controls.DataGridCheckBoxColumn.GenerateElement(DataGridCell cell, Object dataItem)
at System.Windows.Controls.DataGridColumn.GenerateElementInternal(DataGridCell cell, Object dataItem)
at System.Windows.Controls.DataGrid.PopulateCellContent(Boolean isCellEdited, DataGridColumn dataGridColumn, DataGridRow dataGridRow, DataGridCell dataGridCell)
at System.Windows.Controls.DataGrid.AddNewCellPrivate(DataGridRow row, DataGridColumn column)
at System.Windows.Controls.DataGrid.CompleteCellsCollection(DataGridRow dataGridRow)
at System.Windows.Controls.DataGrid.GenerateRow(Int32 rowIndex, Int32 slot, Object dataContext)
at System.Windows.Controls.DataGrid.GenerateRow(Int32 rowIndex, Int32 slot)
at System.Windows.Controls.DataGrid.InsertDisplayedElement(Int32 slot, Boolean updateSlotInformation)
at System.Windows.Controls.DataGrid.GetExactSlotElementHeight(Int32 slot)
at System.Windows.Controls.DataGrid.UpdateDisplayedRows(Int32 newFirstDisplayedSlot, Double displayHeight)
at System.Windows.Controls.DataGrid.ComputeScrollBarsLayout()
at System.Windows.Controls.DataGrid.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
推荐答案
这实际上不是混合问题。问题是,当设置了DataContext并且未绑定列时,DataGrid复选框列会引发异常。
而不是
< data:DataGridCheckBoxColumn />
以下内容应该修复它:
< data:DataGridTextColumn Binding ="{Binding Property1}" Header ="Property1"/>
>谢谢,
Unni
This is actually not a Blend issue. The problem is that the DataGrid checkbox column thows an exception when a DataContext is set and the column is not bound.
Instead of
<data:DataGridCheckBoxColumn/>
Something like the following should fix it:
<data:DataGridTextColumn Binding="{Binding Property1}" Header="Property1"/>
Thanks,
Unni
这篇关于SketchFlow原型:带有网格控件的页面会抛出错误,而带有草图流样式的页面则不会。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!