我正在使用WPFtoolkit DataGrid,我必须将文本换行DataGridTextColumn或者我必须ToolTip在文本列中添加一个.我在网上搜索过,但我找不到合适的解决方案.期待您的宝贵建议......
我有一个DataGrid在SelectedItem绑定到一个VM Selected属性.我有一个搜索控制,将做一个查找和SelectedItem的DataGrid变化(和滚动到视图).WPF 4.0和DataGrid SelectionUnit="FullRow".
我的问题在于焦点.的DataGrid(/经由附加属性结合)接收焦点但不能使用Up,Down,Page Up,Page Down键改变行(SelectedItem).如果我再次选中,则显示第一行显示的第一个单元格,它会更改SelectedItem.
底线,我怎么可以给键盘焦点DataGridCell的SelectedItem时候DataGrid获得焦点?
有这么多DataGrid/ Focus问题,已经尝试了一些事情.谢谢你的帮助.
我Flyouts在我的metro风格应用程序中使用,该应用程序使用MahApps Metro软件包:
<Controls:MetroWindow.Flyouts>
<Controls:FlyoutsControl>
<Controls:Flyout Header="INSTELLINGEN" Position="Left" Width="600" Theme="Dark">
some content
</Controls:Flyout>
</Controls:FlyoutsControl>
</Controls:MetroWindow.Flyouts>
Run Code Online (Sandbox Code Playgroud)
这工作正常,但是现在我想要Flyout占用整个应用程序的宽度,即使用户调整它的大小.基本上我想,Width="*"但这不起作用.
我正在使用Rhino Mocks 3.5模拟一个服务方法调用,该调用需要2个参数,我想确保正确设置对象上的某个属性.
// Method being tested
void UpdateDelivery( Trade trade )
{
trade.Delivery = new DateTime( 2013, 7, 4 );
m_Service.UpdateTrade( trade, m_Token ); // mocking this
}
Run Code Online (Sandbox Code Playgroud)
这是我的一部分代码(有效)
service, trade, token declared / new'd up ... etc.
...
using ( m_Mocks.Record() )
{
Action<Trade, Token> onCalled = ( tradeParam, tokenParam ) =>
{
// Inspect / verify that Delivery prop is set correctly
// when UpdateTrade called
Assert.AreEqual( new DateTime( 2013, 7, 4 ), tradeParam.Delivery );
};
Expect.Call( …Run Code Online (Sandbox Code Playgroud) 我有一个WPF DataGrid EnableColumnVirtualization="True".用户控件显示但滚动或调整大小后,您将收到一个NullReferenceExceptionat DataGridCellsPanel.get_HasCorrectRealizedColumns().设置ColumnVirtualization="False"更正了问题.我已经尝试删除EnableRowVirtualization="True"...等认为这可能是由于属性的组合,但我能够用一个非常简单的DataGrid重现问题:
<DataGrid ItemsSource="{Binding Items}" AutoGenerateColumns="True" EnableColumnVirtualization="True"
Run Code Online (Sandbox Code Playgroud)
有没有其他人遇到这个?我正在运行Win7 64.谢谢大家!
at System.Windows.Controls.DataGridCellsPanel.get_HasCorrectRealizedColumns()
at System.Windows.Controls.Primitives.DataGridCellsPresenter.SyncProperties(Boolean forcePrepareCells)
at System.Windows.Controls.DataGridRow.SyncProperties(Boolean forcePrepareCells)
at System.Windows.Controls.DataGridRow.PrepareRow(Object item, DataGrid owningDataGrid)
at System.Windows.Controls.DataGrid.PrepareContainerForItemOverride(DependencyObject element, Object item)
at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)
at System.Windows.Controls.VirtualizingStackPanel.InsertContainer(Int32 childIndex, UIElement container, Boolean isRecycled)
at System.Windows.Controls.VirtualizingStackPanel.AddContainerFromGenerator(Int32 childIndex, UIElement child, Boolean newlyRealized, Boolean isBeforeViewport)
at System.Windows.Controls.VirtualizingStackPanel.MeasureChild(IItemContainerGenerator& generator, IContainItemStorage& itemStorageProvider, IContainItemStorage& parentItemStorageProvider, Object& parentItem, Boolean& hasUniformOrAverageContainerSizeBeenSet, Double& computedUniformOrAverageContainerSize, Boolean& computedAreContainersUniformlySized, IList& items, Object& item, IList& children, Int32& …Run Code Online (Sandbox Code Playgroud) 我想将渐变属性绑定到按钮。我正在使用下面的代码。我能够绑定样式。你能建议我应该如何绑定linergradientbrush属性吗?
<Window.Resources>
<ResourceDictionary>
<LinearGradientBrush x:Key="buttonStyleGradient" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#FFACC3F5" Offset="1" />
</LinearGradientBrush>
<Style x:Key="buttonStyle" TargetType="Button">
<Setter Property="FontFamily" Value="Vrinda"/>
<Setter Property="FontSize" Value="24"/>
<Setter Property="Padding" Value="8,4" />
<Setter Property="Margin" Value="0" />
</Style>
</ResourceDictionary>
</Window.Resources><Button Style="{StaticResource buttonStyle}" >
<Label>Home</Label>
</Button>
Run Code Online (Sandbox Code Playgroud) wpf ×5
c# ×2
wpf-4.0 ×2
wpfdatagrid ×2
datagrid ×1
focus ×1
mvvm ×1
resharper ×1
rhino-mocks ×1
tooltip ×1
unit-testing ×1