Search Results

Search found 5961 results on 239 pages for 'wpf 4 5'.

Page 125/239 | < Previous Page | 121 122 123 124 125 126 127 128 129 130 131 132  | Next Page >

  • Gratuitous use of System.Runtime.Serialization attributes?

    - by rasx
    Is there any cost/drawback (apart from typing too much) to adorning a class with System.Runtime.Serialization attributes (like [DataContract]) such that it can be used locally as a direct reference to a desktop Client project or as a type for a WCF service? The goal here is to write a data-tier class that can be used in both rich client (WPF) and Web scenarios. My data classes will be in a project that is separate from Client and WCF (*.svc code-behind) code. Is this a valid attempt to reuse code?

    Read the article

  • RenderTargetBitmap + Resource'd VisualBrush = incomplete image

    - by Will
    I've found a new twist on the "Visual to RenderTargetBitmap" question! I'm rendering previews of WPF stuff for a designer. That means I need to take a WPF visual and render it to a bitmap without that visual ever being displayed. Got a nice little method to do it like to see it here it goes private static BitmapSource CreateBitmapSource(FrameworkElement visual) { Border b = new Border { Width = visual.Width, Height = visual.Height }; b.BorderBrush = Brushes.Black; b.BorderThickness = new Thickness(1); b.Background = Brushes.White; b.Child = visual; b.Measure(new Size(b.Width, b.Height)); b.Arrange(new Rect(b.DesiredSize)); RenderTargetBitmap rtb = new RenderTargetBitmap( (int)b.ActualWidth, (int)b.ActualHeight, 96, 96, PixelFormats.Pbgra32); // intermediate step here to ensure any VisualBrushes are rendered properly DrawingVisual dv = new DrawingVisual(); using (var dc = dv.RenderOpen()) { var vb = new VisualBrush(b); dc.DrawRectangle(vb, null, new Rect(new Point(), b.DesiredSize)); } rtb.Render(dv); return rtb; } Works fine, except for one leeetle thing... if my FrameworkElement has a VisualBrush, that brush doesn't end up in the final rendered bitmap. Something like this: <UserControl.Resources> <VisualBrush x:Key="LOLgo"> <VisualBrush.Visual> <!-- blah blah --> <Grid Background="{StaticResource LOLgo}"> <!-- yadda yadda --> Everything else renders to the bitmap, but that VisualBrush just won't show. The obvious google solutions have been attempted and have failed. Even the ones that specifically mention VisualBrushes missing from RTB'd bitmaps. I have a sneaky suspicion this might be caused by the fact that its a Resource, and that lazy resource isn't being inlined. So a possible fix would be to, somehow(???), force resolution of all static resource references before rendering. But I have absolutely no idea how to do that. Anybody have a fix for this?

    Read the article

  • How to copy DispatcherObject (BitmapSource) into different thread?

    - by Tomáš Kafka
    Hi, I am trying to figure out how can I copy DispatcherObject (in my case BitmapSource) into another thread. Use case: I have a WPF app that needs to show window in a new thread (the app is actually Outlook addin and we need to do this because Outlook has some hooks in the main UI thread and is stealing certain hotkeys that we need to use - 'lost in translation' in interop of Outlook, WPF (which we use for UI), and Winforms (we need to use certain microsoft-provided winforms controls)). With that, I have my implementation of WPFMessageBox, that is configured by setting some static properties - and and one of them is BitmapSource for icon. This is used so that in startup I can set WPFMessageBox.Icon once, and since then, every WPFMessageBox will have the same icon. The problem is that BitmapSource, which is assigned into icon, is a DispatcherObject, and when read, it will throw InvalidOperationException: "The calling thread cannot access this object because a different thread owns it.". How can I clone that BitmapSource into the actual thread? It has Clone() and CloneCurrentValue() methods, which don't work (they throw the same exception as well). It also occured to me to use originalIcon.Dispatcher.Invoke( do the cloning here ) - but the BitmapSource's Dispatcher is null, and still - I'd create a copy on a wrong thread and still couldnt use it on mine. BitmapSource.IsFrozen == true. Any idea on how to copy the BitmapSource into different thread (without completely reconstructing it from an image file in a new thread)? EDIT: So, freezing does not help: In the end I have a BitmapFrame (Window.Icon doesn't take any other kind of ImageSource anyway), and when I assign it as a Window.Icon on a different thread, even if frozen, I get InvalidOperationException: "The calling thread cannot access this object because a different thread owns it." with a following stack trace: WindowsBase.dll!System.Windows.Threading.Dispatcher.VerifyAccess() + 0x4a bytes WindowsBase.dll!System.Windows.Threading.DispatcherObject.VerifyAccess() + 0xc bytes PresentationCore.dll!System.Windows.Media.Imaging.BitmapDecoder.Frames.get() + 0xe bytes PresentationFramework.dll!MS.Internal.AppModel.IconHelper.GetIconHandlesFromBitmapFrame(object callingObj = {WPFControls.WPFMBox.WpfMessageBoxWindow: header}, System.Windows.Media.Imaging.BitmapFrame bf = {System.Windows.Media.Imaging.BitmapFrameDecode}, ref MS.Win32.NativeMethods.IconHandle largeIconHandle = {MS.Win32.NativeMethods.IconHandle}, ref MS.Win32.NativeMethods.IconHandle smallIconHandle = {MS.Win32.NativeMethods.IconHandle}) + 0x3b bytes > PresentationFramework.dll!System.Windows.Window.UpdateIcon() + 0x118 bytes PresentationFramework.dll!System.Windows.Window.SetupInitialState(double requestedTop = NaN, double requestedLeft = NaN, double requestedWidth = 560.0, double requestedHeight = NaN) + 0x8a bytes PresentationFramework.dll!System.Windows.Window.CreateSourceWindowImpl() + 0x19b bytes PresentationFramework.dll!System.Windows.Window.SafeCreateWindow() + 0x29 bytes PresentationFramework.dll!System.Windows.Window.ShowHelper(object booleanBox) + 0x81 bytes PresentationFramework.dll!System.Windows.Window.Show() + 0x48 bytes PresentationFramework.dll!System.Windows.Window.ShowDialog() + 0x29f bytes WPFControls.dll!WPFControls.WPFMBox.WpfMessageBox.ShowDialog(System.Windows.Window owner = {WPFControlsTest.MainWindow}) Line 185 + 0x10 bytes C#

    Read the article

  • HierarchicalDataTemplate Distinct leaves

    - by miguel
    I have a set of data that is structured like this: ItemA.GroupA ItemB.GroupA ItemC.GroupB ItemD.GroupC I need to present the data in a WPF Tree View like this: GroupA --- ItemA --- ItemB GroupB --- ItemC GroupC --- ItemD What XAML can I use to group the leaves by distinct value? For instance, there could be multple items in the collection which are GroupA.ItemA, however, I only want to present the node and leaf once.

    Read the article

  • Dependent properties

    - by Senthilkumar
    Hi I am new to WPF.. Can anyone tell.. What exactly the depentent properties means?.. How it differ from normal properties??? and can i edit the design page in asp 3.5 while am i running the application, because the same is possible in asp 2.0.

    Read the article

  • Resharper Warnings with MVVM

    - by Dan Bryant
    As I implement the MVVM pattern with WPF, I'm finding that Resharper is often warning me that certain properties are never used in my ViewModels. The problem is that they are being used, but only by the data binding system. Has anyone else encountered this annoyance and is there a way to help Resharper realize that these properties are, indeed, being used? I am glad, at least, that VS 2010 properly realizes that [Import] tagged members won't "always be null", but hopefully I can fix this issue as well.

    Read the article

  • How to iterate all query paths within an image header namespace in WIC?

    - by muruge
    Hello All, I am using Windows Imaging Component to read/write image metadata in my WPF application. I would like to know if there is an efficient way to know if any paths exist within a namespace. For instance I would like to know if any paths within IPTC namespace exist and if not I want to delete the namespace from the image header. Any pointers would be greatly appreciated. Thanks, Murugesh.

    Read the article

  • How to Call my global value in app.config file

    - by deep
    Hai, am using c# and wpf am having my value as a string, i need to call the string value in my app.config file for example in app.config file am having my connection string. the username may vary diff time. am having the user name as a globasl string. i need to call that string in my app.config connection string when application startup????

    Read the article

  • How to hide files generated by custom tool in Visual Studio

    - by jws
    WPF code behind is not displayed in the Visual Studio project view, yet is compiled with the project and is available in IntelliSense. This code behind file (Window1.g.i.cs, for example), is generated by a custom tool. I would like the files generated by my custom tool to be hidden as well, but I cannot find any documentation on how this is done. How can I do this?

    Read the article

  • How to assign Application Icon that will display in Task bar?

    - by viky
    I am working on a Wpf desktop application, whenever i run my application it shows me a window and associated tab in the task bar(Normal windows feature). My problem is that the tab is using window's icon for unknown file-type, I tried with Icon property of Window, Icon gets assigned but still problem is when I run application, task bar Tab initially displays window's icon for unknown file-type and when window-load completes it changes to the Icon assigned. I want Icon there from beginning. Any help?

    Read the article

  • XamlParse Error on XP , Help

    - by Sandeep Bansal
    Hi everyone, I have a WPF application which runs perfectly fine on vista/7 but on Windows XP it chucks up the System.Windows.Markup.XamlParse error, and it's quite frustrating because I have a hell of a lot of controls in my application and I don't know what is causing the problem. Can anyone shine some light here? Thanks.

    Read the article

  • Mouse left button up event and openfiledialog

    - by phm
    I have few images in a grid, then when i click a button, a "open file dialog" comes up.(of course, over the images) Microsoft.Win32.OpenFileDialog dlgOpenFiles = new Microsoft.Win32.OpenFileDialog(); dlgOpenFile.DoModal(); The images have a LeftButtonUp event attached. The problem is that if i select a file by double clicking it, the open file dialog closes(which is good), but besides that, the image behind the clicked file is receiving a LeftButtonUp message which is not good at all. I am using wpf/c#/vs2010

    Read the article

  • Resources.resx in c# projects

    - by Alexander Braeumer
    I have a problem using a Resources.resx - Resources.de.resx - combination in a C#/WPF project. The whole solutions contains several projects and some projects contains resource files. When starting the main project I can switch the language successfully from english to german. But the GUI elements from the sub projects still show the english text. Thank you very much for every idea to solve the problem. Regards, Alex

    Read the article

  • Date Picker Selection Change

    - by user421678
    Hello Friends, I am new in WPF,now i have a date picker in one of my form,in page load a text "Select a Date" will be showing in that date picker field,if i select a date in that date picker field that date will be shown in that date picker field,after this when i am clicking the cancel button i want to clear all the controls,for that i have written a function also,but in that date picker i want that text "Select a Date" back.What can i do for that?

    Read the article

  • How to style a label with a colon

    - by Allan
    I have a details view window in WPF and a label may look like this. <Label Content="{x:Static properties:Resources.Reference}" /> So that is obtains it content from my property Resource. How can transform/format the content so it has a colon after each label item. e.g. instead of the content simply displaying Reference I want it to transform to Reference:

    Read the article

  • Adorning a non-DependencyObject with a DependencyProperty

    - by Rob
    I'm trying to bind to a WinForms control's DataSource property in my WPF application but I'm not having much luck... Falafel.com gives it a shot, but although it claimes that a DependencyObject is not required to perform the binding, that seems to be the only way of doing it. Has anyone done this before?

    Read the article

  • Display small form while main form is "locked"

    - by daemonsvk
    Hi there, i'm thinking about writing a WPF program that would require login and password at the app startup. I thought about small form with two textboxes as a login form. User will have to fill in his details and then the main form of the application will be unlocked. How will you solve this? Thanks for your answers, daemonsvk

    Read the article

  • Determine number of screens and screen relative location without WinForms

    - by Philipp Schmid
    I want to save and restore the window position of my WPF application. I want to make the code robust to use with multiple monitors who's number and relative location can change (I want to avoid opening my application off-screen when the monitor configuration has changed inbetween invocations). I know of the Screen class in System.Windows.Forms, but I don't want to take a dependency on that assembly just for this feature.

    Read the article

  • FileSystemWatcher and System Out of Memory Exception

    - by Saurabh
    A little context There is a wpf based application which i left opened for 2-3 days without performing any activity throws out of memory exception , this is very Weird situation and does not happen all of the time. During this ideal activity , my application does nt perform any activity but just a file system watcher contineously watching a shared location , so i thought that would be a problem but i am not sure. Any suggestion is always welcomed.

    Read the article

  • Microsoft Blend 3 - Add Silverlight SDK Themes

    - by photo_tom
    I'm working on my first WPF project and would like to use one of the themes that I see in the Silverlight Tool Kit. All the help I've found is for Expression 2 and they show a different version of the Asset Tab. Can someone advise me how to do this. It looks like it should be simple, but I'm not seeing it.

    Read the article

< Previous Page | 121 122 123 124 125 126 127 128 129 130 131 132  | Next Page >