Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all 18858 articles
Browse latest View live

Add A label to a resizable an movable image

$
0
0

I have a project that does multi-touch...image moving, resizing etc. These images are loaded on the fly, so I don't know how many may load onto the canvas. The moving and resizing has all been worked out. However, I would like to put a label on each image. When I place the Image usercontrol nto a container and make a label, I lose all ability to resize, which is crucial.

Here is the Picture controls XAML:

<UserControl x:Class="DocumentHandlingTouch.Picture"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><Image Source="{Binding Path=ImagePath}" Stretch="Fill" Width="Auto" Height="Auto" RenderTransformOrigin="0.5, 0.5"><Image.RenderTransform><TransformGroup><RotateTransform Angle="{Binding Path=Angle}"></RotateTransform><ScaleTransform ScaleX="{Binding Path=ScaleX}" ScaleY="{Binding Path=ScaleY}"></ScaleTransform><TranslateTransform X="{Binding Path=X}" Y="{Binding Path=Y}"/></TransformGroup></Image.RenderTransform></Image></UserControl>

Here is some of the Picture controls class...the portion i use to set the image path:

  public partial class Picture : UserControl
    {

        public Picture()
        {
            InitializeComponent();
            DataContext = this;

        }

        public string ImagePath
        {
            get { return (string)GetValue(ImagePathProperty); }
            set { SetValue(ImagePathProperty, value); }
        }

        public string ImageName
        {
            get { return (string)GetValue(ImageNameProperty); }
            set { SetValue(ImageNameProperty, value); }
        }
        public static readonly DependencyProperty ImageNameProperty =
    DependencyProperty.Register("ImageName", typeof(string), typeof(Picture), new UIPropertyMetadata(""));

the complete code for what I'm doing can be found on OneDrive at DocumentHandling.

Again, I am not looking for any help in getting these images to move or resize, what I'm looking for is a way to get a label onto these images that still allows them to be moved or resized.



Thread safety bug in XPS Serializer or FixedDocument sequence? "calling thread cannot access this object..."

$
0
0

Every once in a while (500 iterations or more) I'm getting an exception in the static method below stating "calling thread cannot access this object because a different thread owns it".  Thing is, this method references no external objects and performs no special threading operations.  All of the WPF objects are created and consumed in this method.  The only aspect that is multi-threaded is that this method can get called concurrently on different threads in the same app domain (the project is a Windows service). That said the fileToDecollate parameter will be unique every time, so there is no "collision" as far as that goes.

Any ideas?   This is maddening and in theory it should not be possible to blow this error.

Exception Information------------------------------------------
System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
   at System.Windows.Threading.Dispatcher.VerifyAccess()
   at System.Windows.DependencyObject.GetLocalValueEnumerator()
   at System.Windows.Xps.Serialization.SerializersCacheManager.GetTypeDependencyPropertiesCacheItem(Object serializableObject)
   at System.Windows.Xps.Serialization.SerializersCacheManager.GetSerializableDependencyProperties(Object serializableObject)
   at System.Windows.Xps.Serialization.SerializablePropertyCollection.InitializeSerializableDependencyProperties()
   at System.Windows.Xps.Serialization.SerializablePropertyCollection.Initialize(PackageSerializationManager serializationManager, Object targetObject)
   at System.Windows.Xps.Serialization.SerializableObjectContext.CreateContext(PackageSerializationManager serializationManager, Object serializableObject, SerializableObjectContext serializableObjectParentContext, SerializablePropertyContext serializablePropertyContext)
   at System.Windows.Xps.Serialization.ReachSerializer.DiscoverObjectData(Object serializedObject, SerializablePropertyContext serializedProperty)
   at System.Windows.Xps.Serialization.ReachSerializer.SerializeObject(Object serializedObject)
   at System.Windows.Xps.Serialization.FixedDocumentSerializer.SerializeObject(Object serializedObject)
   at System.Windows.Xps.Serialization.ReachDocumentReferenceSerializer.PersistObjectData(SerializableObjectContext serializableObjectContext)
   at System.Windows.Xps.Serialization.ReachSerializer.SerializeObject(Object serializedObject)
   at System.Windows.Xps.Serialization.ReachDocumentReferenceCollectionSerializer.SerializeDocumentReference(Object documentReference)
   at System.Windows.Xps.Serialization.ReachDocumentReferenceCollectionSerializer.SerializeDocumentReferences(SerializableObjectContext serializableObjectContext)
   at System.Windows.Xps.Serialization.ReachDocumentReferenceCollectionSerializer.PersistObjectData(SerializableObjectContext serializableObjectContext)
   at System.Windows.Xps.Serialization.ReachSerializer.SerializeObject(SerializablePropertyContext serializedProperty)
   at System.Windows.Xps.Serialization.ReachSerializer.SerializeProperty(SerializablePropertyContext serializablePropertyContext)
   at System.Windows.Xps.Serialization.ReachSerializer.SerializeProperties(SerializableObjectContext serializableObjectContext)
   at System.Windows.Xps.Serialization.ReachSerializer.SerializeObjectCore(SerializableObjectContext serializableObjectContext)
   at System.Windows.Xps.Serialization.DocumentSequenceSerializer.PersistObjectData(SerializableObjectContext serializableObjectContext)
   at System.Windows.Xps.Serialization.ReachSerializer.SerializeObject(Object serializedObject)
   at System.Windows.Xps.Serialization.XpsSerializationManager.SaveAsXaml(Object serializedObject)
   at System.Windows.Xps.XpsDocumentWriter.SaveAsXaml(Object serializedObject, Boolean isSync)
   at System.Windows.Xps.XpsDocumentWriter.Write(FixedDocumentSequence fixedDocumentSequence)
   at MyCompany.Utilities.Document.XPSDocument.Decollate(String fileToDecollate, String outputPath) in E:\Projects\MyCompany\Utilities\MyCompany.Utilities.Document\XPSDocument.cs:line 358
   at MyCompany.Services.ERM.XPSCapture.Decollate(String fileToDecollate, String outputPath) in E:\Projects\MyCompany\Services\MyCompany.Services.ERM\XPSCapture.cs:line 210
   at MyCompany.Services.ERM.ERMFileProcessor.decollateERMFile(String tempERMFile, IFileCapture fileCapture) in E:\Projects\MyCompany\Services\MyCompany.Services.ERM\ERMFileProcessor.cs:line 1257
   at MyCompany.Services.ERM.ERMFileProcessor.process() in E:\Projects\doc-link\MyCompany\Services\Altec.Services.ERM\ERMFileProcessor.cs:line 354
   at MyCompany.Services.ERM.ERMFileProcessor.Process(ProcessingCompleteCallback callback) in E:\Projects\MyCompany\Services\MyCompany.Services.ERM\ERMFileProcessor.cs:line 90

Additonal Info------------------------------------------
ExceptionManager.MachineName: BTP-30-DEV
ExceptionManager.WindowsIdentity: XXXXX-WA\Bradley
ExceptionManager.FullName: WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
ExceptionManager.AppDomainName: MyCompany.XXXXXXServiceHost.exe
ExceptionManager.ProcessInfo: PID=7392, ThreadID=7816, Managed ThreadID=36, Name=MyCompany.XXXXXXServiceHost, Uptime=00:02:12.2548416
ExceptionManager.ProcessResourceUsage: Working Set=265188 KB, Peak Working Set=525940 KB, Virtual Memory Size=530264 KB, Peak VM Size=809832 KB, Handles=631
ExceptionManager.SystemMemory: Load=81%, Total Physical=3168748 KB, Free Physical=586736 KB, Total PageFile=5213700

publicstaticList<string> Decollate(stringfileToDecollate,stringoutputPath)

{

  // iterate fixed documents and fixed pages, create new XPS files

  List<string> xpsDecFiles = newList<string>();

  using(XpsDocumentxpsSourceDocument = newXpsDocument(fileToDecollate,FileAccess.Read))

  {

    FixedDocumentSequencefixedDocSeq = xpsSourceDocument.GetFixedDocumentSequence();

    intpageNumber = 0;

    foreach(DocumentReferencedocReferenceinfixedDocSeq.References)

    {

      FixedDocumentsourceFixedDoc = docReference.GetDocument(false);

      foreach(PageContentpageinsourceFixedDoc.Pages)

      {

        pageNumber++;

        // prepare new fixed doc sequence

       FixedDocumentSequencenewFixedDocSeq = newFixedDocumentSequence();

       DocumentReferencenewDocReference = newDocumentReference();

       FixedDocumentnewFdoc = newFixedDocument();

       newDocReference.SetDocument(newFdoc);

       // copy the page

       PageContentnewPage =newPageContent();

       newPage.Source = page.Source;

       (newPage asIUriContext).BaseUri = ((IUriContext)page).BaseUri;

       // tickle this method... presumably just to load the FixedPage data.

       FixedPagenewFixedPage = newPage.GetPageRoot(false);

       // Add page to fixed doc sequence.

       newFdoc.Pages.Add(newPage);

       // Always do this last: add document reference to fixed doc sequence. 

       newFixedDocSeq.References.Add(newDocReference);

       // create and save new XPS doc                   

       stringdecFileName =Path.Combine(outputPath,Path.GetFileNameWithoutExtension(fileToDecollate)+ "~"+ (pageNumber).ToString()+ FileExtensions.XPS);

       if(File.Exists(decFileName))File.Delete(decFileName);

       XpsDocumentnewXPSDoc = newXpsDocument(decFileName,FileAccess.ReadWrite);

       // testing.  thread IDs should be the same.

       //Debug.Assert(System.Windows.Threading.Dispatcher.CurrentDispatcher.Thread.ManagedThreadId == newFixedDocSeq.Dispatcher.Thread.ManagedThreadId);

       XpsDocument.CreateXpsDocumentWriter(newXPSDoc).Write(newFixedDocSeq);

       newXPSDoc.Close();

       // add file to list

       xpsDecFiles.Add(decFileName);

      }

    }

  }

  returnxpsDecFiles;

}

 

BindingProxy is not working at design time

$
0
0

I am using a binding proxy to bind top-level data from a viewmodel in a datagrid template column as shown below.

The issue I have is that while it works at runtime, it does not work within the IDE designer.

I can use a ContentControl however, I also use the binding proxy with a third party control which cannot access elements in a ContentControl so I would like to make the binding proxy work.

Can anyone help?

DesignTime View

DesignTime View

Runtime View

Runtime View

The following example uses a top-level string property named BrushProvider to simplify the illustration. The actual requirement is to use an object which will be passed to a multivalueconverter within the datatemplate

BindingProxy.cs - from this Blog

using System.Windows;

namespace BindingProxyIssue.Classes
{
	public class BindingProxy : Freezable
	{
		public static readonly DependencyProperty DataProperty = DependencyProperty.Register("Data", typeof (object), typeof (BindingProxy));

		protected override Freezable CreateInstanceCore()
		{
			return new BindingProxy();
		}

		public object Data
		{
			get { return GetValue(DataProperty); }
			set { SetValue(DataProperty, value); }
		}
	}
}

MyDataLine.cs

using System.Windows;

namespace BindingProxyIssue.Classes
{
	public class MyDataLine : DependencyObject
	{
		public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(MyDataLine));
		public static readonly DependencyProperty NumberProperty = DependencyProperty.Register("Number", typeof(int), typeof(MyDataLine));

		public int Number
		{
			get { return (int)GetValue(NumberProperty); }
			set { SetValue(NumberProperty, value); }
		}
		public string Text
		{
			get { return (string)GetValue(TextProperty); }
			set { SetValue(TextProperty, value); }
		}
	}
}

MyDataViewModel.cs

using System.Collections.ObjectModel;
using System.Windows;

namespace BindingProxyIssue.Classes
{
    public class MyDataViewModel : DependencyObject
    {
        public static readonly DependencyProperty BrushProviderProperty = DependencyProperty.Register("BrushProvider",
          typeof(string), typeof(MyDataViewModel), new PropertyMetadata(null));

        private readonly ObservableCollection<MyDataLine> _dataLines = new ObservableCollection<MyDataLine>();

        public MyDataViewModel()
        {
            BrushProvider = "StandardMap";
            for(var n=0 ; n<5; n++)
                _dataLines.Add(new MyDataLine { Text = "This is Line level Text ", Number = n});
        }

        //This property would be an object - is set to a string to illustrate the issue
        public string BrushProvider
        {
            get { return (string)GetValue(BrushProviderProperty); }
            set { SetValue(BrushProviderProperty, value); }
        }
        public ObservableCollection<MyDataLine> DataLines
        {
            get { return _dataLines; }
        }
    }
}
MainWindow.xaml
<Window x:Class="BindingProxyIssue.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:classes="clr-namespace:BindingProxyIssue.Classes"
        Title="MainWindow" Height="350" Width="525"><Window.DataContext><classes:MyDataViewModel/></Window.DataContext><Grid><Grid.Resources><classes:ForegroundConverter x:Key="ForegroundConverter" /><classes:BindingProxy x:Key="DataProxy" Data="{Binding BrushProvider}"/></Grid.Resources><DataGrid AutoGenerateColumns="False" DataContext="{Binding}" ItemsSource="{Binding DataLines}"><DataGrid.Columns><DataGridTextColumn Header="Num" Binding="{Binding Number}"/><DataGridTextColumn Header="Text" Binding="{Binding Text }"/><DataGridTemplateColumn Header="Template" Width="120"><DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding Path=Data, Source={StaticResource DataProxy}}"><!--<TextBlock.Foreground><MultiBinding Converter="{StaticResource ForegroundConverter}"><Binding Path="Number"/><Binding Path="Data" Source="{StaticResource DataProxy}"/></MultiBinding></TextBlock.Foreground>
                                --></TextBlock></DataTemplate></DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn></DataGrid.Columns></DataGrid></Grid></Window>

Mr Ivaylo Yotov

$
0
0
Hello I need help to uninstall google chrome with scam. 

Activating Dragon Naturally Speaking Full-Text Control feature in a WPF application

$
0
0

Hi,

This might be a long shot, but Nuance support redirected me here.

A bit of context:

I'm trying to use Dragon Naturally Speaking with my WPF application.

They have a feature called "Full-Text Control" that allows you to correct, replace text etc... with voice commands.

Dragon comes with a toolbar that hovers at the top of the screen. Inside that bar, there's a Checkmark icon that turns green when the current focused RichTextBox supports "Full-Text Control"

This feature isn't working with WPF and I'm using a RichTextBox like I'm supposed to.

If i use WinForms, everything works fine.

Has anyone encountered this?

Can I implement something so my RichTextBox/application supports FTC?

How does Dragon evaluate if a RichTextBox/application supports FTC?

Regards,

Nicolas

Prevent drop-down menu to close

$
0
0

I have a big problem. I want to prevent an opened drop-down menu to close when hovering another menu item. How can I achieve this? Thanks.

Regards Marius

WPF: how to ensure Foreground setting in style template only affect TabItem Header and not affect control's text inside tab?

$
0
0

Our application uses WPF. One window includes tab control. Tab header Text is displayed as Black.

when select tab, we want the selected tab display different foreground for Tab Header text. For example, change the Foreground to "White".

We have create following style template for TabItem. In the <ControlTemplate.Trigger> section, when tab is selected, we try to set Foreground to "White". 

<!--<Setter Property="Foreground" Value="White" />-->

What we notice, the Foreground setting applies to all control's text (Label, TextBlock, Buttons...) inside the Selected tab. 

<ControlTemplate x:Key="TabItemControlTemplate01" TargetType="{x:Type TabItem}"><ControlTemplate.Resources><Storyboard x:Key="Storyboard1"/></ControlTemplate.Resources><Grid Height="80" MinWidth="125"><Border x:Name="Border" Margin="0,0,0,0"
				BorderBrush="{x:Null}" CornerRadius="0" BorderThickness="0" ><Border.Background><LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"><GradientStop Color="#FFDBEEFF" Offset="0.246"/><GradientStop Color="#FFA7CCED" Offset="1"/></LinearGradientBrush></Border.Background><ContentPresenter x:Name="ContentSite" VerticalAlignment="Center"
					HorizontalAlignment="Center"
					ContentSource="Header" Margin="2,2,2,2"
					RecognizesAccessKey="True"></ContentPresenter></Border><Rectangle x:Name="rectangle" HorizontalAlignment="Left" Height="4" Margin="0,76,0,0" Stroke="{x:Null}" VerticalAlignment="Top" Width="170" StrokeThickness="0" d:CopyToken="64b87611-7ebf-482c-b9f1-e10935bd6b33" Fill="{x:Null}"/><Rectangle x:Name="rectangle1" HorizontalAlignment="Left" Height="4" Margin="0,76,0,0" Stroke="{x:Null}" StrokeThickness="0" VerticalAlignment="Top" Width="170"><Rectangle.Fill><LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"><GradientStop Color="#FF5C84B0" Offset="0"/><GradientStop Color="#FFC7DFF9" Offset="1"/><GradientStop Color="#FF6E93BB" Offset="0.349"/><GradientStop Color="#FF7FA0C6" Offset="0.694"/></LinearGradientBrush></Rectangle.Fill></Rectangle><Rectangle x:Name="glow" HorizontalAlignment="Left" Height="76" Margin="0" Stroke="{x:Null}" StrokeThickness="0" VerticalAlignment="Top" Width="170" Fill="{x:Null}"/></Grid><ControlTemplate.Triggers><Trigger Property="TabItem.IsSelected" Value="True"><Setter Property="Panel.ZIndex" Value="100" /><Setter TargetName="Border" Property="Background" Value="{StaticResource ButtonSelecteddBackgroundFill}"/><Setter TargetName="Border" Property="BorderThickness" Value="0" /><!--<Setter Property="Foreground" Value="White" />--><Setter Property="Fill" TargetName="rectangle"><Setter.Value><LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"><GradientStop Color="White" Offset="0.112"/><GradientStop Color="#FFE0E0E0" Offset="0.155"/><GradientStop Color="Gainsboro" Offset="0.866"/><GradientStop Color="#FF767676" Offset="0.957"/></LinearGradientBrush></Setter.Value></Setter><Setter Property="Fill" TargetName="rectangle1" Value="{x:Null}"/><Setter Property="Width" TargetName="glow" Value="125"/><Setter Property="Margin" TargetName="glow" Value="0"/><Setter Property="Height" TargetName="glow" Value="76"/><Setter Property="Fill" TargetName="glow"><Setter.Value><RadialGradientBrush Center="0.5,1.001" GradientOrigin="0.5,1.001" RadiusY="0.618" RadiusX="0.618"><GradientStop Color="Transparent" Offset="1"/><GradientStop Color="#4CFFFFFF" Offset="0"/></RadialGradientBrush></Setter.Value></Setter></Trigger><Trigger Property="IsEnabled" Value="False"><Setter TargetName="Border" Property="Background" Value="DarkRed" /><Setter TargetName="Border" Property="BorderBrush" Value="Black" /><Setter Property="Foreground" Value="DarkGray" /></Trigger></ControlTemplate.Triggers></ControlTemplate>

we apply this TabItem template in following way:

<TabItem  x:Name="tabItemService" Template="{StaticResource TabItemControlTemplate01}"
           Style="{StaticResource TabItemControlStyle}" Width="{Binding TabHeaderWidth}"><TabItem.Header><DockPanel><Image Name="Developer" Height="55" Width="auto" Source="/Resources/Images/Info.png" DockPanel.Dock="Top"/><TextBlock Style="{StaticResource TabTextStyle}" Margin="5,5" DockPanel.Dock="Bottom" FontFamily="Eras ITC" FontSize="13" Text="Service"/></DockPanel></TabItem.Header><views:ServiceView    x:Name="ServiceView" VerticalAlignment="Top" Height="615"/></TabItem>
How can we only change TabItem.Header Foreground and not affect other controls' text foreground? Thx! 


JaneC




WPF: What is simple way to implement Tab control

$
0
0

Our application uses WPF.

One Window includes TabControl. Each tab header includes image and text.

When the tab is selected, we need to show different image and text in different color.

One way is to create a customized control which include image and textblock. And one of dependency property is "Select".

When Select is true, use different image and set different Foreground for textblock.

Our question, could we use style to achieve this? thx!


JaneC


Is it possible to pass current DataContext as ContructorParameter of ObjectDataProvider?

$
0
0

It would be very useful to pass DataContext as parameter for DataTemplate:

<DataTemplate><DataTemplate.Resources><ObjectDataProvider x:Key="ServiceDataProvider" ObjectType="{x:Type control:ServiceLayout}"><ObjectDataProvider.ConstructorParameters>
                /*here could be DataContext..but how?*/</ObjectDataProvider.ConstructorParameters></ObjectDataProvider></DataTemplate.Resources><ContentPresenter
               Content="{Binding
                    Source={StaticResource ServiceDataProvider}}" /></DataTemplate>

I will use this DataTemplate in ListBox ItemTemplate. So, DataContext will be ListBoxItem bound object (type is known), and it is not very well to use ViewModel added as static resource as in https://social.msdn.microsoft.com/forums/vstudio/en-US/38a80213-9e72-44fc-8338-1a8bcfcf9c9f/objectdataprovider-binds-to-datacontext

May be there are any other ways to pass parameter to constructor from DataTemplate?

Debugging issue with WPF

$
0
0

Hello,

  I am trying to debug some of my code for a set of WPF buttons.   I am stuck with an issue that I cannot get around.  When I launch the debugger from Visual Studio 2013, I get the following in the web browser:

Info icon

An error occurred in the application you were using


You can try the following:


  • Restart the application.
  • Click the "More Information" link below for
    details about this error.

Less InformationLess Information

<textarea cols="1" id="errorInfo" readonly="readonly" rows="1" style="width:752px;height:650px;display:block;" wrap="off">Startup URI: \\mrm2inc.com\Users\Michael.Mastro2\Documents\Visual Studio 2013\Projects\HomeInventoryWebForms\HomeInventoryWebForms\bin\Debug\HomeInventoryWebForms.xbap Application Identity: file://mrm2inc.com/Users/Michael.Mastro2/Documents/Visual%20Studio%202013/Projects/HomeInventoryWebForms/HomeInventoryWebForms/bin/Debug/HomeInventoryWebForms.xbap#HomeInventoryWebForms.xbap, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fc075058c6cf26e0, processorArchitecture=msil/HomeInventoryWebForms.exe, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fc075058c6cf26e0, processorArchitecture=msil, type=win32 System.Security.Policy.PolicyException: Execution permission cannot be acquired. at System.Runtime.Hosting.ApplicationActivator.CreateInstanceHelper(AppDomainSetup adSetup) at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData) at System.Windows.Interop.PresentationApplicationActivator.CreateInstance(ActivationContext actCtx) at System.Activator.CreateInstance(ActivationContext activationContext) at System.Windows.Interop.ApplicationLauncherXappDebug.Initialize() at System.Windows.Interop.DocObjHost.MS.Internal.AppModel.IBrowserHostServices.Run(String path, String fragment, MimeType mime, String debugSecurityZoneURL, String applicationId, Object streamContainer, Object ucomLoadIStream, HostingFlags hostingFlags, INativeProgressPage nativeProgressPage, String progressAssemblyName, String progressClassName, String errorAssemblyName, String errorClassName, IHostBrowser hostBrowser) ----------------------- PresentationHost.exe v4.0.41210.0 built by: Main - C:\Windows\SysWOW64\PresentationHost.exe ntdll.dll v6.3.9600.17031 (winblue_gdr.140221-1952) - C:\Windows\SYSTEM32\ntdll.dll KERNEL32.DLL v6.3.9600.17031 (winblue_gdr.140221-1952) - C:\Windows\SYSTEM32\KERNEL32.DLL KERNELBASE.dll v6.3.9600.17031 (winblue_gdr.140221-1952) - C:\Windows\SYSTEM32\KERNELBASE.dll ADVAPI32.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\ADVAPI32.dll USER32.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\USER32.dll msvcrt.dll v7.0.9600.17415 (winblue_r4.141028-1500) - C:\Windows\SYSTEM32\msvcrt.dll ole32.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\ole32.dll OLEAUT32.dll v6.3.9600.17415 - C:\Windows\SYSTEM32\OLEAUT32.dll mscoree.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\mscoree.dll SHLWAPI.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\SHLWAPI.dll WININET.dll v11.00.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\WININET.dll urlmon.dll v11.00.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\urlmon.dll SHELL32.dll v6.3.9600.17031 (winblue_gdr.140221-1952) - C:\Windows\SYSTEM32\SHELL32.dll sechost.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\sechost.dll RPCRT4.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\RPCRT4.dll GDI32.dll v6.3.9600.17415 (winblue_r4.141028-1500) - C:\Windows\SYSTEM32\GDI32.dll combase.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\combase.dll iertutil.dll v11.00.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\iertutil.dll USERENV.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\USERENV.dll SspiCli.dll v6.3.9600.17415 (winblue_r4.141028-1500) - C:\Windows\SYSTEM32\SspiCli.dll profapi.dll v6.3.9600.17415 (winblue_r4.141028-1500) - C:\Windows\SYSTEM32\profapi.dll CRYPTBASE.dll v6.3.9600.17415 (winblue_r4.141028-1500) - C:\Windows\SYSTEM32\CRYPTBASE.dll bcryptPrimitives.dll v6.3.9600.17415 (winblue_r4.141028-1500) - C:\Windows\SYSTEM32\bcryptPrimitives.dll IMM32.DLL v6.3.9600.17415 (winblue_r4.141028-1500) - C:\Windows\system32\IMM32.DLL MSCTF.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\MSCTF.dll shcore.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\shcore.dll PresentationHost_v0400.dll v4.0.30319.33440 built by: FX45W81RTMREL - C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\PresentationHost_v0400.dll MSVCR120_CLR0400.dll v12.00.51670.34230 built by: FX452RTMGDR - C:\Windows\SYSTEM32\MSVCR120_CLR0400.dll VERSION.dll v6.3.9600.17415 (winblue_r4.141028-1500) - C:\Windows\SYSTEM32\VERSION.dll PSAPI.DLL v6.3.9600.17415 (winblue_r4.141028-1500) - C:\Windows\SYSTEM32\PSAPI.DLL kernel.appcore.dll v6.3.9600.17415 (winblue_r4.141028-1500) - C:\Windows\SYSTEM32\kernel.appcore.dll uxtheme.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\system32\uxtheme.dll ltc_help32-91954.dll v1, 0, 0, 1 - C:\PROGRA~2\Raptr\ltc_help32-91954.dll WINTRUST.dll v6.3.9600.17415 (winblue_r4.141028-1500) - C:\Windows\SYSTEM32\WINTRUST.dll CRYPT32.dll v6.3.9600.16431 (winblue_gdr.131015-2301) - C:\Windows\SYSTEM32\CRYPT32.dll MSASN1.dll v6.3.9600.17415 (winblue_r4.141028-1500) - C:\Windows\SYSTEM32\MSASN1.dll clbcatq.dll v2001.12.10530.17415 (winblue_r4.141028-1500) - C:\Windows\SYSTEM32\clbcatq.dll CRYPTSP.dll v6.3.9600.17415 (winblue_r4.141028-1500) - C:\Windows\SYSTEM32\CRYPTSP.dll rsaenh.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\system32\rsaenh.dll bcrypt.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\bcrypt.dll ieproxy.dll v11.00.9600.17496 (winblue_r5.141121-1500) - C:\Program Files (x86)\Internet Explorer\ieproxy.dll PROPSYS.dll v7.00.9600.17031 (winblue_gdr.140221-1952) - C:\Windows\SYSTEM32\PROPSYS.dll dfshim.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\dfshim.dll mscoreei.dll v4.0.30319.34209 built by: FX452RTMGDR - C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll clr.dll v4.0.30319.34209 built by: FX452RTMGDR - C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Secur32.dll v6.3.9600.17415 (winblue_r4.141028-1500) - C:\Windows\SYSTEM32\Secur32.dll dwmapi.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\system32\dwmapi.dll msxml3.dll v8.110.9600.17415 - C:\Windows\System32\msxml3.dll actxprxy.dll v6.3.9600.17416 (winblue_r4.141030-1500) - C:\Windows\SYSTEM32\actxprxy.dll sxs.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\sxs.dll PresentationHostProxy.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\PresentationHostProxy.dll comctl32.dll v6.10 (winblue_rtm.130821-1623) - C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.9600.17415_none_a9ed7f470139b3c1\comctl32.dll mscorlib.ni.dll v4.0.30319.34209 built by: FX452RTMGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\d03a3ddcd6a395878751c5e90fa16915\mscorlib.ni.dll System.ni.dll v4.0.30319.34239 built by: FX452RTMGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\System\1a6b5095c4416a37f9ca4cf4436d1311\System.ni.dll WindowsBase.ni.dll v4.0.30319.34209 built by: FX452RTMGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\WindowsBase\bb26d987467eca70ebc4beec29158d67\WindowsBase.ni.dll PresentationCore.ni.dll v4.0.30319.34209 built by: FX452RTMGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\PresentationCore\24f6c80242420a1cea5cc254bf420027\PresentationCore.ni.dll PresentationFramework.ni.dll v4.0.30319.34209 - C:\Windows\assembly\NativeImages_v4.0.30319_32\Presentatio5ae0f00f#\4136b9a7a05c8f0e2c7e15600bc20b1b\PresentationFramework.ni.dll dwrite.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\dwrite.dll wpfgfx_v0400.dll v4.0.30319.34209 built by: FX452RTMGDR - C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\wpfgfx_v0400.dll PresentationNative_v0400.dll v4.0.30319.33440 built by: FX45W81RTMREL - C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\PresentationNative_v0400.dll System.Xaml.ni.dll v4.0.30319.34209 built by: FX452RTMGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Xaml\d626184834dde3f4906aff139d4e5bbf\System.Xaml.ni.dll clrjit.dll v4.0.30319.34209 built by: FX452RTMGDR - C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll System.Xml.ni.dll v4.0.30319.34230 built by: FX452RTMGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Xml\9a349fb029581f4752d2c6cfcfeab816\System.Xml.ni.dll System.Drawing.ni.dll v4.0.30319.34209 built by: FX452RTMGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Drawing\d91798a9a9fcb450351fe8e49026a69f\System.Drawing.ni.dll System.Windows.Forms.ni.dll v4.0.30319.34209 built by: FX452RTMGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Windows.Forms\a4d2243df4af8ab65ff74d436d449789\System.Windows.Forms.ni.dll System.Security.ni.dll v4.0.30319.34209 built by: FX452RTMGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Security\d72f65a6622be86134ba8c534acc10e5\System.Security.ni.dll System.Core.ni.dll v4.0.30319.34209 built by: FX452RTMGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Core\794a3d83e77a53d6fc029c389f9cc408\System.Core.ni.dll System.Deployment.ni.dll v4.0.30319.34243 built by: FX452RTMGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Deployment\84fa9fa9c4be29612f8d268246a0353c\System.Deployment.ni.dll System.Configuration.ni.dll v4.0.30319.34209 built by: FX452RTMGDR - C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Configuration\b5b80f1284dfa1b883da48ed58ecbc47\System.Configuration.ni.dll gpapi.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\gpapi.dll ncrypt.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\ncrypt.dll NTASN1.dll v6.3.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\SYSTEM32\NTASN1.dll diasymreader.dll v12.0.20806.33440 built by: FX45W81RTMREL - C:\Windows\Microsoft.NET\Framework\v4.0.30319\diasymreader.dll uiautomationcore.dll v7.2.9600.16384 (winblue_rtm.130821-1623) - C:\Windows\System32\uiautomationcore.dll </textarea>

Anyone have any ideas how to get around this issue, or fix the issue?


Michael R. Mastro II

Get selected Listbox item

$
0
0

hi,

Can someone tell me  how to know which listboxitem from a listbox was selected by the user?

This is the listboxitem.

<ListBoxItem HorizontalAlignment="Left" Name="Canvas" Foreground="White"  FontSize="60" Background="White" BorderBrush="White" Width="763" Height="72"  >

The following are not working

 if (MyList.SelectedItem.ToString() == "Canvas")
            {
                canvaswindow cw = new canvaswindow();
                cw.Show();
                this.Close();
            }


 private void ListBoxItem_Selected_1(object sender, RoutedEventArgs e)
        {
            if (MyList.SelectedItem.ToString() == "Canvas")
            {
                canvaswindow cw = new canvaswindow();
                cw.Show();
                this.Close();
            }
        }

Thanks,

Shaleen


TheHexLord

How to binding and change VM property value when DataTrigger?

$
0
0

Hi all,

Please see the below code. The current work is when mouse over myButton then set textbox value as 3. Then binding this value to ViewModel property, at this time, the new value of ViewModel property also be 3.

The textbox just like a bridge. Can I remove this bridge and change the VM property directly when <setter..... in myTrigger style? thanks.

<Style x:Key="myTrigger" TargetType="TextBox"><Style.Triggers><DataTrigger Binding="{Binding IsMouseOver, ElementName=myButton}" Value="True"><Setter Property="Text" Value="3"></Setter></DataTrigger></Style.Triggers></Style>

Vertical alignment of DataGrid row content

$
0
0

Hi,

I have a regular DataGrid from WPF 4.0 RTM, where I put data from database. In order to make clean & light style of DataGrid I use a tall/high rows and by default DataGrid aligns row content in top vertical position, but I want to set a center vertical alignment.

I already tried to use this property 

VerticalAlignment="Center"

in DataGrid options, but it doesn't help me.

Here is an example of XAML-code, describing my DataGrid without center vertical alignment:

<DataGridx:Name="ContentDataGrid"Style="{StaticResource ContentDataGrid}"ItemsSource="{Binding}"RowEditEnding="ContentDataGrid_RowEditEnding"><DataGrid.Columns><DataGridTextColumnHeader="UserID"Width="100"IsReadOnly="True"Binding="{Binding Path=userID}"/><DataGridTextColumnHeader="UserName"Width="100"Binding="{Binding Path=userName}"/><DataGridTextColumnHeader="UserAccessLevel"Width="100"Binding="{Binding Path=userAccessLevel}"/><DataGridTextColumnHeader="UserPassword"Width="*"Binding="{Binding Path=userPassword}"/></DataGrid.Columns></DataGrid>

Result of executing this code:

 

As you can see all row's content has top vertical align.

What I have to add in order to get center vertical alignment of each row content?

Thanks.

Set button state base on the state of items in list

$
0
0

Hi everyone,

I'm making an application that helps user to manages their file.
In my application, I have a list of files and a button Delete all.
I want the Delete all button to be disabled when all files in my list are hidden.

Can anyone help me please ?
Thank you :)

Check path if it is in virtual device or not, writable or not

$
0
0

Hi everyone,

I'm currently making an application which encrypt file and users can decrypt the file anytime they want. After encrypting the file, I will delete the original file and when I decrypt, I will re-create the file to original position.

The question is : How can I check if the selected file or folder is in virtual device or removable devices such as CD-ROM ? Because we can not write file on them. 

And how to check if the path is writable or not :) .

Thank you :)



How to change wpf application window icon and icon in task bar at runtime?

$
0
0

Hello,

I am trying to change the icon of my wpf application mainwindow and the one shown in task bar at runtime using Icon property in Window class and some native win32 api's. When I set the new icon the one on the left corner of mainwindow changes but the running application task bar icon does not reflect the change until I pin the running application to task bar then unpin it. (The application that I am running is not pinned to task bar during start)

What I understood that somehow the task bar is not refreshing the icon immediately.

Below is what I have tried.

//IntPtr hwnd = new WindowInteropHelper(this).Handle;
// Change the extended window style to not show a window icon
//int extendedStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
//SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle | WS_EX_DLGMODALFRAME);
// Update the window's non-client area to reflect the changes
//SetWindowPos(hwnd, IntPtr.Zero, 0, 0, 0, 0, SWP_NOMOVE |
//	  SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
//var icon = new System.Drawing.Icon(@"Icon1.ICO");
//ShowInTaskbar = false;
//SendMessage(hwnd, WM_SETICON, (IntPtr)1, icon.Handle);
//SendMessage(hwnd, WM_SETICON, (IntPtr)0, icon.Handle);
//ShowInTaskbar = true;
//SendMessage(GetWindow(hwnd, 4), WM_SETICON, (IntPtr)1, icon.Handle);
//SendMessage(GetWindow(hwnd, 4), WM_SETICON, (IntPtr)0, icon.Handle);
//TaskbarItemInfo.Overlay = new BitmapImage(new Uri(@"App.ico",UriKind.RelativeOrAbsolute));
Icon = new BitmapImage(new Uri("cool.ico", UriKind.RelativeOrAbsolute);

Any help or guidance would be much appreciated.

Thanks

Anshul


Problem with focus

$
0
0

I have a problem setting focus in one of my apps.  The app has a "toolbar" which is just a panel with buttons.  When a button is clicked the appropriate Popup control is made visible.  Each Popup has its own UC for content.

When I open one of the UC's it has several text search controls (my own) which is just a textbox with another popup visible if items are available for selection.  I am trying to get the first of the search controls to obtain focus when the parent popup is made visible.  I have had so many combinations of FocusManager and Keyboard attempts I am now confused.  

It seems that the button which caused the popup to become visible still has the focus no matter what I do.

I've read lots of posts about the problems with focus but none of them have helped my problem.


Lloyd Sheen

Binded Datagrid displays System.Data.Datarow as data

$
0
0

Using VS2010 C#

Hi All,

I am having a really annoying issue which I know there's an easy fix for, but i cannot figure it out for the life of me. My goal is to copy info from an excel sheet to the datagrid. To achieve this, I am taking the clipboard and creating a datatable, and from the datatable --> datagrid. I have finally got the datagrid to display the correct column names and number of rows, but the records are showing "System.Data.Row" instead of the row's ItemArray. I've debugged the datatable and the correct info is right there in the ItemArray properties. Can someone please help me resolve this issue?

Thanks in Advance!!!

Here's my code:

private void button1_Click(object sender, RoutedEventArgs e)
        {
            string s = System.Windows.Clipboard.GetText();
            string[] lines = s.Split('\n');

            string[] columnsNames = lines[0].Split('\t');
            lines = lines.Where(w => w != lines[0]).ToArray();
            DataTable dt = new DataTable();
            DataRow dr;
            List<DataRow> list = new List<DataRow>();

            foreach (string str in columnsNames)
            {
                dt.Columns.Add(str, typeof(string));
                DataGridTextColumn dgtxcol = new DataGridTextColumn();
                dgtxcol.Header = str;
                dataGrid1.Columns.Add(dgtxcol);
                dgtxcol.Binding = new Binding(".");
            }

            for (int row = 0; row < lines.Length; row++)
            {
                string[] rowInfo = lines[row].Split('\t');
                dr = dt.NewRow();
                for (int z = 0; z < rowInfo.Length; z++)
                {
                    if (rowInfo[z].Contains('\r'))
                        rowInfo[z] = rowInfo[z].Replace('\r', ' ');
                    dr[columnsNames[z]] = rowInfo[z];
                }
                dt.Rows.Add(dr);
            }
            list = dt.AsEnumerable().ToList();
            dataGrid1.ItemsSource = list;
            string name = ((DataRow)dataGrid1.Items[0]).ToString();
        }

        private void dataGrid1_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            e.Row.Header = (e.Row.GetIndex()+1).ToString();
        }

<Window x:Class="ClipboardToWPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="500" Width="846" WindowStartupLocation="CenterScreen" Loaded="Window_Loaded"><Grid><DataGrid ItemsSource="{Binding}" AutoGenerateColumns="False" Height="346" HorizontalAlignment="Left" Margin="12,103,0,0" Name="dataGrid1" VerticalAlignment="Top" Width="800" LoadingRow="dataGrid1_LoadingRow" CanUserAddRows="True"></DataGrid><Button Content="PASTE" Height="39" HorizontalAlignment="Left" Margin="691,33,0,0" Name="button1" VerticalAlignment="Top" Width="96" Click="button1_Click" /></Grid></Window>

Best way to parse .Msg file of Outlook?

print wpf datagrid as WYSIWYG

$
0
0

WPF - Vb net

--------------------------------

hi, I have search more than I thought that I would search of how to print a datagrid as it is (styles borders,lines etc..) . i have try several ways but with out any acceptable solution.

1) i try to place my datagrid in a FlowDocument inside a BlockUIContainer but this didn't work since my datagrid rows  are grater than one page , the blockuiContainer don't work with multiple pages.

2) i try to use the method Print.Visual(DG,"TEST") again this didn't work because it dose not support multipage

3) i try to convert the datagrid in to an image and then print it with several internet solutions but some times the last row is half in the first page and the other half on the other page.

4) Is there any one ,anything ,something that knows how to print the datagrid as its , am kindly asking your help. am stack on this for the last 1 week. i check almost all the posts links etc..
Please help.


stelios ----------


Viewing all 18858 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>