├── .gitignore
├── LICENSE
├── README.md
├── Test
├── App.xaml
├── App.xaml.cs
├── AssemblyInfo.cs
├── Behaviors
│ └── RaiseMousePositionBehavior.cs
├── Test.csproj
├── Utilities
│ └── ViewModelCommandHandler.cs
├── ViewModels
│ └── MainWindowViewModel.cs
└── Views
│ ├── MainWindow.xaml
│ └── MainWindow.xaml.cs
├── TimelineEditor.sln
└── TimelineEditor
├── AssemblyInfo.cs
├── Controls
├── TimelineKey.cs
├── TimelineLaneCanvas.cs
├── TimelineMarker.cs
├── TimelineRangeSelector.cs
└── TimelineRuler.cs
├── Converters
├── AdjustConverter.cs
└── StaticBaseConverter.cs
├── Define.cs
├── Timeline.csproj
├── TimelineEditor.xaml
├── TimelineEditor.xaml.cs
└── Utilities
├── Collector.cs
└── FrameworkElementFinder.cs
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Aa][Rr][Mm]/
27 | [Aa][Rr][Mm]64/
28 | bld/
29 | [Bb]in/
30 | [Oo]bj/
31 | [Ll]og/
32 | [Ll]ogs/
33 |
34 | # Visual Studio 2015/2017 cache/options directory
35 | .vs/
36 | # Uncomment if you have tasks that create the project's static files in wwwroot
37 | #wwwroot/
38 |
39 | # Visual Studio 2017 auto generated files
40 | Generated\ Files/
41 |
42 | # MSTest test Results
43 | [Tt]est[Rr]esult*/
44 | [Bb]uild[Ll]og.*
45 |
46 | # NUnit
47 | *.VisualState.xml
48 | TestResult.xml
49 | nunit-*.xml
50 |
51 | # Build Results of an ATL Project
52 | [Dd]ebugPS/
53 | [Rr]eleasePS/
54 | dlldata.c
55 |
56 | # Benchmark Results
57 | BenchmarkDotNet.Artifacts/
58 |
59 | # .NET Core
60 | project.lock.json
61 | project.fragment.lock.json
62 | artifacts/
63 |
64 | # StyleCop
65 | StyleCopReport.xml
66 |
67 | # Files built by Visual Studio
68 | *_i.c
69 | *_p.c
70 | *_h.h
71 | *.ilk
72 | *.meta
73 | *.obj
74 | *.iobj
75 | *.pch
76 | *.pdb
77 | *.ipdb
78 | *.pgc
79 | *.pgd
80 | *.rsp
81 | *.sbr
82 | *.tlb
83 | *.tli
84 | *.tlh
85 | *.tmp
86 | *.tmp_proj
87 | *_wpftmp.csproj
88 | *.log
89 | *.vspscc
90 | *.vssscc
91 | .builds
92 | *.pidb
93 | *.svclog
94 | *.scc
95 |
96 | # Chutzpah Test files
97 | _Chutzpah*
98 |
99 | # Visual C++ cache files
100 | ipch/
101 | *.aps
102 | *.ncb
103 | *.opendb
104 | *.opensdf
105 | *.sdf
106 | *.cachefile
107 | *.VC.db
108 | *.VC.VC.opendb
109 |
110 | # Visual Studio profiler
111 | *.psess
112 | *.vsp
113 | *.vspx
114 | *.sap
115 |
116 | # Visual Studio Trace Files
117 | *.e2e
118 |
119 | # TFS 2012 Local Workspace
120 | $tf/
121 |
122 | # Guidance Automation Toolkit
123 | *.gpState
124 |
125 | # ReSharper is a .NET coding add-in
126 | _ReSharper*/
127 | *.[Rr]e[Ss]harper
128 | *.DotSettings.user
129 |
130 | # TeamCity is a build add-in
131 | _TeamCity*
132 |
133 | # DotCover is a Code Coverage Tool
134 | *.dotCover
135 |
136 | # AxoCover is a Code Coverage Tool
137 | .axoCover/*
138 | !.axoCover/settings.json
139 |
140 | # Visual Studio code coverage results
141 | *.coverage
142 | *.coveragexml
143 |
144 | # NCrunch
145 | _NCrunch_*
146 | .*crunch*.local.xml
147 | nCrunchTemp_*
148 |
149 | # MightyMoose
150 | *.mm.*
151 | AutoTest.Net/
152 |
153 | # Web workbench (sass)
154 | .sass-cache/
155 |
156 | # Installshield output folder
157 | [Ee]xpress/
158 |
159 | # DocProject is a documentation generator add-in
160 | DocProject/buildhelp/
161 | DocProject/Help/*.HxT
162 | DocProject/Help/*.HxC
163 | DocProject/Help/*.hhc
164 | DocProject/Help/*.hhk
165 | DocProject/Help/*.hhp
166 | DocProject/Help/Html2
167 | DocProject/Help/html
168 |
169 | # Click-Once directory
170 | publish/
171 |
172 | # Publish Web Output
173 | *.[Pp]ublish.xml
174 | *.azurePubxml
175 | # Note: Comment the next line if you want to checkin your web deploy settings,
176 | # but database connection strings (with potential passwords) will be unencrypted
177 | *.pubxml
178 | *.publishproj
179 |
180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
181 | # checkin your Azure Web App publish settings, but sensitive information contained
182 | # in these scripts will be unencrypted
183 | PublishScripts/
184 |
185 | # NuGet Packages
186 | *.nupkg
187 | # NuGet Symbol Packages
188 | *.snupkg
189 | # The packages folder can be ignored because of Package Restore
190 | **/[Pp]ackages/*
191 | # except build/, which is used as an MSBuild target.
192 | !**/[Pp]ackages/build/
193 | # Uncomment if necessary however generally it will be regenerated when needed
194 | #!**/[Pp]ackages/repositories.config
195 | # NuGet v3's project.json files produces more ignorable files
196 | *.nuget.props
197 | *.nuget.targets
198 |
199 | # Microsoft Azure Build Output
200 | csx/
201 | *.build.csdef
202 |
203 | # Microsoft Azure Emulator
204 | ecf/
205 | rcf/
206 |
207 | # Windows Store app package directories and files
208 | AppPackages/
209 | BundleArtifacts/
210 | Package.StoreAssociation.xml
211 | _pkginfo.txt
212 | *.appx
213 | *.appxbundle
214 | *.appxupload
215 |
216 | # Visual Studio cache files
217 | # files ending in .cache can be ignored
218 | *.[Cc]ache
219 | # but keep track of directories ending in .cache
220 | !?*.[Cc]ache/
221 |
222 | # Others
223 | ClientBin/
224 | ~$*
225 | *~
226 | *.dbmdl
227 | *.dbproj.schemaview
228 | *.jfm
229 | *.pfx
230 | *.publishsettings
231 | orleans.codegen.cs
232 |
233 | # Including strong name files can present a security risk
234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
235 | #*.snk
236 |
237 | # Since there are multiple workflows, uncomment next line to ignore bower_components
238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
239 | #bower_components/
240 |
241 | # RIA/Silverlight projects
242 | Generated_Code/
243 |
244 | # Backup & report files from converting an old project file
245 | # to a newer Visual Studio version. Backup files are not needed,
246 | # because we have git ;-)
247 | _UpgradeReport_Files/
248 | Backup*/
249 | UpgradeLog*.XML
250 | UpgradeLog*.htm
251 | ServiceFabricBackup/
252 | *.rptproj.bak
253 |
254 | # SQL Server files
255 | *.mdf
256 | *.ldf
257 | *.ndf
258 |
259 | # Business Intelligence projects
260 | *.rdl.data
261 | *.bim.layout
262 | *.bim_*.settings
263 | *.rptproj.rsuser
264 | *- [Bb]ackup.rdl
265 | *- [Bb]ackup ([0-9]).rdl
266 | *- [Bb]ackup ([0-9][0-9]).rdl
267 |
268 | # Microsoft Fakes
269 | FakesAssemblies/
270 |
271 | # GhostDoc plugin setting file
272 | *.GhostDoc.xml
273 |
274 | # Node.js Tools for Visual Studio
275 | .ntvs_analysis.dat
276 | node_modules/
277 |
278 | # Visual Studio 6 build log
279 | *.plg
280 |
281 | # Visual Studio 6 workspace options file
282 | *.opt
283 |
284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
285 | *.vbw
286 |
287 | # Visual Studio LightSwitch build output
288 | **/*.HTMLClient/GeneratedArtifacts
289 | **/*.DesktopClient/GeneratedArtifacts
290 | **/*.DesktopClient/ModelManifest.xml
291 | **/*.Server/GeneratedArtifacts
292 | **/*.Server/ModelManifest.xml
293 | _Pvt_Extensions
294 |
295 | # Paket dependency manager
296 | .paket/paket.exe
297 | paket-files/
298 |
299 | # FAKE - F# Make
300 | .fake/
301 |
302 | # CodeRush personal settings
303 | .cr/personal
304 |
305 | # Python Tools for Visual Studio (PTVS)
306 | __pycache__/
307 | *.pyc
308 |
309 | # Cake - Uncomment if you are using it
310 | # tools/**
311 | # !tools/packages.config
312 |
313 | # Tabs Studio
314 | *.tss
315 |
316 | # Telerik's JustMock configuration file
317 | *.jmconfig
318 |
319 | # BizTalk build output
320 | *.btp.cs
321 | *.btm.cs
322 | *.odx.cs
323 | *.xsd.cs
324 |
325 | # OpenCover UI analysis results
326 | OpenCover/
327 |
328 | # Azure Stream Analytics local run output
329 | ASALocalRun/
330 |
331 | # MSBuild Binary and Structured Log
332 | *.binlog
333 |
334 | # NVidia Nsight GPU debugger configuration file
335 | *.nvuser
336 |
337 | # MFractors (Xamarin productivity tool) working folder
338 | .mfractor/
339 |
340 | # Local History for Visual Studio
341 | .localhistory/
342 |
343 | # BeatPulse healthcheck temp database
344 | healthchecksdb
345 |
346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
347 | MigrationBackup/
348 |
349 | # Ionide (cross platform F# VS Code tools) working folder
350 | .ionide/
351 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Jinten
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TimelineEditor
2 | TimelineEditor in WPF.
3 |
4 | 
5 |
6 | ## Environment
7 |
8 | - VisualStudio 2022 Version 4.8.04081
9 | - .NET 6.0
10 |
11 |
12 | You need to install LivetCast from Nuget.
13 |
--------------------------------------------------------------------------------
/Test/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Test/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace Test
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Test/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/Test/Behaviors/RaiseMousePositionBehavior.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Xaml.Behaviors;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Input;
9 |
10 | namespace Test.Behaviors
11 | {
12 | public class RaiseMousePositionBehavior : Behavior
13 | {
14 | public double PositionX
15 | {
16 | get => (double)GetValue(PositionXProperty);
17 | set => SetValue(PositionXProperty, value);
18 | }
19 | public static readonly DependencyProperty PositionXProperty = DependencyProperty.Register(
20 | nameof(PositionX), typeof(double), typeof(RaiseMousePositionBehavior), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
21 |
22 | public double PositionY
23 | {
24 | get => (double)GetValue(PositionYProperty);
25 | set => SetValue(PositionYProperty, value);
26 | }
27 | public static readonly DependencyProperty PositionYProperty = DependencyProperty.Register(
28 | nameof(PositionY), typeof(double), typeof(RaiseMousePositionBehavior), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
29 |
30 | public ICommand MouseRightButtonDownCommand
31 | {
32 | get => (ICommand)GetValue(MouseRightButtonDownCommandProperty);
33 | set => SetValue(MouseRightButtonDownCommandProperty, value);
34 | }
35 | public static readonly DependencyProperty MouseRightButtonDownCommandProperty = DependencyProperty.Register(
36 | nameof(MouseRightButtonDownCommand), typeof(ICommand), typeof(RaiseMousePositionBehavior), new PropertyMetadata(null));
37 |
38 | public ICommand PreviewMouseRightButtonDownCommand
39 | {
40 | get => (ICommand)GetValue(PreviewMouseRightButtonDownCommandProperty);
41 | set => SetValue(PreviewMouseRightButtonDownCommandProperty, value);
42 | }
43 | public static readonly DependencyProperty PreviewMouseRightButtonDownCommandProperty = DependencyProperty.Register(
44 | nameof(PreviewMouseRightButtonDownCommand), typeof(ICommand), typeof(RaiseMousePositionBehavior), new PropertyMetadata(null));
45 |
46 | protected override void OnAttached()
47 | {
48 | base.OnAttached();
49 |
50 | AssociatedObject.MouseRightButtonDown += AssociatedObject_MouseRightButtonDown;
51 | AssociatedObject.PreviewMouseRightButtonDown += AssociatedObject_PreviewMouseRightButtonDown;
52 | }
53 |
54 | protected override void OnDetaching()
55 | {
56 | base.OnDetaching();
57 |
58 | AssociatedObject.PreviewMouseRightButtonDown -= AssociatedObject_PreviewMouseRightButtonDown;
59 | AssociatedObject.MouseRightButtonDown -= AssociatedObject_MouseRightButtonDown;
60 | }
61 |
62 | private void AssociatedObject_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
63 | {
64 | if (MouseRightButtonDownCommand == null)
65 | {
66 | return;
67 | }
68 |
69 | if (MouseRightButtonDownCommand.CanExecute(e))
70 | {
71 | var pos = e.GetPosition(AssociatedObject);
72 | MouseRightButtonDownCommand.Execute(pos);
73 | }
74 | }
75 |
76 | private void AssociatedObject_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
77 | {
78 | if (PreviewMouseRightButtonDownCommand == null)
79 | {
80 | return;
81 | }
82 |
83 | if (PreviewMouseRightButtonDownCommand.CanExecute(e))
84 | {
85 | var pos = e.GetPosition(AssociatedObject);
86 | PreviewMouseRightButtonDownCommand.Execute(pos);
87 | }
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/Test/Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net6.0-windows
6 | enable
7 | true
8 | Test.App
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Never
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Test/Utilities/ViewModelCommandHandler.cs:
--------------------------------------------------------------------------------
1 | using Livet.Commands;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Input;
8 |
9 | namespace Test.Utilities
10 | {
11 | ///
12 | /// 任意の型の引数を1つ受け付けるRelayCommand
13 | ///
14 | ///
15 | public class RelayCommand : ICommand
16 | {
17 | Action ExecuteAction { get; }
18 | Func? CanExecuteFunc { get; }
19 |
20 | ///
21 | /// RaiseCanExecuteChanged が呼び出されたときに生成されます。
22 | ///
23 | public event EventHandler? CanExecuteChanged;
24 |
25 | ///
26 | /// 常に実行可能な新しいコマンドを作成します。
27 | ///
28 | /// 実行ロジック。
29 | public RelayCommand(Action execute)
30 | : this(execute, null)
31 | {
32 | }
33 |
34 | ///
35 | /// 新しいコマンドを作成します。
36 | ///
37 | /// 実行ロジック。
38 | /// 実行ステータス ロジック。
39 | public RelayCommand(Action execute, Func? canExecute)
40 | {
41 | if (execute == null)
42 | {
43 | throw new ArgumentNullException("execute");
44 | }
45 |
46 | ExecuteAction = execute;
47 | CanExecuteFunc = canExecute;
48 | }
49 |
50 | ///
51 | /// 現在の状態でこの が実行できるかどうかを判定します。
52 | ///
53 | ///
54 | /// コマンドによって使用されるデータ。コマンドが、データの引き渡しを必要としない場合、このオブジェクトを null に設定できます。
55 | ///
56 | /// このコマンドが実行可能な場合は true、それ以外の場合は false。
57 | public bool CanExecute(object? parameter)
58 | {
59 | return CanExecuteFunc == null || CanExecuteFunc((T?)parameter);
60 | }
61 |
62 | ///
63 | /// 現在のコマンド ターゲットに対して を実行します。
64 | ///
65 | ///
66 | /// コマンドによって使用されるデータ。コマンドが、データの引き渡しを必要としない場合、このオブジェクトを null に設定できます。
67 | ///
68 | public void Execute(object? parameter)
69 | {
70 | ExecuteAction((T?)parameter);
71 | }
72 |
73 | ///
74 | /// イベントを発生させるために使用されるメソッド
75 | /// の戻り値を表すために
76 | /// メソッドが変更されました。
77 | ///
78 | public void RaiseCanExecuteChanged()
79 | {
80 | CanExecuteChanged?.Invoke(this, EventArgs.Empty);
81 | }
82 | }
83 |
84 | public class ViewModelCommandHandler
85 | {
86 | public ViewModelCommand Get(Action execute, Func? canExecute = null)
87 | {
88 | if (_Command == null)
89 | {
90 | _Command = new ViewModelCommand(execute, canExecute);
91 | }
92 | return _Command;
93 | }
94 |
95 | ViewModelCommand? _Command = null;
96 | }
97 |
98 | public class ViewModelCommandHandler
99 | {
100 | // CanExecuteがないやつは、とりあえずListenerCommandに任せる
101 | public ListenerCommand Get(Action execute)
102 | {
103 | if (_ListenerCommand == null)
104 | {
105 | _ListenerCommand = new ListenerCommand(execute, null);
106 | }
107 | return _ListenerCommand;
108 | }
109 |
110 | public RelayCommand Get(Action execute, Func canExecute)
111 | {
112 | if (_RelayCommand == null)
113 | {
114 | _RelayCommand = new RelayCommand(execute, canExecute);
115 | }
116 | return _RelayCommand;
117 | }
118 |
119 | public ListenerCommand Get(Action execute, Func canExecute)
120 | {
121 | if (_ListenerCommand == null)
122 | {
123 | _ListenerCommand = new ListenerCommand(execute, canExecute);
124 | }
125 | return _ListenerCommand;
126 | }
127 |
128 | RelayCommand? _RelayCommand = null;
129 | ListenerCommand? _ListenerCommand = null;
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/Test/ViewModels/MainWindowViewModel.cs:
--------------------------------------------------------------------------------
1 | using Livet;
2 | using Livet.Commands;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Collections.ObjectModel;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows;
10 | using Test.Utilities;
11 |
12 | namespace Test.ViewModels
13 | {
14 | public class TimelineKeyViewModel : ViewModel
15 | {
16 | public double PlacementPosition
17 | {
18 | get => _PlacementPosition;
19 | set => RaisePropertyChangedIfSet(ref _PlacementPosition, value);
20 | }
21 | double _PlacementPosition = 0;
22 |
23 | public bool IsSelected
24 | {
25 | get => _IsSelected;
26 | set => RaisePropertyChangedIfSet(ref _IsSelected, value);
27 | }
28 | bool _IsSelected = true;
29 |
30 | public TimelineKeyViewModel(double position)
31 | {
32 | PlacementPosition = position;
33 | }
34 | }
35 |
36 | public class TrackItemViewModel : ViewModel
37 | {
38 | public string Name
39 | {
40 | get => _Name;
41 | set => RaisePropertyChangedIfSet(ref _Name, value);
42 | }
43 | string _Name = string.Empty;
44 |
45 | public bool IsSelected
46 | {
47 | get => _IsSelected;
48 | set => RaisePropertyChangedIfSet(ref _IsSelected, value);
49 | }
50 | bool _IsSelected;
51 |
52 | public IEnumerable Keys => _Keys;
53 | ObservableCollection _Keys = new ObservableCollection();
54 |
55 | public ViewModelCommand AddKeyCommand => _AddKeyCommand.Get(AddKey, () => Owner.IsPlaying == false);
56 | ViewModelCommandHandler _AddKeyCommand = new ViewModelCommandHandler();
57 |
58 | public ViewModelCommand AddKeyWithDoubleClickCommand => _AddKeyWithDoubleClickCommand.Get(AddKeyWithDoubleClick, () => Owner.IsPlaying == false);
59 | ViewModelCommandHandler _AddKeyWithDoubleClickCommand = new ViewModelCommandHandler();
60 |
61 |
62 | MainWindowViewModel Owner { get; }
63 |
64 | public TrackItemViewModel(string name, MainWindowViewModel owner)
65 | {
66 | Name = name;
67 | Owner = owner;
68 |
69 | CompositeDisposable.Add(() =>
70 | {
71 | foreach(var key in _Keys)
72 | {
73 | key.Dispose();
74 | }
75 | });
76 | }
77 |
78 | public void RaiseCanExecuteCommand()
79 | {
80 | AddKeyCommand.RaiseCanExecuteChanged();
81 | AddKeyWithDoubleClickCommand.RaiseCanExecuteChanged();
82 | }
83 |
84 | public void AddKey()
85 | {
86 | var key = new TimelineKeyViewModel(Owner.ContextMenuOpeningPosition.X);
87 | AddKey(key);
88 | }
89 |
90 | public void AddKeyWithDoubleClick()
91 | {
92 | var key = new TimelineKeyViewModel(Owner.MousePositionOnTimelineLane.X);
93 | AddKey(key);
94 | }
95 |
96 | public void AddKey(TimelineKeyViewModel vm)
97 | {
98 | foreach(var key in _Keys)
99 | {
100 | key.IsSelected = false;
101 | }
102 | _Keys.Add(vm);
103 | }
104 |
105 | public void DeleteSelectedKeys()
106 | {
107 | var removeKeys = _Keys.Where(arg => arg.IsSelected).ToArray();
108 |
109 | foreach(var removeKey in removeKeys)
110 | {
111 | removeKey.Dispose();
112 | _Keys.Remove(removeKey);
113 | }
114 | }
115 | }
116 |
117 | public class MainWindowViewModel : ViewModel
118 | {
119 | public IEnumerable Tracks => _Tracks;
120 | ObservableCollection _Tracks = new ObservableCollection();
121 |
122 | public ViewModelCommand AddTrackCommand => _AddTrackCommand.Get(AddTrack);
123 | ViewModelCommandHandler _AddTrackCommand = new ViewModelCommandHandler();
124 |
125 | public ViewModelCommand RemoveTracksCommand => _RemoveTracksCommand.Get(RemoveTracks);
126 | ViewModelCommandHandler _RemoveTracksCommand = new ViewModelCommandHandler();
127 |
128 | public ViewModelCommand AddKeyCommand => _AddKeyCommand.Get(AddKey);
129 | ViewModelCommandHandler _AddKeyCommand = new ViewModelCommandHandler();
130 |
131 | public ListenerCommand BeginKeyMovingCommand => _BeginKeyMovingCommand.Get(BeginKeyMoving);
132 | ViewModelCommandHandler _BeginKeyMovingCommand = new ViewModelCommandHandler();
133 |
134 | public ListenerCommand KeyMovingCommand => _KeyMovingCommand.Get(KeyMoving);
135 | ViewModelCommandHandler _KeyMovingCommand = new ViewModelCommandHandler();
136 |
137 | public ListenerCommand EndKeyMovingCommand => _EndKeyMovingCommand.Get(EndKeyMoving);
138 | ViewModelCommandHandler _EndKeyMovingCommand = new ViewModelCommandHandler();
139 |
140 | public ViewModelCommand LaneClickedCommand => _LaneClickedCommand.Get(LaneClicked);
141 | ViewModelCommandHandler _LaneClickedCommand = new ViewModelCommandHandler();
142 |
143 | public ViewModelCommand DeleteOnTrackCommand => _DeleteOnTrackCommand.Get(DeleteOnTrack);
144 | ViewModelCommandHandler _DeleteOnTrackCommand = new ViewModelCommandHandler();
145 |
146 | public ViewModelCommand DeleteOnLaneCommand => _DeleteOnLaneCommand.Get(DeleteOnLane);
147 | ViewModelCommandHandler _DeleteOnLaneCommand = new ViewModelCommandHandler();
148 |
149 | public ViewModelCommand SwitchPlayingStateCommand => _SwitchPlayingStateCommand.Get(SwitchPlayingState);
150 | ViewModelCommandHandler _SwitchPlayingStateCommand = new ViewModelCommandHandler();
151 |
152 | public ViewModelCommand ResetTimeCommand => _ResetTimeCommand.Get(ResetTime);
153 | ViewModelCommandHandler _ResetTimeCommand = new ViewModelCommandHandler();
154 |
155 | public bool IsPlaying
156 | {
157 | get => _IsPlaying;
158 | set => RaisePropertyChangedIfSet(ref _IsPlaying, value);
159 | }
160 | bool _IsPlaying;
161 |
162 | public bool IsDisplayMarkerAlways
163 | {
164 | get => _IsDisplayMarkerAlways;
165 | set => RaisePropertyChangedIfSet(ref _IsDisplayMarkerAlways, value);
166 | }
167 | bool _IsDisplayMarkerAlways;
168 |
169 | public double CurrentTime
170 | {
171 | get => _CurrentTime;
172 | set => RaisePropertyChangedIfSet(ref _CurrentTime, value);
173 | }
174 | double _CurrentTime = 0;
175 |
176 | public Point MousePositionOnTimelineLane
177 | {
178 | get => _MousePositionOnTimelineLane;
179 | set => RaisePropertyChangedIfSet(ref _MousePositionOnTimelineLane, value);
180 | }
181 | Point _MousePositionOnTimelineLane;
182 |
183 | public Point ContextMenuOpeningPosition
184 | {
185 | get => _ContextMenuOpeningPosition;
186 | set => RaisePropertyChangedIfSet(ref _ContextMenuOpeningPosition, value);
187 | }
188 | Point _ContextMenuOpeningPosition;
189 |
190 | Point _CapturedBaseKeyPosition = new Point(0, 0);
191 |
192 | TimelineKeyViewModel[]? _SelectedKeyVMs = null;
193 | double[]? _SelectedKeyOffsetPlacements = null;
194 |
195 | public MainWindowViewModel()
196 | {
197 | // ViewModelCommand.RaiseCanExecuteChangedの実行に必要
198 | DispatcherHelper.UIDispatcher = Application.Current.Dispatcher;
199 |
200 | var test1Lane = new TrackItemViewModel("test1", this);
201 | test1Lane.AddKey();
202 | test1Lane.Keys.ElementAt(0).IsSelected = true;
203 |
204 | _Tracks.Add(test1Lane);
205 | _Tracks.Add(new TrackItemViewModel("test2", this));
206 | }
207 |
208 | void AddTrack()
209 | {
210 | _Tracks.Add(new TrackItemViewModel($"test{_Tracks.Count}", this));
211 | }
212 |
213 | void RemoveTracks()
214 | {
215 | var removeTracks = _Tracks.Where(arg => arg.IsSelected).ToArray();
216 |
217 | foreach (var removeTrack in removeTracks)
218 | {
219 | _Tracks.Remove(removeTrack);
220 | }
221 | }
222 |
223 | public void AddKey()
224 | {
225 | var addKeyTracks = _Tracks.Where(arg => arg.IsSelected);
226 |
227 | foreach(var addKeyTrack in addKeyTracks)
228 | {
229 | var key = new TimelineKeyViewModel(ContextMenuOpeningPosition.X);
230 | addKeyTrack.AddKey(key);
231 | }
232 | }
233 |
234 | void BeginKeyMoving(Point pos)
235 | {
236 | _CapturedBaseKeyPosition = pos;
237 | _SelectedKeyVMs = _Tracks.SelectMany(arg => arg.Keys.Where(key => key.IsSelected)).ToArray();
238 | _SelectedKeyOffsetPlacements = _SelectedKeyVMs.Select(arg => arg.PlacementPosition).ToArray();
239 | }
240 |
241 | void KeyMoving(Point pos)
242 | {
243 | if(_SelectedKeyVMs == null || _SelectedKeyOffsetPlacements == null)
244 | {
245 | throw new InvalidProgramException();
246 | }
247 |
248 | var delta = pos.X - _CapturedBaseKeyPosition.X;
249 | for(int i=0; i<_SelectedKeyVMs.Length; i++)
250 | {
251 | var key = _SelectedKeyVMs[i];
252 | var offset = _SelectedKeyOffsetPlacements[i];
253 | key.PlacementPosition = offset + delta;
254 | }
255 | }
256 |
257 | void EndKeyMoving(Point pos)
258 | {
259 | _SelectedKeyVMs = null;
260 | _SelectedKeyOffsetPlacements = null;
261 | }
262 |
263 | void LaneClicked()
264 | {
265 | foreach(var key in _Tracks.SelectMany(arg => arg.Keys))
266 | {
267 | key.IsSelected = false;
268 | }
269 | }
270 |
271 | void DeleteOnTrack()
272 | {
273 | var removeTracks = _Tracks.Where(arg => arg.IsSelected).ToArray();
274 | foreach(var removeTrack in removeTracks)
275 | {
276 | removeTrack.Dispose();
277 | _Tracks.Remove(removeTrack);
278 | }
279 | }
280 |
281 | void DeleteOnLane()
282 | {
283 | foreach (var track in _Tracks)
284 | {
285 | track.DeleteSelectedKeys();
286 | }
287 | }
288 |
289 | void SwitchPlayingState()
290 | {
291 | IsPlaying = !IsPlaying;
292 |
293 | foreach (var track in _Tracks)
294 | {
295 | track.RaiseCanExecuteCommand();
296 | }
297 | }
298 |
299 | void ResetTime()
300 | {
301 | CurrentTime = 0;
302 | }
303 | }
304 | }
305 |
--------------------------------------------------------------------------------
/Test/Views/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
81 |
82 |
83 |
84 |
94 |
95 |
96 |
97 |
114 |
115 |
116 |
117 |
136 |
137 |
138 |
139 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
--------------------------------------------------------------------------------
/Test/Views/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace Test.Views
17 | {
18 | ///
19 | /// Interaction logic for MainWindow.xaml
20 | ///
21 | public partial class MainWindow : Window
22 | {
23 | public MainWindow()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/TimelineEditor.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.0.31919.166
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Timeline", "TimelineEditor\Timeline.csproj", "{26C72611-F638-469A-B572-BEC4493ADA55}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test", "Test\Test.csproj", "{58251011-C7DB-444C-AF93-3BC0E55C62F0}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {26C72611-F638-469A-B572-BEC4493ADA55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {26C72611-F638-469A-B572-BEC4493ADA55}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {26C72611-F638-469A-B572-BEC4493ADA55}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {26C72611-F638-469A-B572-BEC4493ADA55}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {58251011-C7DB-444C-AF93-3BC0E55C62F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {58251011-C7DB-444C-AF93-3BC0E55C62F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {58251011-C7DB-444C-AF93-3BC0E55C62F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {58251011-C7DB-444C-AF93-3BC0E55C62F0}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {E4EFA5A3-C597-49A1-A72F-C912AAE506C2}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/TimelineEditor/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/TimelineEditor/Controls/TimelineKey.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 |
13 | namespace Timeline.Controls
14 | {
15 | public class TimelineKey : ContentControl
16 | {
17 | public double PlacementPosition
18 | {
19 | get => (double)GetValue(PlacementPositionProperty);
20 | set => SetValue(PlacementPositionProperty, value);
21 | }
22 | public static readonly DependencyProperty PlacementPositionProperty =
23 | DependencyProperty.Register(nameof(PlacementPosition), typeof(double), typeof(TimelineKey),
24 | new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, PlacementPositionPropertyChanged));
25 |
26 | public bool IsSelected
27 | {
28 | get => (bool)GetValue(IsSelectedProperty);
29 | set => SetValue(IsSelectedProperty, value);
30 | }
31 | public static readonly DependencyProperty IsSelectedProperty =
32 | DependencyProperty.Register(nameof(IsSelected), typeof(bool), typeof(TimelineKey),
33 | new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, IsSelectedPropertyChanged));
34 |
35 | internal EventHandler? PreMouseLeftButtonDown { get; set; }
36 | internal EventHandler? PreMouseLeftButtonUp { get; set; }
37 | internal EventHandler? SelectionChangedEvent { get; set; }
38 |
39 | TranslateTransform Translate { get; }
40 |
41 | public TimelineKey(object content)
42 | {
43 | DataContext = content;
44 |
45 | Translate = new TranslateTransform();
46 | Translate.X = PlacementPosition;
47 | Translate.Y = 0;
48 |
49 | var group = new TransformGroup();
50 | group.Children.Add(Translate);
51 |
52 | RenderTransform = group;
53 | }
54 |
55 | protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
56 | {
57 | // Ctrl+Clickによる超シビアなタイミングでClickCount==2で処理が来る場合がある
58 | // なので、ClickCountを見て処理を限定する実装はしないように。
59 | PreMouseLeftButtonDown?.Invoke(this, e);
60 |
61 | e.Handled = true;
62 | }
63 |
64 | protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
65 | {
66 | PreMouseLeftButtonUp?.Invoke(this, e);
67 |
68 | // Lane側でHandleする必要がある処理が行われたので、ここでは処理しない
69 | if (e.Handled == false)
70 | {
71 | if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
72 | {
73 | IsSelected = !IsSelected;
74 | }
75 | else
76 | {
77 | IsSelected = true;
78 | }
79 |
80 | e.Handled = true;
81 | }
82 | }
83 |
84 | static void PlacementPositionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
85 | {
86 | var key = (TimelineKey)d;
87 | key.Translate.X = Math.Max(0, (double)e.NewValue);
88 | }
89 |
90 | static void IsSelectedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
91 | {
92 | var key = (TimelineKey)d;
93 | key.SelectionChangedEvent?.Invoke(key, key);
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/TimelineEditor/Controls/TimelineLaneCanvas.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Collections.Specialized;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 | using System.Windows.Controls;
10 | using System.Windows.Data;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 |
14 | namespace Timeline.Controls
15 | {
16 | internal class KeyMouseEventArgs : EventArgs
17 | {
18 | internal TimelineKey Key { get; }
19 | internal MouseEventArgs EventArgs { get; }
20 |
21 | internal KeyMouseEventArgs(TimelineKey key, MouseEventArgs eventArgs)
22 | {
23 | Key = key;
24 | EventArgs = eventArgs;
25 | }
26 | }
27 |
28 | public class TimelineLaneCanvas : Canvas
29 | {
30 | public IEnumerable KeysSource
31 | {
32 | get => (IEnumerable)GetValue(KeysSourceProperty);
33 | set => SetValue(KeysSourceProperty, value);
34 | }
35 | public static readonly DependencyProperty KeysSourceProperty =
36 | DependencyProperty.Register(nameof(KeysSource), typeof(IEnumerable), typeof(TimelineLaneCanvas), new FrameworkPropertyMetadata(null, KeysSourcePropertyChanged));
37 |
38 | public ICommand LaneDoubleClickedCommand
39 | {
40 | get => (ICommand)GetValue(LaneDoubleClickedCommandProperty);
41 | set => SetValue(LaneDoubleClickedCommandProperty, value);
42 | }
43 | public static readonly DependencyProperty LaneDoubleClickedCommandProperty =
44 | DependencyProperty.Register(nameof(LaneDoubleClickedCommand), typeof(ICommand), typeof(TimelineLaneCanvas), new FrameworkPropertyMetadata(null));
45 |
46 | public ICommand LaneClickedCommand
47 | {
48 | get => (ICommand)GetValue(LaneClickedCommandProperty);
49 | set => SetValue(LaneClickedCommandProperty, value);
50 | }
51 | public static readonly DependencyProperty LaneClickedCommandProperty =
52 | DependencyProperty.Register(nameof(LaneClickedCommand), typeof(ICommand), typeof(TimelineLaneCanvas), new FrameworkPropertyMetadata(null));
53 |
54 | public Point ContextMenuOpeningPosition
55 | {
56 | get => (Point)GetValue(ContextMenuOpeningPositionProperty);
57 | set => SetValue(ContextMenuOpeningPositionProperty, value);
58 | }
59 | public static readonly DependencyProperty ContextMenuOpeningPositionProperty =
60 | DependencyProperty.Register(nameof(ContextMenuOpeningPosition), typeof(Point), typeof(TimelineLaneCanvas), new FrameworkPropertyMetadata(Define.ZeroPoint));
61 |
62 | public Brush UnderBorder
63 | {
64 | get => (Brush)GetValue(UnderBorderProperty);
65 | set => SetValue(UnderBorderProperty, value);
66 | }
67 | public static readonly DependencyProperty UnderBorderProperty =
68 | DependencyProperty.Register(nameof(UnderBorder), typeof(Brush), typeof(TimelineLaneCanvas), new FrameworkPropertyMetadata(null, UnderBorderPropertyChanged));
69 |
70 | internal ListBoxItem TrackItem { get; }
71 | internal EventHandler? KeyAddedEvent { get; set; }
72 | internal EventHandler? KeyRemovedEvent { get; set; }
73 | internal EventHandler? KeySelectionChangedEvent { get; set; }
74 | internal EventHandler? PreKeyMouseLeftBottomDownEvent { get; set; }
75 | internal EventHandler? PreKeyMouseLeftBottomUpEvent { get; set; }
76 |
77 | TranslateTransform Translate { get; }
78 |
79 | Style? _KeyStyle;
80 | Pen? _UnderBorderPen;
81 |
82 | public TimelineLaneCanvas(ListBoxItem trackItem, Style? keyStyle, object content, double x, double y, double width)
83 | {
84 | ClipToBounds = true;
85 |
86 | TrackItem = trackItem;
87 | _KeyStyle = keyStyle;
88 |
89 | DataContext = content;
90 |
91 | SizeChanged += TimelineLaneCanvas_SizeChanged;
92 |
93 | TrackItem.SizeChanged += Track_SizeChanged;
94 | TrackItem.IsVisibleChanged += Track_IsVisibleChanged;
95 |
96 | Translate = new TranslateTransform()
97 | {
98 | X = x,
99 | Y = y
100 | };
101 |
102 | MinHeight = TrackItem.ActualHeight;
103 | MinWidth = width;
104 |
105 | var group = new TransformGroup();
106 | group.Children.Add(Translate);
107 |
108 | RenderTransform = group;
109 |
110 | Unloaded += (sender, e) =>
111 | {
112 | SizeChanged -= TimelineLaneCanvas_SizeChanged;
113 |
114 | foreach (var key in Children.OfType())
115 | {
116 | UnsubscribeTimelineKeyEvent(key);
117 | }
118 | Children.Clear();
119 |
120 | if (KeysSource is INotifyCollectionChanged notifyCollectionChanged)
121 | {
122 | notifyCollectionChanged.CollectionChanged -= KeyCollectionChanged;
123 | }
124 | };
125 | }
126 |
127 | internal TimelineKey[] GetTimelineKeys()
128 | {
129 | return Children.OfType().ToArray();
130 | }
131 |
132 | internal void SyncLaneVerticalPosition(double y)
133 | {
134 | Translate.Y = y;
135 | }
136 |
137 | internal void UpdateKeyStyle(Style style)
138 | {
139 | foreach (var key in Children.OfType())
140 | {
141 | key.Style = style;
142 | key.ApplyTemplate();
143 | }
144 |
145 | _KeyStyle = style;
146 | }
147 |
148 | static void KeysSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
149 | {
150 | var lane = (TimelineLaneCanvas)d;
151 | var removeKeys = lane.Children.OfType().ToArray();
152 |
153 | foreach (var removeKey in removeKeys)
154 | {
155 | lane.RemoveKeys(removeKey);
156 | }
157 |
158 | var contents = ((IEnumerable)e.NewValue).OfType