Some things to consider:
1.The target panel must have AllowDrop = true
this.targetPanel.AllowDrop = true;
2. Even if AllowDrop is enabled, the target must process the drop:
private void TargetPanel_DragOver(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Button)))
e.Effect = DragDropEffects.Move;
}
private void TargetPanel_DragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Button)))
{
var btn = (Button)e.Data.GetData(typeof(Button));
this.targetPanel.Controls.Add(btn);
}
}
3. Movable = true is not needed
Movable = true is for moving controls within the same container.
For dragging across containers, you must use DoDragDrop() and handle drop events.
I’ve attached a working sample where you can drag a button from one panel to another, hope this helps!
Can you please include a compliable test case? Delete the bin and obj folders before posting.
Sure. Create a static manager class, fire a static event when the data needs to be updated. The clients simply attach to the static event. When fired they will all be invoked since events are multicast.
When handling the event make sure to use Apolicatio.Update() or RunInContext. You will find more info in the docs.
Create a blank new Wisej-4 project using the provided templates. It will create a sample for you with a couple of clicks. There are also dozens of samples in github.
This is a typical startup.cs with app.UseWisej();
https://github.com/iceteagroup/wisej-examples/blob/4.0/MDIExample/MDIExample/Startup.cs
In your solution there is no main method, the launchsettings doesn’t have true for launching the browser, the start url is wrong, there is no call to app.Run(), the web.config is setup incorrectly for IIS instead of Kestrel (see comments in the one we provide). It doesn’t work with asp.net core regardless of wisej.net. If you copy the correct startup method it will work. We provide everything you need to make it work correctly.
https://dotnettutorials.net/lesson/asp-net-core-main-method/
https://stackify.com/how-to-deploy-asp-net-core-to-iis/ <– this works only when deploying in IIS, doesn’t work with Kestrel. This is all standard asp.net core.
Wisej is a .NET Core middleware, which is typically added using UseWisej() (not AddWisej).
Create a new project using the provided templates and attach a new blank Wisej 4 project (without net48) that runs and opens a simple page with a label and a button. Look at the running project to see the setup, which is all standard net core and asp.net core.
It’s a dependency issue, not a Wisej issue.
The reason why it works in a console app and not in a Wisej app is because of this line here <Project Sdk="Microsoft.NET.Sdk.Web">
What this line does is that it essentially imports what is called a metapackage implicitly, named Microsoft.AspNetCore.App , and Microsoft.Extensions.Logging.Abstractions is part of it.
To fix it, add this to web.config:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-9.9.9.9" newVersion="8.0.0.2"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-9.9.9.9" newVersion="6.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Hi Ivan,
themes are identical but new themes may only be published for 4.x
Best regards
Frank
This only happens EVERY OTHER TIME. Once the error occurs, I click the Stop Button and immediately restart the app and it ALWAYS runs correctly (the second time).
If this is true: “There is no Application, no Configuration and no Session available when initializing statics.” how is it running correctly the second time?
Screen shot of error. This is the exact line of code where the error occurs EVERY OTHER TIME.
Hi Jean,
we need a test case to see your code. What does “crash” mean? Do you get an exception.
Best regards
Frank
Excellent – defined in the themes file! Thanks so much!
Using an ImageList for single buttons is a neat trick 😉
It can be changed globally via the theme:
Locate the button appearance in your theme and modify the iconSize property within its properties section for the default state:
Code
"button": {
"states": {
"default": {
"properties": {
"iconSize": {
"width": 64,
"height": 64
}
}
}
}
}
It can be changed locally (for a single button) using an ImageList
1. Add an ImageList component to your form or component.
2. Set the desired ImageSize property on the ImageList component (e.g., new Size(32, 32)).
3.Assign this ImageList component to the ImageList property of the Button control. The button will then automatically resize any image assigned to its Image property to match the ImageSize defined in the ImageList, even if the image is not explicitly added to the ImageList itself.
See attached sample.
Still facing the same problems. Any other idea? Our solutions are integrated with several independent projects (class libraries, ui projects, etc).
You can simply check the nuget package in the Solution Explorer.
Expand Dependencies, then either net481, net8.0, or net8.0-windows (any of them work). then expand Packages. See screenshot.
OK,
please ignore, found that this issues was fixed in 3.5.18 version
Hi Rene,
my initial answer was wrong or not entirely correct.
Some shortcuts can be overridden with Accelerators.
Please find attached a sample for CTRL+S that seems to be working in Chrome, Firefox, IE and Edge.
But you might test around a bit to see if your shortcut works in your target browsers.
Best regards
Frank
Hi Justice,
we can’t work on this spare information. Please provide more details about your application and setup.
Is it failing inside Visual Studio? On a deployed version (IIS?)? Windows? Linux? etc.
If it’s on a deployed server you might find this useful:
https://docs.wisej.com/deployment
Best regards
Frank
Hi Rene,
short answer: You can’t. It’s up to the browser to handle these shortcuts before they even reach the web application.
So only way is to search for browser setup options.
Best regards
Frank
Make sure that you have included the Wisej2 (or Wisej3) nuget package in your project. Check your .csproj file, there should be a line that looks something like this:
<ItemGroup>
<PackageReference Include="Wisej-3" Version="3.5.*" />
<PackageReference Include="System.Data.SqlClient" Version="4.*" />
</ItemGroup>
You can do this by using accelerators and the ClientClipboard extension.
Make sure to install the ClientClipboard extension using nuget.
To create an accelerator, open the Page in the designer and go the the Page properties. Click on the 3 dots by “Accelerators” and click “Add”. Click on the dropdown arrow and click the box for ctrl and set the key to C. See attached picture.
Once that’s set up, go to the lightning bolt to open the events for the page. Add an “Accelerator” event. It should be called Accelerator_CtrlC
Then paste this code in the accelerator event:
private async void Accelerator_CtrlC(object sender, AcceleratorEventArgs e)
{
if (dataGridView1.CurrentCell != null)
{
var value = dataGridView1.CurrentCell.Value?.ToString();
await ClientClipboard.WriteTextAsync(value);
}
}
I’ve attached a working sample here.
