我创建了一个ADO.NET实体数据模型.一切正常,直到我在我的数据库中添加了新表.所以我想将该表添加到我的数据模型中.我按照以下步骤操作:右键单击我的模型 - >从数据库更新.比向导打开,我选择了我要添加的内容.当我展开表树时,我添加到数据库中的表就在那里.我检查一下,点击完成.没有错误,一切都成功完成,但我的模型没有任何变化.该表未添加到我的模型中.有谁知道为什么会这样?
我正在使用mvvm开发一些wpf应用程序.我正在尝试使用按钮单击事件和命令,但命令永远不会执行.此外,当我只使用没有点击事件的命令时,它完美无缺.这是代码:
<ControlTemplate x:Key="reminderDataTemplate">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="150" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="New reminder:" HorizontalAlignment="Left" />
<TextBox Text="{Binding Path=ReminderText, UpdateSourceTrigger=PropertyChanged}" Grid.Row="1" Height="150" Width="200" HorizontalAlignment="Left"/>
<Button Name="btnSaveReminder" Grid.Row="2" Content="Save" Width="auto" Height="20" HorizontalAlignment="Left" Click="btnSaveReminder_Click" Command="{Binding Path= btnSaveReminder}" />
</Grid>
</ControlTemplate>
Run Code Online (Sandbox Code Playgroud)
为什么会这样?
只是提到我必须一起使用click和command因为我的视图和viewmodel在不同的项目中.
更新: 另外要说的是,当我在控制模板外的按钮中一起使用click和command时,一切都很完美.
我从codeplex下载了WPFAnimatedGiff.dll.这就是问题所在:我正在尝试在标签项中实现giff.giff实际上是一个循环进度条,所以我试图模拟标签项的加载过程,类似于谷歌Chrome进度条.我插入了图像,它在设计器中可见,但在运行我的应用程序时它不会显示.此外,当我在网格中的其他位置插入图像时,它确实显示出来.这是代码:
<Window x:Class="WPFHotel.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WPFHotel"
xmlns:data="clr-namespace:WPFHotel.Database"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:gif="http://wpfanimatedgif.codeplex.com" />
<TabItem Tag="PB1" Header="Rezervacije" Name="Reservations" BorderBrush="Black" FontFamily="Times New Roman" FontWeight="Bold" FontSize="14">
<TabItem.HeaderTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Rezervacije" Margin="5,2,0,0" />
<Image gif:ImageBehavior.AnimatedSource="Images/468.gif" Stretch="None" />
</StackPanel>
</DataTemplate>
</TabItem.HeaderTemplate>
</TabItem>
Run Code Online (Sandbox Code Playgroud)
尝试谷歌的解决方案,但找不到任何有用的东西,所以我希望有人可以帮助我. 编辑:只是提到我插入这样的图像时:
<Image Source="Images/CircleBar.gif" />
Run Code Online (Sandbox Code Playgroud)
它在应用程序运行时显示,但没有旋转/动画.