SlintDotnet is a C# bindings project to enable developers to use Slint UI with .NET C#

Overview

SlintDotnet (Alpha)

npm

Slint is a UI toolkit that supports different programming languages. SlintDotnet is the integration with .NET C#.

⚠️ This is experimental and not ready for production use! SlintDotnet is still in the early stages of development: APIs will change and important features are still being developed.

Installing Slint

Slint is available via Nuget package:

dotnet add package SlintDotnet

Dependencies

You need to install the following components:

  • Supported only on Linux (for now):
    • x64
    • arm
    • arm64
  • .NET 6.0 SDK for Linux
  • fontconfig library (libfontconfig-dev on debian based distributions)

Using SlintDotnet

There are a ready to use template from the VS Code Torizon Templates.

API Overview

To have access to the Slint classes the following using statement is needed:

using Slint;

Window Component

The window component from the .slint file is mapped to the Window class. To have access to the Window class is need to add the using statement to the namespace that is the same name of the .slint file. For example: if the .slint file is named MyWindow.slint:

using MyWindow;

Then the Window class can be instantiated and used:

var window = new Window();
window.run();

Accessing a property

Properties are exposed as properties on the instance of the Window:

window.counter = 42;

⚠️ struct properties are accessed as properties on the instance of the Window

Callbacks

The callbacks are also exposed as Action properties on the instance of the Window:

window.RequestIncreaseValue = () => { 
    window.counter++; 
};

⚠️ The keywords from the .slint file are converted to pascal case.

⚠️ Only void(void) callbacks are supported for now.

Changing UI from Different Threads

The UI can only be changed from the UI thread, a panic will be triggered if you try to change the UI from a different thread. To change the UI from a different thread use:

  window.RunOnUiThread(() => {
    window.counter++;
  });

This will move the action to the Slint upgrade_in_event_loop to be executed in the UI thread.

⚠️ Window.RunOnUiThread can only be called after the Window.Run method. An exception will be thrown if called before.

Type Mappings

.slint Type C# Type Notes
int Float
float Float
string String
bool bool
image Slint.Image
Timer Slint.Timer
color
length
physical_length
duration
angle
struct object
array
You might also like...
OpenAI Gym bindings for Rust
OpenAI Gym bindings for Rust

gym-rs OpenAI gym binding for Rust. Actively maintained! If you have any problem just create an issue. Install Just install the requierements layed ou

High-level non-blocking Deno bindings to the rust-bert machine learning crate.

bertml High-level non-blocking Deno bindings to the rust-bert machine learning crate. Guide Introduction The ModelManager class manages the FFI bindin

An example of using TensorFlow rust bindings to serve trained machine learning models via Actix Web
An example of using TensorFlow rust bindings to serve trained machine learning models via Actix Web

Serving TensorFlow with Actix-Web This repository gives an example of training a machine learning model using TensorFlow2.0 Keras in python, exporting

Docker for PyTorch rust bindings `tch`. Example of pretrain model.

tch-rs-pretrain-example-docker Docker for PyTorch rust bindings tch-rs. Example of pretrain model. Docker files support the following install libtorch

Rust language bindings for the LIBLINEAR C/C++ library.

liblinear-rs Rust bindings for the liblinear C/C++ library. Provides a thin (but rustic) wrapper around the original C-interface exposed by the librar

mxnet Rust Bindings

mxnet Rust Bindings This is a work in progress. Contributions gladly accepted! The mxnet crate defines a high-level Rust API for mxnet using the mxnet

Rust bindings for darknet

Rust bindings for darknet Darknet: Convolutional Neural Networks todo rewrite the demo function used in yolo.c in rust Examples Link existing files an

A fast, safe and easy to use reinforcement learning framework in Rust.
A fast, safe and easy to use reinforcement learning framework in Rust.

RSRL (api) Reinforcement learning should be fast, safe and easy to use. Overview rsrl provides generic constructs for reinforcement learning (RL) expe

A plugin for Jupyter Notebooks that shows you its energy use.

Jupyter Energy Jupyter Notebooks are a data science tool mostly used for statistics and machine learning, some of the most energy-intensive computing

Releases(v1.2.21)
Owner
Matheus Castello
Just another transient being
Matheus Castello
NEATeRS is a library for training a genetic neural net through reinforcement learning.

NEATeRS NEATeRS is a library for training a genetic neural net through reinforcement learning. It uses the NEAT algorithm developed by Ken Stanley whi

TecTrixer 3 Nov 28, 2022
Practice repo for learning Rust. Currently going through "Rust for JavaScript Developers" course.

rust-practice ?? Practice repo for learning Rust. Directories /rust-for-js-dev Files directed towards "Rust for JavaScript Developers" course. Thank y

Sammy Samkough 0 Dec 25, 2021
💣 SMH – a computer vision project for automatic, precision mortar strike calculations in Squad

?? Squad Mortar Helper (SMH) SMH is a computer vision toy project aimed at automating mortar calculations in the game Squad Download demo.mp4 Requirem

William 18 Dec 26, 2022
A Python CLI tool that finds all third-party packages imported into your Python project

python-third-party-imports This is a Python CLI tool built with Rust that finds all third-party packages imported into your Python project. Install Yo

Maksudul Haque 24 Feb 1, 2023
Rust language bindings for TensorFlow

TensorFlow Rust provides idiomatic Rust language bindings for TensorFlow. Notice: This project is still under active development and not guaranteed to

null 4.1k Jan 1, 2023
Rust bindings for the C++ api of PyTorch.

tch-rs Rust bindings for the C++ api of PyTorch. The goal of the tch crate is to provide some thin wrappers around the C++ PyTorch api (a.k.a. libtorc

Laurent Mazare 2.3k Jan 1, 2023
Rust bindings for TensorFlow Lite

Rust bindings for TensorFlow Lite This crates provides TensorFlow Lite APIs. Please read the API documentation on docs.rs Using the interpreter from a

Boncheol Gu 84 Dec 11, 2022
Rust bindings for XGBoost.

rust-xgboost Rust bindings for the XGBoost gradient boosting library. Documentation Basic usage example: extern crate xgboost; use xgboost::{paramete

Dave Challis 79 Nov 28, 2022
Rust language bindings for Faiss

Faiss-rs This project provides Rust bindings to Faiss, the state-of-the-art vector search and clustering library. Installing as a dependency Currently

Eduardo Pinho 86 Jan 7, 2023
Locality Sensitive Hashing in Rust with Python bindings

lsh-rs (Locality Sensitive Hashing) Locality sensitive hashing can help retrieving Approximate Nearest Neighbors in sub-linear time. For more informat

Ritchie Vink 65 Jan 2, 2023