Skip to content

Latest commit

Β 

History

History
94 lines (79 loc) Β· 3.17 KB

File metadata and controls

94 lines (79 loc) Β· 3.17 KB

OpenSilver Samples

A collection of samples and templates for OpenSilver application development. Provides modularized examples of XAML, C#, data binding, MVVM and other XAML-based elements. Each sample is independently structured for easy learning and reuse.

🌐 Live Demo

Check out all examples instantly at OpenSilver Hub (temporary).

  • Real-time execution - See samples running directly in your browser
  • Interactive testing - Manipulate controls and learn how they work
  • View source code - Instantly examine XAML and C# code
  • Implementation ideas - Explore various UI patterns and implementation methods

πŸš€ Development Setup

1. Install OpenSilver

If OpenSilver is not installed, choose one of the following methods:

Method 1: Using .NET CLI

dotnet new install OpenSilver.Templates

Method 2: Visual Studio Extension Download and install the VS extension from https://opensilver.net/download-sdk within Visual Studio

2. Clone Repository

git clone https://github.com/opensilver/samples
cd samples

3. Install Visual Studio Templates

cd templates
install_templates.bat

Installed templates:

  • Showcase Template (OpenSilver) - Project template
  • Showcase Content (OpenSilver) - Item template
  • Showcase Item (OpenSilver) - Item template

4. Open Solution

cd ../src
# Open OpenSilverSample.sln in Visual Studio

πŸ—οΈ Project Structure

samples/
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ install_templates.bat
β”‚   └── vs-templates/
└── src/
    β”œβ”€β”€ OpenSilverSample.sln     # Main solution
    β”œβ”€β”€ OpenSilverSample/        # Sample project
    β”‚   └── MainPage.xaml        # Main showcase page
    └── OpenSilverSample.Browser/ # Execution project

πŸ”§ Creating New Samples

Add New Project

Right-click solution β†’ Add β†’ New Project β†’ Select "Showcase Template (OpenSilver)" Add New Project

Add New Item

Right-click project β†’ Add β†’ New Item β†’ Select "Showcase Content" or "Showcase Item" Add New Item

Integration and Testing

  1. Add new TabItem to MainPage.xaml:
<TabItem Header="MySample">
    <mysample:MySampleContent IsMenuPanelVisible="True" DefaultSelectedItemName="Basic"/>
</TabItem>
  1. Run OpenSilverSample.Browser to test

πŸ“‹ Existing Samples

  • Basic Controls: Button, ToggleButton, Slider, CheckBox, RadioButton
  • Data Controls: ComboBox, ListBox, TextBox, ProgressBar
  • Layout: Grid, StackPanel, WrapPanel, Border
  • Advanced Components: AnimatedNavigationBar, AdaptiveColumnsPanel, StaggeredPanel
  • Patterns: MVVM, Binding, DataContext, Resource

🀝 Contributing

  1. Fork the repository
  2. Clone locally and install templates
  3. Develop new samples
  4. Test thoroughly and submit Pull Request

πŸ”— Links