是否可以从WPF文本块链接到word文档中的书签?
到目前为止,我有:
<TextBlock TextWrapping="Wrap" FontFamily="Courier New">
<Hyperlink NavigateUri="..\\..\\..\\MyDoc.doc"> My Word Document </Hyperlink>
</TextBlock>
Run Code Online (Sandbox Code Playgroud)
我假设相对路径来自exe位置.我根本无法打开文件.
在我的主要类'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)
谢谢,
埃蒙·
我正在处理一些来自另一个人的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)
任何人都可以向我解释这个吗?
我在用户控件中有一个文本框我试图从我的主应用程序更新但是当我设置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
我正在尝试为我的用户控件设置样式.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) 我有一个包含我需要在屏幕上显示的图像数据的ushort [],当我创建一个Windows.System.Drawing.Bitmap,并将其转换为BitmapImage时,这感觉就像一个缓慢无助的方式来做到这一点.
有没有人创建ushort []的BitmapImage的最快方法是什么?
或者从数据中另外创建一个ImageSource对象?
谢谢,
埃蒙·
我想创建一个VI,接受一个Integer,float,bool,string或enum作为输入节点(但只有一个节点),然后在我的VI中检测输入类型,以便我可以以不同的方式使用数据.任何人都可以指出我正确的方向,我正在考虑变种但不确定如何去做.
我希望我的VI基本上可以像使用模板类型的C++函数或重载函数一样工作.
谢谢,Eamonn
我正在使用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的索引
我有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) 我在while循环中写出一系列文件,它们被命名
1.dat, 2.dat, 3.dat...
但我需要将数字格式化为 -
00001.dat, 00002.dat, 00003.dat...
Run Code Online (Sandbox Code Playgroud)
读取它们时保持文件顺序.有没有办法改变while循环迭代器的格式?
wpf ×6
c# ×4
labview ×2
.net ×1
bitmap ×1
bitmapimage ×1
bookmarks ×1
data-binding ×1
delegates ×1
format ×1
hyperlink ×1
icommand ×1
image ×1
iterator ×1
matlab ×1
ms-word ×1
mvvm ×1
properties ×1
relaycommand ×1
scrollviewer ×1
stackpanel ×1
styles ×1
templates ×1
variant ×1
while-loop ×1