我将HTML-Source字符串保存在HTMLReport字段中称为"Report"的SQL Server表中(字段类型为NTEXT).现在我需要将存储的HTML显示到WPF窗口中.需要在此WPF窗口上解释HTML标记和内联CSS.
有人可以帮我完成这段代码吗?
<Window x:Class="MyProject.HTMLView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Title="HTML View" Height="454" Width="787"
>
<Grid Name="grid1">
<WindowsFormsHost>
<wf:RichTextBox x:Name="reportHTML" Text="{Binding DisplayHTML, Mode=OneWay}"/>
<!-- How do i bind dispaly HTML page here-->
</WindowsFormsHost>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
namespace MyProject
{
public class HTMLViewModel: ViewModelBase
{
public HTMLViewModel()
{
//Reading from SQL Server table
//SELECT HTMLReport FROM Report WHERE ID=123
//OK, I have HTMLString from database over here
//Now I am assigning that to DisplayHTML Property
DisplayHTML ="<table><tr><td><b>This text should be in table …Run Code Online (Sandbox Code Playgroud) 我试图使用MVVM模式在WPF的WebBrowser窗口中打开HTML文件.
注意:我已经解决了我遇到的问题.现在这段代码按照需要运行.
<Window x:Class="MyProject.ViewHTMLPageView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MyProject.Utility"
Title="HTML Report" Height="454" Width="787"
>
<Grid Name="grid1">
<WebBrowser local:WebBrowserUtility.BindableSource="{Binding ReportPage}" />
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
namespace MyProject
{
public class ViewHTMLPageViewModel: ViewModelBase
{
public ViewHTMLPageView()
{
//Testing html page on load
_reportPage = "<table border='5'><tr><td> This is sample <b> bold </b></td></tr></table>";
OnPropertyChanged("ReportPage");
}
private string _reportPage;
public string ReportPage
{
get
{
return _reportPage;
}
set
{
if (_reportPage != value)
{
_reportPage = value;
OnPropertyChanged("ReportPage");
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
using System; …Run Code Online (Sandbox Code Playgroud) 如果你不确定我的意思,请不要给出反馈.
我在Oracle数据库中有一个表,其中包含数据类型为CLOB的字段.字段名称是XMLString.我正在存储每个记录长度为10,000个字符的XML字符串.我在这张表中有超过10万条记录.
现在我有一种情况,我需要更新特定位置的每条记录上的XML字符串段.例如,我需要使用"我的新文本"等字符串更新第14个位置的每个记录.此替换文本长度为11个字符.所以这只是意味着它将取代从第14个角色开始的11个追逐者.
我尝试过使用CLOB,但这并不是我想要的.
有没有像这样简单的命令
Replace(XMLString, 14, ‘My New text’)
Run Code Online (Sandbox Code Playgroud)
这样我可以做下面的事情?
UPDATE MYTABLE
SET MyClobField = Replace(MyClobField, 14, 'My New text')
WHERE MyTableID>5000
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激.
我正在使用WPF和MVVM模式.手动调整主窗口大小时,如何调整WPF TabControl的大小?TabControl也应在最大化或恢复时调整大小.你能解释逻辑解决方案吗?能否请您阅读与此逻辑相关的主题.在下面的代码中,我是TabControl以获得MDI的外观和感觉,其中UserControl被添加到TabControl.
<Window x:Class="MyProject.DashboardView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MyProject"
Title="Resiable tabcontrol"
Width="1064"
Height="897"
WindowState="Normal"
WindowStartupLocation="CenterOwner">
<Window.Resources>
<local:TabSizeConverter x:Key="tabSizeConverter" />
<Style TargetType="{x:Type TabItem}">
<Setter Property="Width">
<Setter.Value>
<MultiBinding Converter="{StaticResource tabSizeConverter}">
<Binding RelativeSource="{RelativeSource Mode=FindAncestor,
AncestorType={x:Type TabControl}}" />
<Binding RelativeSource="{RelativeSource Mode=FindAncestor,
AncestorType={x:Type TabControl}}" Path="ActualWidth" />
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<DockPanel>
<Menu Name="menu1" VerticalAlignment="Top" Visibility="Visible"
DockPanel.Dock="Top" Loaded="menu1_Loaded">
<Menu.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,0">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0" Color="White"/>
<GradientStop Offset="0" Color="White"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Menu.Background>
<MenuItem Header="File" Name="mnuTab" >
<MenuItem Header="List of High School"
Click="mnuTab1_Click"/>
<MenuItem Header="List of University" …Run Code Online (Sandbox Code Playgroud) 有没有办法在循环中声明70个不同的变量而不是声明每个变量?
我想做类似下面的事情:
For i As Integer = 0 To 70
Dim Para + i AS OracleParameter
Next
Run Code Online (Sandbox Code Playgroud)
而不是声明如下:
Dim Param1 AS OracleParameter
Dim Param2 AS OracleParameter
Dim Param3 AS OracleParameter
…
Dim Param70 AS OracleParameter
Run Code Online (Sandbox Code Playgroud) 我有两个表:tblProduct有产品列表,tblConsumer有消费者名称和消费产品ID.现在我需要找到消费者使用产品表中所有产品的名称.
我尝试使用INTERSECT解决这个问题,但问题是我在WHERE子句中提供了每个productid.此语法提供了我想要的结果,但是如何在不需要指定每个productID的情况下编写此查询.
SELECT ConsumerName FROM tblConsumer WHERE ProductID= 1
INTERSECT
SELECT ConsumerName FROM tblConsumer WHERE ProductID =2
INTERSECT
SELECT ConsumerName FROM tblConsumer WHERE ProductID =3
tblProduct
---------------------------------
ProductID | Product Name
---------------------------------
1 | Mango
2 | Orange
3 | Banana
tblConsumer
---------------------------------
ConsumerName | ProductID
---------------------------------
David | 1
David | 3
David | 2
Henry | 3
Henry | 2
Run Code Online (Sandbox Code Playgroud)