投稿

9月, 2020の投稿を表示しています

RepeatButton がめちゃくちゃ便利だった…orz

WPF / .Net Core3.1 / C# / Prism.Unity / Reactiveproperty 参考URL: https://stackoverflow.com/questions/47945833/button-hold-down-to-repeat-commands https://learn.microsoft.com/en-us/dotnet/api/system.windows.controls.primitives.repeatbutton?view=windowsdesktop-7.0&redirectedfrom=MSDN ボタンをMouseDown した状態で、機能を連続するリピート機能… ゴリゴリ書くところだったよ…知らない事が多くて勉強になります! Button → RepeatButton に変更して、設定2個(Delay / Interval)追加するだけでリピートしてくれるよ…楽すぎ! 変更前: <Button Content="左へ" Height="25" Width="30" Command="{Binding MoveLeftCommand}" CommandParameter="10"/> ↓ 変更後: <RepeatButton Content="左へ" Height="25" Width="30" Delay="500" Interval="100" Command="{Binding MoveLeftCommand}" CommandParameter="10"/> 半日作業が1分で終わった…orz 検索用:WPF C# .Net Core ボタン Button リピート 繰り返し やり方 WPF / .Net Core3.1 / C# / Prism....

'InitializeComponent'は現在のコンテキスト内に存在しません。の対処法

「'InitializeComponent'は現在のコンテキスト内に存在しません。」の対処法 ググると出てくるもの 1.名前空間+クラス名が、XAMLの「x:Class」と一致していない AiueoPage.xaml.csファイルの namespace 【Test.Modules.AiueoPages.Views】 と public partial class 【AiueoPage】 : UserControl が AiueoPage.xamlファイルの <UserControl x:Class="【Test.Modules.AiueoPages.Views.AiueoPage】" </pre> と一致していること 2.「bin」「obj」フォルダを削除後にリビルド  VS閉じて、全プロジェクトから消した方が無難 3.VSを閉じて開きなおす  意味があるのかないのか… このあたりが大体ヒットします。 それでもだめだった!という方は、下記の方法を試してみてください。 4.プロジェクトファイルの確認 (.net Core 3.1 の場合です。) Test.Modules.AiueoPages.csproj 正しい奴 <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> <PropertyGroup> <TargetFramework>netcoreapp3.1</TargetFramework> <UseWPF>true</UseWPF> <AssemblyName>Test.Modules.AiueoPage</AssemblyName> </PropertyGroup> <ItemGroup> <PackageReference Include="Prism.Wpf" Version="7.2.0.1422" /> </ItemGroup> </Project> 間違ってる奴 ...