我正在尝试使用交互功能来实现鼠标双击标准图像控件。Image控件位于UserControl上,应处理鼠标双击的方法位于视图模型上。代码如下:
1)UserControl:
<ItemsControl Grid.Row="0" ItemsSource="{Binding SelectedEventPhotoList}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Name="SelectedListView">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="1" Columns="3"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Image Source="{Binding}" Stretch="None">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<ei:CallMethodAction MethodName="DblClick" TargetObject="{Binding}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Image>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Run Code Online (Sandbox Code Playgroud)
3)查看模型:
public void DblClick()
{
MessageBox.Show("Double click!");
}
Run Code Online (Sandbox Code Playgroud)
但是,它不起作用。
更新:
我这样做了,但是不起作用:
1)XAML:
<ItemsControl Grid.Row="0" ItemsSource="{Binding SelectedEventPhotoList}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Name="SelectedListView">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="1" Columns="3"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Image Source="{Binding}">
<Image.InputBindings>
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding MouseDoubleClickCommand}"/>
</Image.InputBindings>
</Image>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Run Code Online (Sandbox Code Playgroud)
2)查看模型:
public DelegateCommand MouseDoubleClickCommand { get; private …Run Code Online (Sandbox Code Playgroud) 我在以下代码序列中React:
{financialPerformance && (
financialPerformance.isConfirmed ? (
<L.Text txtGray>Confirmed</L.Text>
) : (
<L.Text txtGray>Not Confirmed</L.Text>
)
)}
Run Code Online (Sandbox Code Playgroud)
我也必须检查financialPerformance自身是否为null空或undefined显示“未确认”消息。我的意思是第一次出现financialPerformance物体。
{financialPerformance && (
Run Code Online (Sandbox Code Playgroud)
我该如何在上方或下方进行此操作?
我有一个包含"ActionDate"列的表,它有两种类型的日期:
我需要以这样的方式对数据进行排序:实际日期应该按升序排列,并且应该遵循常量值.
数据样本:
1)目前的状态:
ActionDate
2014-01-03
2014-01-01
2014-01-02
1980-01-01
2014-01-04
2014-01-05
1980-01-01
Run Code Online (Sandbox Code Playgroud)
2)期望的状态:
ActionDate
2014-01-01
2014-01-02
2014-01-03
2014-01-04
2014-01-05
1980-01-01
1980-01-01
Run Code Online (Sandbox Code Playgroud) 我使用了以下代码:
let response = await fetch("/LostEnergyCalculation/GetGridAndPieChartsData");
let data = await response.json();
Run Code Online (Sandbox Code Playgroud)
不带参数也可以正常使用,但是带参数怎么用呢?
像这样的东西:
string defectGuid = null;
var dictionary = new Dictionary<bool,string> {
{new ProjectDiscrepancyWrongLocation().Conditions(row), "88ff2dfb-6190-4ab6-b13b-68de1719eac2"},
{new DestructionLeakiness().Conditions(row), "af018ee7-7974-45f8-a508-18359cde4108"},
{new CoatingInsulationDefect().Conditions(row), "232b2b2e-abc0-46b2-8b8c-45fede83ad83"},
{new CathodicProtectionUnitUnderProtectionZone().Conditions(row), "78cb3548-0d61-4809-bf28-0590dfb52010"},
{new CoatingPaintDefect().Conditions(row), "83e82b20-efc9-4500-8ca5-bb29631ccc61"},
{new ProjectDiscrepancyEdgesOffset().Conditions(row), "cf9c76c3-79eb-4856-8dc6-c9c7321a3ed5"},
{new DocumentationDiscrepancyDiscrepanciesInDocumentation().Conditions(row), "d3c793bc-5840-413a-8cae-6962772b4a88"},
{new DestructionElementDestruction().Conditions(row), "6b8924f9-5bba-4db8-b33c-099ca17a58b9"},
{new IndicatorDefectDamage().Conditions(row), "8F2560F3-31A0-4489-9A77-387BE9347D38"}
};
foreach (var item in dictionary.Where(item => item.Key)) {
defectGuid = item.Value;
}
return defectGuid;
Run Code Online (Sandbox Code Playgroud)
其中一个类如下:
public class DestructionLeakiness : IDefectTypeConditions {
public bool Conditions(string[] row) {
return Helpers.NormalizeLocalizedString(row[4]).Contains("aaaa");
}
}
Run Code Online (Sandbox Code Playgroud)
问题是会出现一个错误,表明密钥已经存在.
更新:
我改变了以下方法:
private static string SetTypeOfDefect(string[] row)
{
string defectGuid …Run Code Online (Sandbox Code Playgroud) c# ×1
collections ×1
dictionary ×1
double-click ×1
javascript ×1
reactjs ×1
sql-server ×1
typescript ×1
wpf ×1