小编Dav*_*vid的帖子

如何删除窗口标题和内容之间的边框

我创建了一个带有丝带的窗口(2010 - Microsoft.Windows.Controls.Ribbon).

它看起来像这样:

在此输入图像描述

现在,标签上是否有边框(标签和标题之间).这非常难看.

它应该看起来像Microsoft Office Word:

在此输入图像描述

我能做什么,标签栏和标题栏之间没有边框?

(使用RibbonWindow)

wpf styles window border

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

如何在OnRender中重绘或刷新?

我想动态画一些东西.以下代码显示了我的OnRender.我正在我的程序中的某个地方设置DrawItem,我需要它.但是,当我打电话给DrawItem =5;我必须打电话时,OnRender会被调用吗?

protected override void OnRender(DrawingContext drawingContext)
{
    switch (DrawItem)
    {
        case 1:
            //Draw Item 
            break;
        case 2:
            //Draw Item 
            break;
        case 3:
            //Draw Item 
            break;
        case 4:
            //Draw Item 
            break;
        case 5:
            //Draw Item 
            break;
    }
    base.OnRender(drawingContext)
}

public int DrawItem { get; set; }
Run Code Online (Sandbox Code Playgroud)

c# wpf drawing onrender

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

BinaryFormatter 忽略程序集版本

我有以下方法来生成对象的散列。它工作得很好!但是当我更改程序集的版本时,即使对象相同,哈希也会发生变化。

public static string GetHash(Object item)
{
    MemoryStream memoryStream = new MemoryStream();
    BinaryFormatter binaryFormatter = new BinaryFormatter();
    binaryFormatter.Serialize(memoryStream, item);
    binaryFormatter.AssemblyFormat = FormatterAssemblyStyle.Simple;

    HashAlgorithm hashAlgorithm = new MD5CryptoServiceProvider();
    memoryStream.Seek(0, SeekOrigin.Begin);

    return Convert.ToBase64String(hashAlgorithm.ComputeHash(memoryStream));
}
Run Code Online (Sandbox Code Playgroud)

怎么可能忽略程序集版本?

c# serialization binaryformatter .net-assembly

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

无法找到捆绑的基本路径

我正在使用Symfony2并希望通过运行为实体生成getter和setter:

$ php app/console doctrine:generate:entities TestBundle
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

控制台返回以下消息:

[RuntimeException]找不到"TestBundle"的基本路径(路径:"C:\ xampp\htdocs\ProjectX\src\Namespace\TestBundle",目的地:"C:/ xampp/htdocs/ProjectX/src/Namespace/TestBundle ").

Bundle存在于以下位置: C:\xampp\htdocs\ProjectX\src\Namespace\TestBundle

怎么了?

php entities symfony doctrine-orm

5
推荐指数
2
解决办法
3259
查看次数

如何计算两个地址之间的距离

我想计算两点之间的距离.要点是地址.

例:

A点:肯尼迪机场,纽约,纽约,美国

B点:La Guardia,纽约,纽约,美国

现在我想计算距离(通过道路)和A点到B点之间的行程时间.

我怎样才能做到这一点?是否可以使用谷歌地图API?你会如何解决这个问题?

php api openstreetmap street-address

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

双击功能区时禁用最小化或最大化

我使用Ribbon for WPF(2010 - Microsoft.Windows.Controls.Ribbon).

当我双击选项卡(标题)时,如何禁用红色范围内的最小化或最大化效果

在此输入图像描述

wpf ribbon double-click minimize maximize

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

包含带内容的UserControl

我创建了一个UserControl.我想用这段代码包含它:

<UserControl1 Header="Heading">
    <TextBlock Text="My Content" />
</UserControl1>
Run Code Online (Sandbox Code Playgroud)

这是UserControl:

<UserControl x:Class="WpfApplication1.UserControl1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" MinHeight="200"
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <Style TargetType="ToggleButton">
            <!-- ... -->
        </Style>        
    </UserControl.Resources>
    <StackPanel>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding Path=Header}" Grid.Column="0" />
            <ToggleButton Name="ToggleButton" IsChecked="True" Grid.Column="2" />
        </Grid>
        <Rectangle Stroke="#c3c3c3" StrokeThickness="1" Height="1" StrokeDashArray="4 4" SnapsToDevicePixels="True" Focusable="False" />
        <!-- Content -->
        <ContentControl>
            <ContentPresenter/>
        </ContentControl>
    </StackPanel>
</UserControl>
Run Code Online (Sandbox Code Playgroud)

现在我的问题:

如果我将它与以下代码集成,

<UserControl1 Header="Heading">
    <TextBlock Text="My Content" />
</UserControl1>
Run Code Online (Sandbox Code Playgroud)

我收到的结果如下:

在此输入图像描述

那不是我想要的.

但是当我将它与这个代码集成时,我得到了理想的结果. …

wpf xaml user-controls contentpresenter

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

DataGrid通过滚动抛出InvalidOperationException

我想在DataGrid中显示一个文件的内容.(该文件包含超过200,000行)

使用数据显示网格很快.

但是,当我使用滚动条(向下滚动)时,我有以下异常:

System.InvalidOperationException:
{"An ItemsControl is inconsistent with its items source.\n  See the inner exception for more information."}
Run Code Online (Sandbox Code Playgroud)

的InnerException:

Information for developers (use Text Visualizer to read this):
This exception was thrown because the generator for control 'System.Windows.Controls.DataGrid Items.Count:0' with name '(unnamed)' has received sequence of CollectionChanged events that do not agree with the current state of the Items collection.  The following differences were detected:
  Accumulated count 0 is different from actual count 200000.  [Accumulated count is (Count at …
Run Code Online (Sandbox Code Playgroud)

wpf datagrid scroll exception invalidoperationexception

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

绑定到应用样式/模板的Control

我想(重新)模板控件,例如ComboBox.

XAML:

<ComboBox Style="{StaticResource MyComboBoxStyle}" ... >
    <!-- ... -->
</ComboBox>
Run Code Online (Sandbox Code Playgroud)

在ControlTemplate中我想要一个Button.

ResourceDictionary中:

<Style x:Key="MyComboBoxStyle" TargetType="{x:Type ComboBox}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type ComboBox}">
                <Grid>
                    <!-- ... -->

                    <Button Command="{TemplateBinding Tag}" CommandParameter="{Binding ???}" />

                    <!-- ... -->
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)

但我想设置CommandParameter应用模板的Control(在本例中为ComboBox).

我怎么解决这个问题?

wpf xaml binding controltemplate commandparameter

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

如何在自定义对话框中创建正面和负面按钮

我想创建一个自定义对话框.所以我创建了一个模板'dialog_change',然后打开对话框.

Dialog myDialog = new Dialog(Overview.this);
myDialog.setContentView(R.layout.dialog_change);
myDialog.setTitle("My Custom Dialog Title");
myDialog.show();
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

现在我想在底部添加两个按钮(一个正面和一个负面按钮).我怎样才能做到这一点?

user-interface android dialog button customdialog

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