我有一个View,我将产品添加到一个简单的WebStore.我希望一个产品有多个图像.这就是我使用Microsoft.Web.Helpers的FileUpload的原因.在我的View中使用FileUpload是这样的:
@FileUpload.GetHtml("Upload", 5, true, true, addText: "Add more", uploadText: "Upload files")
Run Code Online (Sandbox Code Playgroud)
然后我有一些其他产品属性的标签和字段,如下所示:
<div class="editor-field"><br>
@Html.EditorFor(model => model.Title)<br>
@Html.ValidationMessageFor(model => model.Title)<br>
</div>
Run Code Online (Sandbox Code Playgroud)
问题是当我使用post方法时,我的控制器没有得到任何东西.我使用这样的控制器:
[HttpPost]
public ActionResult Create(Product product, IEnumerable<HttpPostedFileBase> fileUpload)
{
foreach (var file in fileUpload)
{
var fileName = Path.GetFileName(file.FileName);
}
return RedirectToAction("Index");
}
Run Code Online (Sandbox Code Playgroud)
那么有谁知道我做错了什么.因为我的FileUpload对象总是空的.
我正在尝试检测Application.Resources资源字典中的更改,因此我可以在更新时自动将Titlebar更改为Accent Color.所有XAML控件和元素都会自动更改,并且在将纯色画笔设置为DSDFS画笔的地址时,其内部值会更改.
这是我尝试用来检测更改的代码:
public static DependencyProperty accent = DependencyProperty.Register("DictChange", typeof(ResourceDictionary), typeof(Shell), new PropertyMetadata(Application.Current.Resources, new PropertyChangedCallback(accent_PropertyChanged)));
public ResourceDictionary DictChange
{
get { return (ResourceDictionary)GetValue(accent); }
set { SetValue(accent, value); }
}
private static void accent_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
_app.SetTitlebar();
}
Run Code Online (Sandbox Code Playgroud)
我假设它错了,或者我不确定检测更改是否正确.我曾经使用Application.Current.Resources["SystemControlBackgroundAccentBrush"] as SolidColorBrush并尝试检测其属性的前一次迭代,但这也无效.
我究竟做错了什么?请帮忙 :)