本文整理汇总了C#中View.SetResourceReference方法的典型用法代码示例。如果您正苦于以下问题:C# View.SetResourceReference方法的具体用法?C# View.SetResourceReference怎么用?C# View.SetResourceReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View.SetResourceReference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DocumentAsView
/// <summary>
/// Returns a named document associated with the current action and assigns the model and wraps it in a view to it can be loaded in preview mode
/// </summary>
/// <param name="documentName">Name of the document.</param>
/// <param name="model">The model.</param>
/// <returns>Document Result.</returns>
protected virtual ViewResult DocumentAsView(string documentName, object model = null)
{
var documentResult = Document(documentName, model);
if (documentResult == null) return null;
var view = new View();
view.SetResourceReference(FrameworkElement.StyleProperty, "CODE.Framework-Layout-StandardFormLayout");
var title = documentResult.Document as ITitle;
var titleText = title != null ? title.Title : "Preview";
if (string.IsNullOrEmpty(titleText)) titleText = "Preview";
SimpleView.SetTitle(view, titleText);
view.Items.Add(new FlowDocumentReader
{
Document = documentResult.Document as FlowDocument,
Margin = new Thickness(5)
});
return new ViewResult
{
Model = model,
View = view,
ViewTitle = titleText,
ViewSource = "dynamic"
};
}