app.xaml

WPF App.xaml in different Assembly

时光总嘲笑我的痴心妄想 提交于 2019-12-12 15:01:20
问题 I want to setup a WPF Application. But instead of using the entry point of the application to a App.xaml itself, I've to projects. The first projects is a Windows Application and has a normale Main function. And I've an additional project (WPF control library), that has the App.xaml, windows, controls and all it needs. The main method start the Application like this: [STAThread] static void Main() { Application.Run(); } Where Application is a class in the library: public static class

How to conditionally use InvokeMethod in an XAML Windows workflow foundation

自作多情 提交于 2019-12-12 04:32:02
问题 In windows workflow foundation sequence workflow, How to use invoke method tags to be invoked based on certain condition? For example, <Sequence> <Sequence.Variables> <Variable x:TypeArguments="x:String" Default="["this is an out param"]" Name="outParam" /> <Variable x:TypeArguments="x:Int32" Name="resultValue" /> <Variable x:TypeArguments="msi:TestClass" Default="[New TestClass()]" Name="varTestClass" /> </Sequence.Variables> <sap:WorkflowViewStateService.ViewState> <scg:Dictionary x

Getting an XamlObjectWriterException only at design time with ValueConverter inside DataTemplate (Visual Studio 2015)

梦想与她 提交于 2019-12-12 04:25:28
问题 I have an application which runs perfectly at run-time but fails at design time with Collection property 'System.Windows.Data.Binding'.'ConverterParameter' is null exception. I think I have narrowed it down to the fact that I am referencing an x:array static resource (declared in resource dictionary, merged in App.xaml) in a value converter inside a DataTemplate. If I use the same code outside a DataTemplate, I do not get this problem. I suspect that this question has the same root cause. I

How to use a ViewModelLocator in a user control?

爷,独闯天下 提交于 2019-12-11 19:13:44
问题 I was asked to convert a standalone WPF application that uses the MVVM pattern into a user control. This app consists of a main window and a few other windows. However, I get a few errors when trying to do so all pointing to my App.xaml class and other resources declared like converters: Library project file cannot specify ApplicationDefintion element. The project file contains a property value that is not valid. The name "ViewModelLocator" does not exist in the namespace "clr-namespace

wpf DataGrid change wrapping on cells

冷暖自知 提交于 2019-12-11 11:00:45
问题 I have a WPF DataGrid with AutoGenerate Columns. I have been able to override the column headers using code and also force wrapping on the column headers when I shrink the columns. When I try to force text wrapping on the cells my binding breaks... it shows the same value in every column. Here is the XAML I am using to format <DataGrid.CellStyle> <Style TargetType="DataGridCell"> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <TextBlock TextWrapping="Wrap" Text="{Binding}">

How can I bind a TextBlock to an ObjectDataProvider resource defined in app.xaml?

无人久伴 提交于 2019-12-08 12:24:22
问题 I have a WPF application with MVVM, it has an Ap.XAML that looks like this. <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Assets/StyleDictionary.xaml"/> </ResourceDictionary.MergedDictionaries> <ObjectDataProvider x:Key="SAG_POK" ObjectType="{x:Type or:SAG_POK}" /> </ResourceDictionary> </Application.Resources> Now, on the MainWindow.XAML I want to bind to the SAG_POK ObjectDataprovider in Ap.xaml. <StackPanel DataContext="

A View Model for App.Xaml

萝らか妹 提交于 2019-12-08 06:17:27
问题 Can we have a viewModel for App.Xaml so that we can do some logical deductions on startUp and also form a starting point of app... 回答1: No, App.xaml is not a Window class, it is your Application class. You can still overwrite the OnStartup() method of it to handle your own custom logic and to startup specific Views/ViewModels. For example, protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var login = new LoginDialog(); var loginVm = new LoginViewModel(); login

Why is my style in Generic.xaml not working?

五迷三道 提交于 2019-12-04 16:54:37
I'm cleaning up App.xaml and moved some styles into Generic.xaml. But then, these styles don't have any effect. Why? Is this correct thing to do to make App.xaml tidy? EDIT (to include some source code): The goal is to restyle WPF DataGrid to make the scrollbars run from top to bottom and from left to right (default style excludes row and column header). The style is working when I put it in App.xaml. Because it's a big chunk of code, I'd like to move it out of App.xaml into /Themes/DataGridEx.xaml. By the way, DataGridEx is my extended class derived from WPF DataGrid. This is my DataGrid.xaml

Set static resource in code

我的梦境 提交于 2019-12-04 09:04:06
问题 I have a few styles in my App.xaml file: <SolidColorBrush x:Key="styleBlue" Color="#FF4B77BE"/> <SolidColorBrush x:Key="styleRed" Color="#FFF64747"/> <SolidColorBrush x:Key="styleOrange" Color="#FFF89406"/> <SolidColorBrush x:Key="styleGreen" Color="#FF1BBC9B"/> <SolidColorBrush x:Key="styleYellow" Color="#FFF9BF3B"/> <Style x:Key="stackpanelBackground" TargetType="StackPanel"> <Setter Property="Background" Value="{StaticResource styleBlue}"/> </Style> I want to change the BackgroundProperty

WPF - Shut-off autogen of Main in App.g.cs

大兔子大兔子 提交于 2019-12-03 07:22:38
问题 I'm learning WPF. I want to provide my own Main method in my App.xaml.cs rather than getting one generated for me in App.g.cs. However I keep getting conflicts because I haven't found out how to stop an additional Main from being generated. Is there a setting in my project file or elsewhere that controls this? 回答1: I found the answer here. http://learnwpf.com/post/2007/12/13/How-can-I-provide-my-own-Main%28%29-method-in-my-WPF-application.aspx It is: The way WPF knows to create the Main()