小编Ema*_*iel的帖子

使用MVVM从WPF ListView项目中触发双击事件

在使用MVVM的WPF应用程序中,我有一个带有listview项的usercontrol.在运行时,它将使用数据绑定来用列表视图填充对象集合.

将双击事件附加到列表视图中的项目的正确方法是什么,以便在列表视图中的项目被双击时,视图模型中的相应事件被触发并且引用了单击的项目?

如何以干净的MVVM方式完成,即视图中没有代码?

wpf mvvm

100
推荐指数
5
解决办法
8万
查看次数

更改WPF标题栏背景颜色

我有一个WPF Windows应用程序.我需要更改标题栏的背景颜色.我怎样才能做到这一点?

wpf titlebar

38
推荐指数
4
解决办法
8万
查看次数

如何将WPF字符串格式设置为百分比乘以100?

我有一个文本框绑定到对象中的属性.我已将字符串格式设置为p0.

但是,当我输入12时,例如它被格式化为1200%(乘以100并添加%符号)

如何设置stringformat以便例如20格式化为20%?

我目前的控制是:

<TextBox Text="{Binding Path=MyCase, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, StringFormat=p0}"/>
Run Code Online (Sandbox Code Playgroud)

如何改变字符串格式,使7的格式为7%而不是700%?

data-binding wpf

37
推荐指数
2
解决办法
4万
查看次数

在使用MVVM的WPF应用程序中使用SSRS报表查看器的最佳方法是什么

我有一个使用MVVM的WPF应用程序.我有一些用户控件在Windows窗体主机控件中托管的ReportViewer控件中显示一些SSRS报告.

用户控件具有简单的组合框,其中用户选择标准,因此将加载满足该标准的报告,从数据库获取其数据,然后向用户显示报告.

使用MVVM在WPF中实现此类场景的最佳方法是什么?任何样品都非常感谢

wpf mvvm reporting-services

8
推荐指数
1
解决办法
9773
查看次数

使用LINQ从数据库中检索树结构

我有一个存储在数据库中的组织结构图树结构.就是这样的

ID (int);
Name (String);
ParentID (int)
Run Code Online (Sandbox Code Playgroud)

在C#中,它由类似的表示

class Employee
{
int ID, 
string Name, 
IList < Employee> Subs
} 
Run Code Online (Sandbox Code Playgroud)

我想知道如何从数据库中检索这些值以使用LINQ填充C#对象(我正在使用实体框架)的最佳方法

必须有比调用更高级别然后重复调用以获得潜艇等更好的东西.

怎么做得最好?

c# linq-to-entities entity-framework

7
推荐指数
1
解决办法
4253
查看次数

如何在RDLC中折叠一行而不是隐藏它?

我有一个显示表格的RDLC报告.在某些条件适用的情况下,此表中的某一行不应出现.如果这些条件适用,我可以使用表达式将Hidden属性设置为false.

问题是,虽然隐藏了,但行仍然在表中发生,即它没有崩溃.

如何折叠它而不是简单地隐藏它?

我正在使用RDLC与报表查看器2010 SP1

rdlc report-viewer2010

6
推荐指数
2
解决办法
7138
查看次数

DotNetNuke可扩展性

我们即将从一个内容丰富的网站开始,我们正在考虑Dotnetnuke.与联合国网站(http://www.un.org/en/index.shtml)相比,该网站的大小将是多种语言的.问题是:DotNetNuke是否支持如此大的内容大小?内容的大小或层次结构的深度是否有限制?

dotnetnuke scalability

5
推荐指数
1
解决办法
646
查看次数

如何从.NET设置Outlook联系人“便笺”属性

我需要以编程方式使用C#应用程序将联系人插入到Outlook联系人。我正在使用Microsoft.Office.Interop.Outlook.ContactItem对象。

我可以设置姓名,电子邮件,电话等。但是,它似乎没有“ NOTES”的属性

如何设置Outlook联系人的备忘?

这是我正在使用的代码:

       Microsoft.Office.Interop.Outlook._Application outlookObj = new Microsoft.Office.Interop.Outlook.Application();
        Microsoft.Office.Interop.Outlook.MAPIFolder fldContacts = (Microsoft.Office.Interop.Outlook.MAPIFolder)outlookObj.Session.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderContacts);
        Microsoft.Office.Interop.Outlook.ContactItem newContact = (Microsoft.Office.Interop.Outlook.ContactItem)fldContacts.Items.Add(Microsoft.Office.Interop.Outlook.OlItemType.olContactItem);

        newContact.FullName ="Whatever Name";
        newContact.Email1Address = "Email@domain.com";

       //no property for newContact.Notes :(

        newContact.Save();
Run Code Online (Sandbox Code Playgroud)

.net c# outlook office-interop

4
推荐指数
1
解决办法
2689
查看次数

WPF 组合框验证.ErrorTemplate 错误

我有一个组合框,我需要编辑其错误模板以在出现验证错误时显示红色边框。

我正在使用以下样式

<Style TargetType="{x:Type ComboBox}" >
    <Setter Property="Validation.ErrorTemplate">
        <Setter.Value>
            <ControlTemplate>
                <DockPanel>
                    <Border BorderBrush="Red" BorderThickness="3">
                        <AdornedElementPlaceholder />
                    </Border>
                </DockPanel>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="FontFamily" Value="Segoe UI" />
    <Setter Property="FontSize" Value="12" />
    <Setter Property="VerticalAlignment" Value="Center" />
</Style>
Run Code Online (Sandbox Code Playgroud)

当验证错误发生时,边框永远不会显示。有什么提示出了什么问题吗?

wpf xaml

4
推荐指数
1
解决办法
1万
查看次数

使用WPF的ShowDialog打开表单时出现异常


我有一个WPF应用程序,当尝试使用时打开一个表单ShowDialog(),我在下面的一台机器上得到了这个奇怪的例外.
知道问题可能是什么?

异常消息=操作已中止(HRESULT异常:0x80004004(E_ABORT))异常堆栈跟踪=
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode,IntPtr errorInfo)System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode, MS.Internal.FontCache.FamCollection.LookupFamily上的MS.Internal.Text.TextInterface.FontCollection.FindFamilyName(String familyName,UInt32&index)中的MS.Internal.Text.TextInterface.Native.Util.ConvertHresultToException(Int32hr)处的IntPtr errorInfo) System.Windows.Media.FontFamily.LookupFontFamilyAndFace(CanonicalFontFamilyReference canonicalFamilyReference,FontStyle&style,FontWeight&weight,FontStretch&stretch)在System.Windows.Media.FontFamily.FindFirstFontFamilyAndFace上的字符串familyName,FontStyle&fontStyle,FontWeight&fontWeight,FontStretch&fontStretch(FontStyle&style,在Syste的System.Windows.Media.Typeface.ConstructCachedTypeface()的FontWeight&weight,FontStretch&stretch)m.Windows.Media.Typeface.get_CachedTypeface()在MS.Internal.TextFormatting.SimpleTextLine..ctor(FormatSettings设置,的Int32 cpFirst,的Int32 paragraphWidth,ArrayList中运行时,的Int32&后,的Int32&trailingSpaceWidth)
在MS.Internal.TextFormatting.SimpleTextLine.在MS.Internal.TextFormatting的MS.Internal.TextFormatting.TextFormatterImp.FormatLineInternal(TextSource textSource,Int32 firstCharIndex,Int32 lineLength,Double paragraphWidth,TextParagraphProperties paragraphProperties,TextLineBreak previousLineBreak,TextRunCache textRunCache)中创建(FormatSettings设置,Int32 cpFirst,Int32 paragraphWidth). System.Windows.Controls.TextBoxLine.Format(Int32 dcp,Double formatWidth,Double paragraphWidth,LineProperties lineProperties,TextRunCache textRunCache,TextFormatter formatt)中的TextFormatterImp.FormatLine(TextSource textSource,Int32 firstCharIndex,Double paragraphWidth,TextParagraphProperties paragraphProperties,TextLineBreak previousLineBreak,TextRunCache textRunCache)呃)System.Windows上的System.Windows.FrameworkElement.MeasureCore(Size availableSize)上的System.Windows.Controls.TextBoxView.MeasureOverride(Size constraint)中的System.Windows.Controls.TextBoxView.FullMeasureTick(Double constraintWidth,LineProperties lineProperties). UIElement.Measure(尺码availableSize)在MS.Internal.Helper.MeasureElementWithSingleChild(的UIElement元件,尺寸约束)在System.Windows.Controls.ScrollContentPresenter.MeasureOverride(尺寸约束)在System.Windows.FrameworkElement.MeasureCore(尺码availableSize)在系统.Windows.UIElement.Measure(尺码availableSize)在System.Windows.Controls.Grid.MeasureCell(的Int32细胞,布尔forceInfinityV)在System.Windows.Controls.Grid.MeasureCellsGroup(的Int32 cellsHead,尺寸referenceSize,布尔ignoreDesiredSizeU,布尔forceInfinityV) System.Windows.UIElement.Measure上的System.Windows.FrameworkElement.MeasureCore(Size availableSize)中的System.Windows.Controls.Grid.MeasureOverride(Size约束)(大小可用)System.Windows.Controls.Border.MeasureOverride上System.Windows.UIElement.Measure(Size availableSize)的System.Windows.FrameworkElement.MeasureCore(Size availableSize)上的System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)处的ableSize) System.Windows.FrameworkElement.MeasureCore上System.Windows.Controls.Control.MeasureOverride(Size constraint)上System.Windows.UIElement.Measure(Size availableSize)的System.Windows.FrameworkElement.MeasureCore(Size availableSize)上的(大小约束) System.Windows.Controls.Grid.MeasureCell(Int32 cell,Boolean forceInfinityV)中的System.Windows.UIElement.Measure(Size availableSize)上的(size availableSize)System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead,Size referenceSize,系统中的System.Windows.FrameworkElement.MeasureCore(Size availableSize)上的System.Windows.FrameworkElement.MeasureCore(Size availableSize)中的系统布局ignoreDesiredSizeU,布尔forceInfinityV)在Sys的System.Windows.UIElement.Measure(Size availableSize)tem.Windows.Controls.StackPanel.MeasureOverride(尺寸约束)在System.Windows.FrameworkElement.MeasureCore(尺码availableSize)在System.Windows.UIElement.Measure(尺码availableSize)在MS.Internal.Helper.MeasureElementWithSingleChild(的UIElement元件,尺寸System.Windows.Documents.AdasurenerDecorator.MeasureOverride上System.Windows.UIElement.Measure(Size availableSize)的System.Windows.FrameworkElement.MeasureCore(Size availableSize)上的System.Windows.Controls.ContentPresenter.MeasureOverride(Size约束)处理约束. System.Windows.FrameworkElement.MeasureCore上System.Windows.Controls.Border.MeasureOverride(Size constraint)的System.Windows.UIElement.Measure(Size availableSize)上的System.Windows.FrameworkElement.MeasureCore(Size availableSize)的(大小约束) System.Windows.Uasurelement.Measure(Size availableSize)的System.Windows.Uasurelement.Measure(Size availableSize)的大小(available availableSize)位于Syste的System.Windows.Window.MeasureOverride(Size availableSize)的System.Windows.WindOverrideHelper(Size constraint)System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)at的System.Windows.Interop.HwndSource.SetLayoutSize()处的System.Windows.UIElement.Measure(Size availableSize)中的m.Windows.FrameworkElement.MeasureCore(Size availableSize) System.Windows.Interop.HwndSource.set_RootVisual(视觉值)System.Windows.Window.SetRootVisual()在System.Windows.Window.SetRootVisualAndUpdateSTC()在System.Windows.Window.SetupInitialState(双人间requestedTop,双requestedLeft,双requestedWidth …

.net wpf exception

4
推荐指数
1
解决办法
2640
查看次数