小编Bri*_*nKE的帖子

SSL证书不会保存

我正在尝试将SSL证书(来自GoDaddy.com)安装到IIS 7.我可以按照此处找到的说明添加证书,它显示在我的服务器证书列表中,但是一旦我离开服务器证书页面并返回到它,证书不再显示在列表中.

此证书也用于Apache框以验证我们的网站(我使用IIS作为WCF服务API).证书被分配到*.mydomain.com所以我认为我可以将它用于Apache网站服务器(www.mydomain.com)以及我的API(services.mydomain.com).这个假设我不正确吗?我是否需要执行与上面提到的安装说明不同的操作?

iis-7 ssl-certificate

6
推荐指数
1
解决办法
4265
查看次数

WPF:DatePicker文本垂直居中

我在我的应用程序中使用DatePicker定义如下:

<DatePicker Width="200"
            Margin="20, 20, 20, 0"
            SelectedDate="{Binding PeriodEndDate, Mode=TwoWay}" />
Run Code Online (Sandbox Code Playgroud)

以下是日期选择器的显示方式:

在此输入图像描述

如何使日期(2015年4月22日)在文本框中垂直居中(日期周围的虚线是实际的文本框边界)?

我试图同时设置VerticalContentAlignment和VerticalAlignment到Center但这并不影响日期定心.

如果我使用探听挖掘到的日期选择器,我可以看到一个名为元素PART_TextBox中DatePicker.如果我将其更改PART_TextBox VerticalContentAlignment为Center,则文本将居中(Stretch默认设置为).但是,我不知道如何访问此子组件来更改它VerticalContentAlignment

wpf xaml textbox datepicker

6
推荐指数
1
解决办法
1567
查看次数

WPF:设置UserControl DataContext

我有以下MainWindow列出左侧导航面板和右侧显示区域(这两个都是UserControls).

有人可以解释如何将DataContext导航面板(LinksView.xaml)分配给LinksViewModel.cs.我想绑定的命令(BtnCompanyClickCommand)的按钮并定义BtnCompanyClickCommand在LinksViewModel.cs.

我尝试过在StackOVerflow上找到的各种方法来设置DataContext但这些解决方案似乎都不起作用(绑定RelativeSource,命名视图和绑定到名称等).

MainWindow.xaml

<StackPanel Orientation="Horizontal">
    <vw:LinksView DataContext="{Binding RelativeSource={RelativeSource Self}}"/>
    <ContentControl Content="{Binding CurrentUserControl}" />

</StackPanel>
Run Code Online (Sandbox Code Playgroud)

LinksView.xaml

<StackPanel Orientation="Vertical">
    <Button Content="Company" Width="75" Margin="3" Command="{Binding ElementName=Links,Path=BtnCompanyClickCommand}" />
</StackPanel>
Run Code Online (Sandbox Code Playgroud)

FormsDictionary.xaml

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:vm="clr-namespace:SidekickAdmin.ViewModel"
                    xmlns:vw="clr-namespace:SidekickAdmin.View">

    <DataTemplate DataType="{x:Type vm:CompanySummaryViewModel}">
        <vw:CompanySummaryView>
            <ContentControl Content="{Binding }" />
        </vw:CompanySummaryView>
    </DataTemplate>

    <DataTemplate DataType="{x:Type vm:LinksViewModel}">
        <vw:LinksView />
    </DataTemplate>

</ResourceDictionary>
Run Code Online (Sandbox Code Playgroud)

编辑

所以我终于遇到了如何设置UserControl的DataContext的解释,该控件必须在UserControl的第一个子项上完成.

这是修改后的LinksView.xaml.

<StackPanel Orientation="Vertical">
    <StackPanel.DataContext>
        <vm:LinksViewModel />   <!-- Bind the items in …
Run Code Online (Sandbox Code Playgroud)

data-binding wpf datacontext button mvvm

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

WPF DocumentViewer覆盖“打印”按钮

我已经使用自定义DocumentViewer(如下所示)在应用程序中实现了打印预览功能。我PrintDialog.ShowDialog()在显示预览之前先打电话给我,以便根据纸张方向正确创建文档。

但是,DocumentViewer的打印按钮会调用,PrintDialog.ShowDialog()提示用户再次选择打印机和选项(在打开预览窗口之前,他们已经这样做了)。

有没有一种方法可以让DocumentViewer打印按钮简单地打印而无需调用PrintDialog.ShowDialog()?

这是我的方法调用:

ReportViewModel.cs

    public void PrintButtonClick(DataGrid dataGrid)
    {
        PrintDialog printDialog = new PrintDialog();
        if (printDialog.ShowDialog() == false)
            return;

        // Get page size based on print dialog printable area (orientation)
        Size pageSize = new Size(printDialog.PrintableAreaWidth, printDialog.PrintableAreaHeight);

        // create new paginator for datagrid
        DataGridDocumentPaginator paginator = new DataGridDocumentPaginator(dataGrid as DataGrid, "Employer Match Report", pageSize, new Thickness(30, 20, 30, 20));
        ...
    }
Run Code Online (Sandbox Code Playgroud)

我这样做是为了正确生成纵向或横向尺寸值的分页器。否则,基于所选的方向,DocumentViewer中的预览文档可能无法正确显示。

PrintDocumentViewer:DocumentViewer

   protected override void OnPrintCommand()
   {
       PrintDialog printDialog = new PrintDialog();
       printDialog.PrintQueue …
Run Code Online (Sandbox Code Playgroud)

c# printing wpf documentviewer

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

Windows Server 2008 R2上的WPF样式

我有一个WPF程序,在Windows 8.1与Windows Server 20008 R2上的风格完全不同.下图显示了每个操作系统的示例(左侧是Windows 8,右侧是Server 2008 R2).

该程序使用.NET Framework 4.5构建.我查看了每台机器上安装的框架,它们如下:

Windows 8.1:

  • .NET Framework 4多目标包
  • .NET Framework 4.5多目标包
  • .NET Framework 4.5 SDK
  • .NET Framework 4.5.1多目标包
  • .NET Framework 4.5.1多目标包(ENU)
  • .NET Framework 4.5.1 SDK

Windows Server 2008 R2:

  • .NET Framework 4多目标包
  • .NET Framework 4.5.1

什么驱动应用程序的外观,有没有办法使Server 2008 R2上的程序看起来更像Windows 8.1上的程序?虽然在Server 2008 R2上一切正常,但让它看起来更像Windows 8.1图像会很不错.

在此输入图像描述

             Windows 8.1                                 Windows Server 2008 R2
Run Code Online (Sandbox Code Playgroud)

.net c# wpf

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

为什么这是SQL存储过程中的无效列?

我有以下SQL存储过程,当我尝试保存它时,它在最后一个select语句中抱怨"无效列名'目标'".

有人能告诉我为什么这是一个无效的comlumn名称?我对NetSales基本上做同样的事情,并没有抱怨该列.

if object_id('tempdb..#tmpHours') is not null
    DROP TABLE #tmpHours
if object_id('tempdb..#tmpPay') is not null
    DROP TABLE #tmpPay

SET @MondayOfCurrentWeek = (SELECT DATEADD(wk, DATEDIFF(wk,0,@WeekOf), 0) )

SELECT  p.PerceptionistID AS PerceptionistID, p.BaseCommission AS BaseCommission, p.BonusCommission AS BonusCommission, 
        h.WeekOf AS WeekOf, h.WorkHours AS WorkHours, h.PTOHours AS PTOHours, h.HolidayHours AS HolidayHours,
        ROUND(h.WorkHours, 0) AS HoursRounded, 
        (
            SELECT COUNT(c.PerceptionistID)
            FROM T_Call c 
            WHERE 
                c.PerceptionistID = p.PerceptionistID 
                AND c.OutcomeID = @OutcomeSale 
                AND EnteredOn BETWEEN @MondayOfCurrentWeek AND DATEADD(dd, 7, @MondayOfCurrentWeek)
        ) AS GrossSales,
        (
            SELECT COUNT …
Run Code Online (Sandbox Code Playgroud)

sql sql-server-2008

3
推荐指数
1
解决办法
475
查看次数

SQL:插入期间的自动递增值

我有一个现有的表,由于某种原因,设计者决定通过将最后使用的值存储在单独的表中来手动控制主键值(更改表以使用Identity现在不是一个选项).

我现在需要对此表进行大量更新,如下所示:

DECLARE @NeedFieldID int
SET @NeedFieldID = 62034

    INSERT INTO T_L_NeedField (NeedID, NeedFieldID, FieldName, Sequence, DisplayAs, FieldPrompt, DataType, ValidOptions, IsRequiredForSale)
    (
        SELECT 
            DISTINCT n.NeedID, 
                @NeedFieldID + 1,           
            'DetailedOutcome',
            999,
            'Detailed Outcome',
            'Select appropriate reason for a No Sale outcome',
            'T',
            'Pricing, Appointment Date / Time Not Available, Will Call Back, Declined', 
            0
        FROM  T_L_Need n
            INNER JOIN T_L_NeedField nf
                ON n.NeedID = nf.NeedID
        WHERE (n.Need LIKE 'Schedule%' AND n.Disabled = 0)
    )
Run Code Online (Sandbox Code Playgroud)

显然'@NeedFieldID + 1'不起作用(只是用它来显示我想做的事).当SQL插入每个不同NeedId的值时,如何增加@NeedFieldID?我正在使用SQL Server 2008.

insert auto-increment sql-server-2008

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

WiX / Burn:设置卸载屏幕信息

我创建了一个 MSI 文件来使用 WiX 3.7 安装我的程序之一。我创建了一个文件,其中包含显示在控制面板 -> 程序和功能中的公司信息,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<Include>

  <Property Id="ARPCOMMENTS" Value="My Service" />
  <Property Id="ARPCONTACT" Value="My Company, LLC" />
  <Property Id="ARPPRODUCTICON" Value="DC.ico" />
  <Property Id="ARPHELPLINK" Value="http://www.mycompany.com" />
  <Property Id="ARPREADME" Value=" " />
  <Property Id="ARPURLINFOABOUT" Value="http://www.mycompany.com" />
  <Property Id="ARPURLUPDATEINFO" Value=" " />
  <Property Id="ARPHELPTELEPHONE" Value="888 888 8888" />
  <Property Id="ARPAUTHORIZEDCDFPREFIX" Value=" " />

  <Icon Id="DC.ico" SourceFile="Resources\DC.ico" />

</Include>
Run Code Online (Sandbox Code Playgroud)

我现在必须使用 Burn 创建一个引导程序,以包含 Crystal Reports 和 C++ 2005 Redist。在控制面板 -> 程序和功能中,不显示来自 MSI(上面的属性项目)的信息。我现在只有一些非常通用的信息。有没有办法将上述信息包含在刻录文件中,使其显示在控制面板 -> 程序和功能中?

wix bootstrapper burn

3
推荐指数
1
解决办法
455
查看次数

WPF:没有调用IValueConverter

我试图根据ObservableCollection的"已更改"条件更改按钮的"背景".我的ViewModel上有一个'IsDirty'布尔属性,我确信它会在更改ObservableCollection时更新.

但是,按钮的背景没有被更改,并且似乎没有调用'Convert'方法.

我的转换器缺少什么?更改ObservableCollection时,按钮的背景应更改为红色(IsDirty为true)

编辑

我更新了转换器以返回红色或绿色(而不是红色和透明)的值,按钮没有背景颜色,这样就可以告诉我转换器永远不会被调用.

编辑2

添加了显示IsDirty属性的ViewModel代码.

变流器

public class IsDirtyConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return System.Convert.ToBoolean(value) ?
            new SolidColorBrush(Colors.Red)
            : new SolidColorBrush(Colors.Green);
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }

}
Run Code Online (Sandbox Code Playgroud)

视图

<Window x:Class="SerializeObservableCollection.MainWindow"
        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"
        xmlns:conv="clr-namespace:SerializeObservableCollection.Converter"
        xmlns:ignore="http://www.ignore.com"
        mc:Ignorable="d ignore"
        Height="300"
        Width="491"
        Title="MVVM Light Application"
        DataContext="{Binding Main, Source={StaticResource Locator}}">

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Skins/MainSkin.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <conv:IsDirtyConverter x:Key="IsDirtyConverter" /> …
Run Code Online (Sandbox Code Playgroud)

c# wpf converter button

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

WPF GroupBox 标题文本问题

我有以下正确显示的 XAML:

    <GroupBox Name="RulesGroupBox" Header="Rules">

        <StackPanel Name="RulesStackPanel"
                HorizontalAlignment="Left">

....

        </StackPanel>
    </GroupBox>
Run Code Online (Sandbox Code Playgroud)

我现在想使用以下内容(我知道在其他项目中有效)将标题文本设为粗体:

    <GroupBox Name="RulesGroupBox">
        <GroupBox.Header>
            <TextBlock FontWeight="Bold" Text="Rules"></TextBlock>
        </GroupBox.Header>

        <StackPanel Name="RulesStackPanel"
                HorizontalAlignment="Left">
....

        </StackPanel>
    </GroupBox>
Run Code Online (Sandbox Code Playgroud)

出于某种原因,在此项目中,此更改具有使标题文本“System.Windows.Controls.TextBlock”而不是“Rules”的文本显示的效果。文本现在是粗体但不显示“规则”。

知道为什么 chagne 不会以粗体显示“规则”吗?

c# wpf xaml groupbox

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