All Projects → fsdsabel → TinyHtmlWpf

fsdsabel / TinyHtmlWpf

Licence: BSD-3-Clause license
TinyHtml.Wpf is a WPF HTML rendering library based on litehtml. It provides the rendering backend for WPF. Contrary to similar libraries it uses native WPF drawing to render texts, images and other stuff. So it is fully capable of doing high dpi and blends seemlessly with other content.

Programming Languages

C++
36643 projects - #6 most used programming language
C#
18002 projects
CSS
56736 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to TinyHtmlWpf

AerialForWindows
Aerial For Windows is a Windows screen saver based on the new Apple TV screen saver
Stars: ✭ 30 (+0%)
Mutual labels:  wpf
Elysium-Extra
Elysium Extra is a library that implements Metro style for Windows Presentation Foundation (WPF) applications. This Project is a very large add-on project built on top of the Elysium SDK.
Stars: ✭ 65 (+116.67%)
Mutual labels:  wpf
HandyControl
WPF HandyControl各个控件使用案例;修改主题、颜色、语言。
Stars: ✭ 49 (+63.33%)
Mutual labels:  wpf
DataGridFilter
WPF Filterable Datagrid, multi language
Stars: ✭ 134 (+346.67%)
Mutual labels:  wpf
SimpleWavSplitter
Split multi-channel WAV files into single channel WAV files.
Stars: ✭ 15 (-50%)
Mutual labels:  wpf
CaliburnMicro-Calculator
A simple Calculator using Caliburn.Micro (WPF with MVVM)
Stars: ✭ 19 (-36.67%)
Mutual labels:  wpf
Tai
👻 在Windows上统计软件使用时长
Stars: ✭ 328 (+993.33%)
Mutual labels:  wpf
YoutubePlaylistDownloader
A tool to download whole playlists, channels or single videos from youtube and also optionally convert them to almost any format you would like
Stars: ✭ 226 (+653.33%)
Mutual labels:  wpf
SpeakIt Vietnamese TTS
Vietnamese Text-to-Speech on Windows Project (zalo-speech)
Stars: ✭ 81 (+170%)
Mutual labels:  wpf
YuzuMarker
🍋 [WIP] Manga Translation Tool
Stars: ✭ 76 (+153.33%)
Mutual labels:  wpf
EBind
🔵 .NET Data Binding we deserve: concise, fast, feature-rich
Stars: ✭ 141 (+370%)
Mutual labels:  wpf
Ayase
🥥 Control everything by keyboard. Built for hackers and the blind.
Stars: ✭ 53 (+76.67%)
Mutual labels:  wpf
SVGImage
A SVGImage Control for WPF
Stars: ✭ 132 (+340%)
Mutual labels:  wpf
wpf-propertygrid
Repackaging of Workflow Foundation's property grid for general use in WPF applications
Stars: ✭ 55 (+83.33%)
Mutual labels:  wpf
Maple
Maple is a windows desktop application designed to support semi and non professional streamers in playing back local audio files and streaming content from the internet to their favorite playback device
Stars: ✭ 37 (+23.33%)
Mutual labels:  wpf
ColorBlender
A .NET library for color matching and palette design.
Stars: ✭ 27 (-10%)
Mutual labels:  wpf
Crema
Meta data server & client tools for game development
Stars: ✭ 61 (+103.33%)
Mutual labels:  wpf
WPFControls-ThemePack
Custom designed themes for WPF controls to make your app look better. Simple to modify.
Stars: ✭ 28 (-6.67%)
Mutual labels:  wpf
mvvmgen
MvvmGen is a lightweight MVVM library for XAML applications. It generates your ViewModels on-the-fly for you via a Roslyn-based C# Source Generator.
Stars: ✭ 179 (+496.67%)
Mutual labels:  wpf
QingTing.Fm
Simple function of playing and displaying QingtingFm(蜻蜓FM) based on WPF
Stars: ✭ 21 (-30%)
Mutual labels:  wpf

TinyHtml.Wpf

Introduction

TinyHtml.Wpf is a WPF HTML rendering library based on litehtml. It provides the rendering backend for WPF. Contrary to similar libraries it uses native WPF drawing to render texts, images and other stuff. So it is fully capable of doing high dpi and blends seemlessly with other content.

Originally it was developed by me to replace HTMLayout that we used before. However text rendering was always blocky and didn't blend well with other WPF content. We use this extensively for dynamic formatted text that is authored as HTML.

This library does not provide scripting capabilities or very advanced HTML. It proved to be quite capable nonetheless.

A Nuget package can be found on nuget.org. It supports x86 and x64 (or AnyCPU) applications.

Release Notes

1.2.2.0

  • .NET 5.0 build
  • Fixes possible access violation if control is unloaded while mouse cursor is inside of control

1.2.1.0

  • .NET Core 3.0 build
  • Upgrade to Visual Studio 2019

1.2.0.0

  • New virtual method OnAnchorClicked for WpfHtmlControlBase that allows interception of user clicks on links.

Requirements

  • .NET 4.6 or .NET Core 3.0
  • A WPF application
  • Visual Studio 2019 for building

Supported features

  • WPF Text rendering
  • HTML Tables
  • HTML Lists
  • Images
  • css
  • and much more...

Building

  1. Get sources from https://github.com/fsdsabel/TinyHtmlWpf:
  2. Open the Solution TinyWpfHtml.sln in Visual Studio 2019
  3. Compile configuration Release - x86
  4. Compile configuration Release - x64
  5. Binaries should be in Bin directory and HtmlTestApp should run

Usage

Basically there is only one class you need. It is WpfHtmlControl which is subclassed from a standard WPF Control. This control loads a default master style sheet. If you want a custom one, you can derive from WpfHtmlControlBase and load your own.

The master style sheet is used for all the default HTML elements like paragraphs or bold elements. For example you could do something like this:

public class MyWpfHtmlControl : WpfHtmlControlBase
{
    static MyWpfHtmlControl()
    {
        using (var s = typeof (MyWpfHtmlControl).Assembly.GetManifestResourceStream(typeof (MyWpfHtmlControl), "master.css"))
        {
            SetMasterStylesheet(new StreamReader(s).ReadToEnd());
        }
    }
}

You would then use MyWpfHtmlControl in your application.

The most basic usage of a WpfHtmlControl would be:

<local:WpfHtmlControl Background="Blue" Foreground="Red" FontSize="16" 
                      Html="&lt;b&gt;Hello world!&lt;/b&gt;"></local:WpfHtmlControl>

It is possible to bind to the Html property to update the displayed HTML dynamically.

If you want to display images, you have to override OnLoadResource.

License

Copyright (c) 2020, Daniel Sabel
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.
  • Neither the name of the nor the
    names of its contributors may be used to endorse or promote products
    derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This library uses litehtml:

Copyright (c) 2013, Yuri Kobets (tordex)
All rights reserved.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].