我是 C# 和 WPF 格式的新手。在我的程序中,我有一个带有文本的字符串数组,我想在画布中为数组中的每个字符串创建一个按钮。我已经使用了flex,并且我可以使用addChild命令将一些东西放入其他东西中,但我还没有弄清楚如何在WPF中做到这一点。任何帮助将不胜感激,谢谢。
我继承了一个我知之甚少的网站。我曾经使用过 asp.net/C# 网站,但这似乎有所不同。后面没有代码可供我设置断点并单步执行。程序中的一些参考资料也找不到。我的一般问题是:如何在 Visual Studio 中调试该程序?
与此示例代码相关的具体问题:
该程序继承“Company.Program.SystemLogin”。我在任何代码中都找不到该类。为什么不可以以及如何找到它?
<%@ Page Language="vb" AutoEventWireup="false" Inherits="Company.Program.SystemLogin" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Company CMS</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<style>
BODY { FONT-SIZE: 11px; FONT-FAMILY: Verdana, Helvetica, sans-serif; BACKGROUND-COLOR: #ffffff }
INPUT { FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana, Helvetica, sans-serif }
TEXTAREA { FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana, Helvetica, sans-serif } …Run Code Online (Sandbox Code Playgroud)我有这个自定义的wpf用户控件:
ShowCustomer.xaml:
<UserControl x:Class="TestControlUpdate2343.Controls.ShowCustomer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<TextBlock Text="{Binding Message}"/>
</Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)
ShowCustomer.xaml.cs:
using System.Windows.Controls;
using System;
using System.ComponentModel;
namespace TestControlUpdate2343.Controls
{
public partial class ShowCustomer : UserControl, INotifyPropertyChanged
{
#region ViewModelProperty: Message
private string _message;
public string Message
{
get
{
return _message;
}
set
{
_message = value;
OnPropertyChanged("Message");
}
}
#endregion
public ShowCustomer()
{
InitializeComponent();
DataContext = this;
Message = "showing test customer at: " + DateTime.Now.ToString();
}
#region INotifiedProperty Block
public event PropertyChangedEventHandler PropertyChanged;
protected void …Run Code Online (Sandbox Code Playgroud) 所以我有这段代码:
string BizID = DT1["Business_ID"].ToString();
if (string.IsNullOrEmpty(BizID))
{
}
else
{
DDLBustype.SelectedValue = BizID;
}
Run Code Online (Sandbox Code Playgroud)
似乎应该有一个更简单的方法来做到这一点.也许我只是有一个大脑f*rt但是不应该有办法这样做而不必使用"其他"?
Regex r = new Regex("([sS][cC][rR][iI][pP][tT])|([sS][qQ][lL])|(<%=)");
Run Code Online (Sandbox Code Playgroud)
没有找到任何<%=出现但正确找到SqL,SQL,sQL,脚本,ScRipT ......
我究竟做错了什么?
[\<] gives escape unrecognized error. Just as [\%] do.
Run Code Online (Sandbox Code Playgroud)
示例字符串:
Injection protection test:
<script> alert('fail');
</script>
<asp:SqlDataSource runat="server"></asp:SqlDataSource>
<%= Server.Rewrite( ....) %>
Run Code Online (Sandbox Code Playgroud) 我有一个字符串与字符串和int我想解析字典字符串和内联到一个HTML表格,如果可能的话?
protected void Page_Load(object sender, EventArgs e)
{
Dictionary<string, int> userMediaList = new Dictionary<string, int>();
userMediaList.Add("Die Hard", 5);
userMediaList.Add("Die Hard II", 3);
userMediaList.Add("Die Hard III", 2);
userMediaList.Add("Ringenes Herre", 4);
userMediaList.Add("Ringenes Herre II", 1);
userMediaList.Add("Ringenes Herre III", 5);
var sortUserMediaList = from entry in userMediaList orderby entry.Value ascending select entry;
}
Run Code Online (Sandbox Code Playgroud)
所以我想要的是将它添加到网站上的表格中.
因此,对于表格中的每个框,将显示电影的名称和电影的评级.
我最后有一个表单和一个提交按钮.
<button type="submit" onclick="submission" role="button" aria-disabled="false">
<span class="ui-button-text">Submit form</span>
</button>
Run Code Online (Sandbox Code Playgroud)
在我的codebehind文件中,我有这个
protected void submission(object sender, EventArgs e)
{
Console.WriteLine(FirstName.textbox.Text);
}
Run Code Online (Sandbox Code Playgroud)
当我执行页面时,Firefox不会给我带来问题,但IE确实如此.为什么?