-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use? #4
Comments
The reason why you get such a result is there is no styling for those components. The For example, if you add the CSS styles below to the end of the .split-container {
width: 100%;
height: 320px;
}
.spliter-bar {
background-color: blueviolet;
}
.pane-of-split-container {
display: flex;
justify-content: center;
align-items: center;
border: dashed 2px blueviolet;
} Then, you will see the result in the following screenshot. That's all. |
dotnet new blazorserver-empty -n SplitterTest
cd .\SplitterTest\
dotnet add package Toolbelt.Blazor.SplitContainer Change Pages/Index.razor to @page "/"
@using Toolbelt.Blazor.Splitter
<SplitContainer @bind-FirstPaneSize="_PaneSize">
<FirstPane>
<h1>Hello</h1>
</FirstPane>
<SecondPane>
<h1>World</h1>
</SecondPane>
</SplitContainer>
<style>
.split-container {
width: 100%;
height: 320px;
}
.spliter-bar {
background-color: blueviolet;
}
.pane-of-split-container {
display: flex;
justify-content: center;
align-items: center;
border: dashed 2px blueviolet;
}
</style>
@code {
private int _PaneSize = 80;
} dotnet run result looks like So what does it take if I want to start from empty template? |
@StevenTCramer Sorry too late. This package assumes that the application uses Blazor's CSS isolation by default. Usually, this pre-requirement is appropriate. However, unfortunately, Blazor projects made by the "empty" project template are not configured for CSS isolation. Therefore you should include the CSS file of this package by yourself in that scenario. Specifically, you should include the bundled CSS file for the project, like the following code, <!DOCTYPE html>
<html lang="en">
<head>
...
<!-- 👇 Add this line. -->
<link href="SplitterTest.styles.css" rel="stylesheet" />
.... or the CSS file for this package individually, like the following code. <!DOCTYPE html>
<html lang="en">
<head>
...
<!-- 👇 Add this line. -->
<link href="_content/Toolbelt.Blazor.SplitContainer/Toolbelt.Blazor.SplitContainer.bundle.scp.css"
rel="stylesheet" />
... See also: https://learn.microsoft.com/aspnet/core/blazor/components/css-isolation |
Add the following to
_Imports.razor
@using Toolbelt.Blazor.Splitter
Change
Pages/Index.razor
todotnet run
result looks like
The text was updated successfully, but these errors were encountered: