这个问题也发布在Prism的Codeplex网站上.
我在按需加载模块时有点迷失,我希望你们能够启发我.我正在使用v2#7.
1)我有2个区域 - 一个用于实例化模块的按钮(MenuRegion),另一个用于显示模块(MainRegion).在MenuRegion中一次只能看到一个模块.
2)模块可以在目录中找到
3)MenuModule模块与MenuRegion相关联,用于创建显示模块名称的按钮.单击其中一个按钮时,将加载相应的模块并显示在MainRegion中.
4)行为:
a)单击ModuleA按钮并显示ModuleA.用户在ModuleA中输入数据,数据保持未保存状态.
b)单击ModuleB按钮并显示ModuleB.用户在ModuleB中输入数据,数据保持未保存状态.
c)单击ModuleA按钮,显示ModuleA,其中包含先前输入的信息.
1)MainRegion应该是ContentControl,因此一次只能看到一个模块.
2)我想我需要枚举我的目录的"GrouplessModules"来获取目录中可用模块的ModuleInfo
3)加载模块我认为我需要调用myModuleManager.LoadModule(moduleName)
1)我应该在我的MenuModuleView的构造函数中将moduleManager作为参数吗?
2)如何从MenuModuleView内部访问目录,以便枚举可用的模块?
3)从MenuModuleView,我通过模块枚举,我创建按钮,将ModuleInfo分配给按钮的Tag属性.这样,我只有一个点击事件来加载模块.它是否正确?它闻起来有点像我的工作...
非常感谢你的帮助!!!
哪里可以找到Generic.xaml(或其他具有默认外观的代码),用于本机WPF控件,如Button,CheckBox,TextBox等?
我正在转换此遗留表中的数据:
Phones(ID int, PhoneNumber, IsCell bit, IsDeskPhone bit, IsPager bit, IsFax bit)
这些位字段不是空的,并且可能所有四个位字段都可以是1.
我怎样才能解开这个东西,以便每个位字段= 1最终得到一个单独的行 .例如,如果原始表看起来像这样......
ID, PhoneNumber, IsCell, IsPager, IsDeskPhone, IsFax
----------------------------------------------------
1 123-4567 1 1 0 0
2 123-6567 0 0 1 0
3 123-7567 0 0 0 1
4 123-8567 0 0 1 0
Run Code Online (Sandbox Code Playgroud)
...我希望结果如下:
ID PhoneNumber Type
-----------------------
1 123-4567 Cell
1 123-4567 Pager
2 123-6567 Desk
3 123-7567 Fax
4 123-8567 Desk
Run Code Online (Sandbox Code Playgroud)
谢谢!
假设我在我的DataContext中将字符串Name和Image Photo作为类的属性.我需要将它们绑定到控件是一个DataTemplate.
我认为这会起作用,但它没有:
<Image Source="{Binding Photo}"/>
Run Code Online (Sandbox Code Playgroud)
为什么不?我的照片应该是另一种吗?(也许是BitmapImage?)
如何将Image控件绑定到Image属性?
谢谢!
编辑:像往常一样,点击提交后我看到错误很明显:没有从Image到ImageSource的转换器.我的转换器如何将Image转换为ImageSource?
我有一个有效的WPF应用程序.我希望看到它作为xbap运行.在WPF应用程序中需要更改什么才能使其作为xbap运行?
我正在构建我的第一个Silverlight 3 + RI服务应用程序,需要一些帮助.
它将部署在受控企业内部网,100%Windows客户端中.我从Silverlight业务应用程序模板开始.
这些是我的要求:
我在默认的业务应用程序模板中修改了以下内容:
通过这些修改,我解决了需求#1(获取当前登录的用户).但是当我检查时RiaContext.Current.User,我无法访问AD中的其他属性,例如组成员身份.我怎样才能达到我的其他要求?
谢谢你的帮助.
authentication silverlight windows-authentication wcf-ria-services
我有一个WPF(.Net 3.5 sp1)应用程序,它在启动时加载一堆数据(启动需要几秒钟)但是在加载数据后它运行良好.当应用程序运行时,如果我没有触摸它一段时间(比如几个小时),然后我替换它,那么它会"非常慢"地"唤醒".我的问题:
这是为什么?是因为.Net释放了我从内存加载的大数据,它必须以某种方式恢复它?
我可以在我的应用程序中做什么来防止这种行为,即使我知道在应用程序完成之前我会封存内存?
我将以下数据模板应用于ListBox:
<DataTemplate x:Key="MyTemplate" DataType="{x:Type DAL:Person}">
<StackPanel Orientation="Horizontal">
<Button Content="X" Command="{x:Static cmd:MyCommands.Remove}"/>
<TextBlock Text="{Binding Person.FullName}" />
</StackPanel>
</DataTemplate>
Run Code Online (Sandbox Code Playgroud)
当我单击按钮时,命令被触发但ListBoxItem未被选中.如何强制它被选中,以便我可以在"执行"方法中获取所选项目?
谢谢
<Style x:Key="MyStyle">
<Setter Property="Window.Background" Value="Orange"/>
</Style>
<Button Content="Ok" Style="{StaticResource MyStyle}"/>
Run Code Online (Sandbox Code Playgroud)
如果将setter指定为Window.Background,为什么按钮实际上是橙色背景?
这并没有给TextBlock的橙色背景:
<TextBlock Style="{StaticResource MyStyle}"/>
Run Code Online (Sandbox Code Playgroud)
谢谢
我在我的窗口中定义了依赖属性,如下所示:
public static readonly DependencyProperty IsGenericUserProperty = DependencyProperty.Register("IsGenericUser", typeof (bool), typeof (MainWindow));
public bool IsGenericUser
{
get { return (bool) GetValue(IsGenericUserProperty); }
set { SetValue(IsGenericUserProperty, value); }
}
Run Code Online (Sandbox Code Playgroud)
在我的窗口的构造函数中,我设置了包含按钮的容器的数据上下文:
QuickListButtonsStackPanel.DataContext = this;
Run Code Online (Sandbox Code Playgroud)
我将依赖项属性绑定到按钮的IsEnabled属性:
<Button IsEnabled="{Binding IsGenericUser}" .../>
Run Code Online (Sandbox Code Playgroud)
在启动IsGenericUser时为true,因此启用该按钮.当我将IsGenericUser设置为false时,该按钮被禁用.但是,如果我再次使IsGenericUser为true,则按钮没有任何反应,它仍保持禁用状态.我究竟做错了什么?
谢谢!
编辑:这是我使用按钮的样式.此样式导致问题(如果按钮没有自定义样式,它可以正常工作):
<Style x:Key="BlackButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<ControlTemplate.Resources>
<Storyboard x:Key="MouseOverActivating">
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FF2F2F2F"/>
<SplineColorKeyFrame KeyTime="00:00:00.1270000" Value="#FF2391FF"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="MouseOverDeactivating">
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FF2391FF"/>
<SplineColorKeyFrame KeyTime="00:00:00.2200000" Value="#FF2F2F2F"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
<Storyboard …Run Code Online (Sandbox Code Playgroud) wpf ×8
styles ×2
binding ×1
button ×1
command ×1
data-binding ×1
image ×1
isenabled ×1
modularity ×1
performance ×1
prism ×1
silverlight ×1
sql ×1
sql-server ×1
t-sql ×1
unpivot ×1
xaml ×1
xbap ×1