小编Eam*_*voy的帖子

超链接到MS Word文档中的书签

是否可以从WPF文本块链接到word文档中的书签?

到目前为止,我有:

<TextBlock TextWrapping="Wrap" FontFamily="Courier New">
    <Hyperlink NavigateUri="..\\..\\..\\MyDoc.doc"> My Word Document </Hyperlink>
</TextBlock>
Run Code Online (Sandbox Code Playgroud)

我假设相对路径来自exe位置.我根本无法打开文件.

c# wpf bookmarks ms-word hyperlink

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

如何将委托传递给另一个类

在我的主要类'A'中,我声明了一个函数和委托来调用该函数,我想将我的委托传递给另一个类'B',但是B类将如何知道委托是什么类型的?

A级

public delegate void SendInfo(string[] info);
SendInfo sendInfo = new SendInfo(SendInformation); //I have a function SendInformation

B b = new B();
b.SetDelegate(sendInfo);
Run Code Online (Sandbox Code Playgroud)

B级

public delegate void SendInfo(string[] info); //I know this is wrong but how will 
SendInfo SendInformation;                     //this class know what SendInfo is?

public void SetDelegate(SendInfo sendinfo)    //What type is this parameter?
{
    sendinfo.GetType();
    SendInformation = sendinfo;
}
Run Code Online (Sandbox Code Playgroud)

谢谢,

埃蒙·

c# delegates

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

这个主要符号做什么 - MATLAB?

我正在处理一些来自另一个人的matlab代码,我不明白行的含义q = [q; 齐'].我觉得我应该能够删除它,所以q = distribuc ...

function [ q ] = ObtainHistogramForEachTarget( state, numberOfTargets, image, q )

    for i=1 : numberOfTargets
        qi = distribucion_color_bin_RGB2(state(i).xPosition,state(i).yPosition,state(i).size,image,2);
        q = [q; qi'];
    end
end
Run Code Online (Sandbox Code Playgroud)

任何人都可以向我解释这个吗?

matlab

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

将文本框绑定到WPF中的属性

我在用户控件中有一个文本框我试图从我的主应用程序更新但是当我设置textbox.Text属性时它不显示新值(即使textbos.Text包含正确的数据).我试图将我的文本框绑定到属性以解决这个问题,但我不知道如何,这是我的代码 -

MainWindow.xaml.cs

outputPanel.Text = outputText;
Run Code Online (Sandbox Code Playgroud)

OutputPanel.xaml

<TextBox x:Name="textbox" 
             AcceptsReturn="True" 
             ScrollViewer.VerticalScrollBarVisibility="Visible"
             Text="{Binding <!--?????--> }"/>  <!-- I want to bind this to the Text Propert in OutputPanel.xmal.cs -->                               
Run Code Online (Sandbox Code Playgroud)

OutputPanel.xaml.cs

 namespace Controls
{
public partial class OutputPanel : UserControl
{
    private string text;

    public TextBox Textbox
    {
        get {return textbox;}
    }

    public string Text
    {
        get { return text; }
        set { text = value; }
    }

    public OutputPanel()
    {
        InitializeComponent();
        Text = "test";
        textbox.Text = Text;
    }

}
Run Code Online (Sandbox Code Playgroud)

}

data-binding wpf user-controls dependency-properties properties

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

设置用户控件的样式

我正在尝试为我的用户控件设置样式.UserControl位于项目"控件"中,主题位于项目"MainProject"中

<UserControl x:Class="Controls.OutputPanel"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        mc:Ignorable="d" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        x:Name="OutputControl"> 
   <!-- Style="{DynamicResource UserControlStyle}"> - I cant set the style here because the Resource Dictionary hasn't been defined yet -->

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/MainProject;component/Themes/MyTheme.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <!-- Now that the Resource Dictionary has been defined I need to set the style -->      

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <TextBox x:Name="textbox" 
                   ScrollViewer.VerticalScrollBarVisibility="Visible"
                   Text="{Binding ElementName=OutputControl, Path=TextProperty}"
                   IsReadOnly="True"
                   Style="{DynamicResource OutputTextBoxStyle}"/>

    </Grid>

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

wpf user-controls styles resourcedictionary dynamicresource

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

创建BitmapImage WPF

我有一个包含我需要在屏幕上显示的图像数据的ushort [],当我创建一个Windows.System.Drawing.Bitmap,并将其转换为BitmapImage时,这感觉就像一个缓慢无助的方式来做到这一点.

有没有人创建ushort []的BitmapImage的最快方法是什么?

或者从数据中另外创建一个ImageSource对象?

谢谢,

埃蒙·

.net c# wpf bitmap bitmapimage

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

允许vi节点接受任何输入类型

我想创建一个VI,接受一个I​​nteger,float,bool,string或enum作为输入节点(但只有一个节点),然后在我的VI中检测输入类型,以便我可以以不同的方式使用数据.任何人都可以指出我正确的方向,我正在考虑变种但不确定如何去做.

我希望我的VI基本上可以像使用模板类型的C++函数或重载函数一样工作.

谢谢,Eamonn

templates labview variant

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

对象发送方在RelayCommand中始终为null

我正在使用RelayCommand处理按钮单击,我需要获取sender参数,但它始终为null,任何想法为什么?

ViewModel.cs

    private RelayCommand _expandClickCommand;
    public ICommand ExpandClickCommand
    {
        get
        {
            if (_expandClickCommand == null)
            {
                _expandClickCommand = new RelayCommand(ExpandClickCommandExecute, ExpandClickCommandCanExecute);
            }
            return _expandClickCommand;
        }
    }

    public void ExpandClickCommandExecute(object sender)
    {
        //sender is always null when i get here! 
    }
    public bool ExpandClickCommandCanExecute(object sender)
    {
        return true;
    }
Run Code Online (Sandbox Code Playgroud)

View.xaml

<ListBox ItemsSource="{Binding Path=MyList}">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <Button Grid.Column="0" Grid.Row="0" Content="Expand" Command="{Binding DataContext.ExpandClickCommand,ElementName=SprintBacklog}"/>
            </Grid>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>
Run Code Online (Sandbox Code Playgroud)

我需要在ExpandClickCommand中获取当前ListboxItem的索引

wpf mvvm relaycommand icommand

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

WPF在滚动查看器中选择项目

我有ScrollViewer一个StackPanel包含图像.是否可以在ScrollViewer/StackPanel中选择项目?

<ScrollViewer x:Name="Gallery" Grid.Column="1"  Grid.Row="0"   
        HorizontalScrollBarVisibility="Hidden" 
        VerticalScrollBarVisibility="Visible" >
    <StackPanel x:Name="GalleryStack"/>
</ScrollViewer>
Run Code Online (Sandbox Code Playgroud)

c# wpf image scrollviewer stackpanel

0
推荐指数
1
解决办法
1618
查看次数

在LabVIEW中格式化迭代器

我在while循环中写出一系列文件,它们被命名

1.dat, 2.dat, 3.dat...

但我需要将数字格式化为 -

00001.dat, 00002.dat, 00003.dat... 
Run Code Online (Sandbox Code Playgroud)

读取它们时保持文件顺序.有没有办法改变while循环迭代器的格式?

format labview iterator while-loop

0
推荐指数
1
解决办法
128
查看次数