port from perforce
This commit is contained in:
44
intromat/Intromat/Views/Editors/SamplerEditorView.cs
Normal file
44
intromat/Intromat/Views/Editors/SamplerEditorView.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Intromat.Interfaces;
|
||||
using Intromat.ViewModels.Editors;
|
||||
using ReactiveUI;
|
||||
using SharpDX.Direct3D11;
|
||||
|
||||
namespace Intromat.Views.Editors
|
||||
{
|
||||
[TemplatePart(Name = nameof(_comboBoxFilter), Type = typeof(ComboBox))]
|
||||
[TemplatePart(Name = nameof(_comboBoxAddress), Type = typeof(ComboBox))]
|
||||
public class SamplerEditorView : EditorViewBase<SamplerEditorViewModel>
|
||||
{
|
||||
private ComboBox _comboBoxFilter = null!;
|
||||
private ComboBox _comboBoxAddress = null!;
|
||||
|
||||
public SamplerEditorView()
|
||||
{
|
||||
DefaultStyleKey = typeof(SamplerEditorView);
|
||||
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
var addressNames = Enum.GetValues(typeof(TextureAddressMode)).Cast<TextureAddressMode>().ToArray();
|
||||
_comboBoxAddress.ItemsSource = addressNames;
|
||||
|
||||
var filterNames = Enum.GetValues(typeof(Filter)).Cast<Filter>();
|
||||
_comboBoxFilter.ItemsSource = filterNames;
|
||||
|
||||
this.Bind(ViewModel, vm => vm.Address, v => v._comboBoxAddress.SelectedItem).DisposeWith(d);
|
||||
this.Bind(ViewModel, vm => vm.Filter, v => v._comboBoxFilter.SelectedItem).DisposeWith(d);
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
_comboBoxFilter = (ComboBox)GetTemplateChild(nameof(_comboBoxFilter))!;
|
||||
_comboBoxAddress = (ComboBox)GetTemplateChild(nameof(_comboBoxAddress))!;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user