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

Image in usercontrol does not update

$
0
0

Dear Community,

after I learnt quite a bit from my last thread, I ran into the next problem. The binding and updating inside my user control work but sadly only for a label and not for an image. I found a similar problem in a thread on the msdn (Title: user control, Image and ImageSource) but I could not adapt the solution. My guess would be that I got somehow confused by the whole bitmap/imagesource/imagestream-thing and use the wrong dependency property configuration.

To give a small overview: In my programm I bind a string property to a label in the usercontrol and a writeablebitmap to an image. In both cases I set up a dependecy property and the label changes when the string changes. The remaining problem is that my writeablebitmap does not show up in the usercontrol.

My whole problem solving goes around in circles, so I hope you can give me some fresh input.

Thank you very much in advance and best regards,

Apfelman

Below you can see the code for my usercontrol:

ViewImageData.xml

<UserControl x:Class="CollectionMVVMExample.View.ViewImageData"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:CollectionMVVMExample.View"
             xmlns:vm="clr-namespace:CollectionMVVMExample.ViewModel"
             mc:Ignorable="d"
             d:DesignHeight="450" d:DesignWidth="520"
             Name="ImageDataControl"><Grid><StackPanel Margin="4"><Label x:Name="lbl_Image" FontSize="14" Content="{Binding Path=DisplayLabel, ElementName=ImageDataControl}"/><Image x:Name="img_Image" Height="424" Source="{Binding Path=BMPSource, ElementName=ImageDataControl}"/></StackPanel></Grid></UserControl>

ViewImageData.xaml.cs

using CollectionMVVMExample.ViewModel;
using System;
using System.Drawing;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;


namespace CollectionMVVMExample.View
{
    /// <summary>
    /// Interaktionslogik für ViewImageData.xaml
    /// </summary>
    public partial class ViewImageData : UserControl
    {

        #region DependencyProperty
        public String DisplayLabel
        {
            get { return (String)GetValue(DisplayLabelProperty); }
            set { SetValue(DisplayLabelProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Source.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty DisplayLabelProperty =
            DependencyProperty.Register("DisplayLabel", typeof(String), typeof(ViewImageData), null);



        public WriteableBitmap BMPSource
        {
            get { return (WriteableBitmap)GetValue(BMPSourceProperty); }
            set { SetValue(BMPSourceProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Source.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty BMPSourceProperty =
            DependencyProperty.Register("BMPSource", typeof(WriteableBitmap), typeof(ViewImageData), null);
        #endregion

        #region Constructor
        public ViewImageData()
        {
            InitializeComponent();

        }
        #endregion

    }
}

Snippet out of my MainWindow.xaml

<view:ViewImageData x:Name="uc_IR_ViewModel" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Center"
                            BMPSource="{Binding IR_ViewModel.DisplayImage}"
                            Content="{Binding IR_ViewModel.ImageLabel}"
                            />


WPF: How to make TextBox only allow enter certain range of numbers?

$
0
0

In our WPF application, we need to restrict a TextBox to only allow to enter number from 5 to 9999.

In WPF, we could implement the following to only allow the number input

in XAML, define TextBox's PreviewTextInput = "NumericOnly"

private void NumericOnly(object sender, TextCompositionEventArgs e) { e.Handled = Utility.IsTextNumeric(e.Text); }

public static bool IsTextNumeric(string str)
{
      Regex reg = new Regex("[^0-9]");
      return reg.IsMatch(str);
}
To only 9999, we can set TextBox MaxLength = "4".

We know we could use validation input value to achieve the goal.

Is there a easy way to only allow number from 5 to 9999 by TextBox? Thx!


JaneC


XBAP with ASP.Net application throws error when Anonymous Authenticaion is disabled on IIS

$
0
0

I have XBAP application and this application has integrated into ASP.Net application. It was hosted into IIS. It work perfect when Anonymous Authentication is enabled. But application throws error when it is disabled. The error is as follows.

HTTP Error 401.2 - Unauthorized

You are not authorized to view this page due to invalid authentication headers.

I searched Google but did not find any solution yet.

Can anybody give me hints?

Custom WPF-validation rules crash designer

$
0
0

Hi,

we're encountering a strange issue with custom validation rules. When designing a WPF-UserControl everything is fine until with add custom made validation rules to any binding. Once we did that, the designer instantly crashes with a NullReferenceException. The displayed callstack ends in BindingExpressionBase.Validate.

We played around to narrow the problem down, but everything we learned is:

- Using build-in validation rules works
- The exception is not caused within the custom validation rule. We created a blank rule without any logic, always returning "Valid" and the problem occurs
- The exception occurs wether the rule is defined in the same or a different project.
- Commenting the validation rules out instantly restores the designer
- The validation rules do work as expected at runtime

Sample XAML-code:

<ComboBox
  DisplayMemberPath="Name"
  Margin="120 0 0 0"
  Name="SomeComboBox"><ComboBox.SelectedItem><Binding
      Mode="OneWayToSource"
      Path="SomePath"><Binding.ValidationRules><validationRules:NotNullValidationRule
         ValidationStep="RawProposedValue"
         /></Binding.ValidationRules></Binding></ComboBox.SelectedItem></ComboBox>

Exception details:

System.NullReferenceException
Object reference not set to an instance of an object.
   at System.Windows.Data.BindingExpressionBase.Validate(Object value, ValidationStep validationStep)
   at System.Windows.Data.BindingExpression.Validate(Object value, ValidationStep validationStep)
   at System.Windows.Data.BindingExpressionBase.UpdateValue()
   at System.Windows.Data.BindingExpression.Activate(Object item)
   at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
   at System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance)
   at MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance)
   at MS.Internal.Data.DataBindEngine.Run(Object arg)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.DesignerProcess.RunApplication()
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.DesignerProcess.<>c__DisplayClass5_0.<Main>b__0()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Any ideas?

XAML binding to CompositeCollection

$
0
0

I have only one datagrid in a single view but the collections which are ItemsSource's of this datagrid are in different View Models. So is it possible to bind this single datagrid in view with the collections in two different View Models?

For each row in the grid, display an item from one collection, and an item from the other collection..! to display all columns in one row.

xaml:

DataContext="{DynamicResource ViewModelCombine}"><Window.Resources><vm:ViewModelCombine x:Key="ViewModelCombine"/></Window.Resources><Grid><Grid.RowDefinitions><RowDefinition Height="Auto"/></Grid.RowDefinitions><DataGrid><DataGrid.Resources><CollectionViewSource x:Key="ViewModelPulse" Source="{Binding VP}"/><CollectionViewSource x:Key="ViewModeltherapy" Source="{Binding VT}"/></DataGrid.Resources><DataGrid.ItemsSource><CompositeCollection><CollectionContainer Collection="{Binding Source={StaticResource ViewModelCombine}, Path=VP}" /><CollectionContainer Collection="{Binding Source={StaticResource ViewModelCombine}, Path=VT}" /></CompositeCollection></DataGrid.ItemsSource><DataGrid.Columns><DataGridTextColumn Header="AMP" Binding="{Binding AMP}" Width="100"/><DataGridTextColumn Header="PW" Binding="{Binding PW}" Width="100" /><DataGridTextColumn Header="DZ0" Binding="{Binding DZ0}" Width="100" /><DataGridTextColumn Header="DELTA" Binding="{Binding DELTA}" Width="100" /><DataGridTextColumn Header="DZ1" Binding="{Binding DZ1}"   Width="100"/><DataGridTextColumn Header="M" Binding="{Binding M}" Width="100" /><DataGridTextColumn Header="DZ2" Binding="{Binding DZ2}" Width="100" /><DataGridTextColumn Header="N" Binding="{Binding N}" Width="100" /></DataGrid.Columns></DataGrid></Grid> 

xaml.cs:

public MainWindow()
    {
        InitializeComponent();
        ViewModelCombine VMC = new ViewModelCombine();
        this.DataContext = VMC;
    } 

ViewModelCombine.cs

public class ViewModelCombine
{
    public ViewModelTherapy VT { get; set; }
    public ViewModelPulse VP { get; set; }

    public ViewModelCombine()
    {
        VT = new ViewModelTherapy();
        VP = new ViewModelPulse();
    }
 } 

As per the above code, it displays like above..but, wanted to display all columns in one row.

So is it possible to bind this single datagrid in view with the collections in two different View Models?

Thanks for your help.



Set WPF windows behave like WIN form when DPI changed

$
0
0

I have an application in mixed up by windows form and WPF. Main screen is developed by windows form and there are couples of screen developed using WPF. These WPF screens are launched from the main screen. After launched WPF screen, main screen become smaller and texts changed smaller. Reference to http://www.dotnetfunda.com/articles/show/882/wpf-tutorial-a-beginning-1 . WPF is independent to DPI setting. Is there anyway to set WPF depended on DPI setting like window form?

Datagrid doesn't delete row on delete key press

$
0
0

I made a WPF application and had a datagrid bound to a List<Table>.  I displayed the Name property of the table for each row. I used the CanUserDeleteRows option.  When I pressed the delete key, the row was deleted not only from the display, but my list.

Now I have refactored and I have a Dictionary<String,Table> instead.  I am displaying the Value.Name.

The Datagrid is displaying the proper information, but now when I press the delete key, nothing happens.

Is that how it is supposed to work, or am I missing something?

If I have to code the delete myself, how do I make that happen?

XAML binding to CompositeCollection

$
0
0

I have only one datagrid in a single view but the collections which are ItemsSource's of this datagrid are in different View Models. So is it possible to bind this single datagrid in view with the collections in two different View Models?

For each row in the grid, display an item from one collection, and an item from the other collection..! to display all columns in one row.

xaml:

DataContext="{DynamicResource ViewModelCombine}"><Window.Resources><vm:ViewModelCombine x:Key="ViewModelCombine"/></Window.Resources><Grid><Grid.RowDefinitions><RowDefinition Height="Auto"/></Grid.RowDefinitions><DataGrid><DataGrid.Resources><CollectionViewSource x:Key="ViewModelPulse" Source="{Binding VP}"/><CollectionViewSource x:Key="ViewModeltherapy"Source="{Binding VT}"/></DataGrid.Resources><DataGrid.ItemsSource><CompositeCollection><CollectionContainer Collection="{Binding Source={StaticResource ViewModelCombine}, Path=VP}" /><CollectionContainerCollection="{Binding Source={StaticResource ViewModelCombine}, Path=VT}"/></CompositeCollection></DataGrid.ItemsSource><DataGrid.Columns><DataGridTextColumnHeader="AMP"Binding="{Binding AMP}"Width="100"/><DataGridTextColumnHeader="PW"Binding="{Binding PW}"Width="100"/><DataGridTextColumnHeader="DZ0"Binding="{Binding DZ0}"Width="100"/><DataGridTextColumnHeader="DELTA"Binding="{Binding DELTA}"Width="100"/><DataGridTextColumnHeader="DZ1"Binding="{Binding DZ1}"Width="100"/><DataGridTextColumnHeader="M"Binding="{Binding M}"Width="100"/><DataGridTextColumnHeader="DZ2"Binding="{Binding DZ2}"Width="100"/><DataGridTextColumnHeader="N"Binding="{Binding N}"Width="100"/></DataGrid.Columns></DataGrid></Grid>

xaml.cs:

publicMainWindow(){InitializeComponent();ViewModelCombine VMC =newViewModelCombine();this.DataContext= VMC;}

ViewModelCombine.cs

publicclassViewModelCombine{publicViewModelTherapy VT {get;set;}publicViewModelPulse VP {get;set;}publicViewModelCombine(){
        VT =newViewModelTherapy();
        VP =newViewModelPulse();}}

As per the above code, it displays like above..but, wanted to display all columns in one row.

So is it possible to bind this single datagrid in view with the collections in two different View Models?

Thanks for your help.


How to detect if point is within the boundary of a control, following transformations?

$
0
0
I have a WPF application that is communicating with a touch screen controller. The XY coordinates are fed into the PC via USB and this triggers an event inside my WPF code. Currently I draw an elipse on the WPF screen to show the posistion of my co-ordinate, this works fine.

 I also have a WPF image on my application and I want to drag and drop this. Now I could just check if X > image1.Location.X and < image1.location.X + image1.ActualWidth

(same for Y) to find out if it is within the rectangular area that my image is draw in.

However this stops working if apply a rotate transform to the image. Is there any function in WPF where I can feed in my coordinate and I can get a bool to tell me if the point was within the boundaries of the control, or if 2 shapes intersect each other?

I have searched everywhere and there seems to be no easy answer.

Dan

DataGrid.BeginEdit ()

$
0
0

DataGrid.BeginEdit ()

DataGrid.CommitEdit ()

DataGrid.CancelEdit

Please Help Me understand. Where I can use this metods?

MEF and Prism6

$
0
0

First of all is there a better forum for this question?
I am trying to understand Prism and MEF and can make it work with a single module in a directory.
The modules are very simple, just putting a message into a region.  They are all of type IFunction and are decorated with:-  
    [ModuleExport(typeof(IFunction))]
    [ExportMetadata("data","ABC")]
    public class ModuleAModule : IModule, IFunction
    {......
where Ifunction is an interface with just an Initialize method
What I am trying to do is get the modules into the IEnumerable 'functions' so I can get at them (eg to make a menu) but whatever I do 'functions' stays null although the module are put in the catalogue.
One message I get, which does not cause an design or run time error, is:
error CS1503: Argument 1: cannot convert from 'System.ComponentModel.Composition.Primitives.ComposablePartCatalog' to 'System.ComponentModel.Composition.Hosting.DirectoryCatalog'
With MEF Bootstrapper doing so much I find it very difficult to work out what is going on and debug.
The code below was drawn from reading a lot of tutorials.  Some were pretty old and that might be part of my difficulty, Prism and MEF are still changing pretty fast.
Can anyone point me in the right direction, or to an up-to-date sample or tutorial.

    public class Bootstrapper : MefBootstrapper
    {
        [ImportMany(typeof(IFunction))]
        public IEnumerable<Lazy<IFunction, IFunctionData>> functions { get; set; }
        protected override DependencyObject CreateShell()
        {
            return Container.GetExportedValue<MainWindow>();
        }
        protected override void InitializeShell()
        {
            Application.Current.MainWindow.Show();
        }
        protected override void ConfigureAggregateCatalog()
        {
            base.ConfigureAggregateCatalog();
            AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly));
            string dir = General.ModuleDirectory;  // from elsewhere in the program
            DirectoryCatalog catalog = new DirectoryCatalog(dir);
            AggregateCatalog.Catalogs.Add(catalog);
        }
        protected override void ConfigureViewModelLocator()
        {
            base.ConfigureViewModelLocator();
            ViewModelLocationProvider.SetDefaultViewTypeToViewModelTypeResolver(viewType =>
            {
                var viewName = viewType.FullName;
                viewName = viewName.Replace(".Views.", ".ViewModels.");
                var viewAssemblyName = viewType.GetTypeInfo().Assembly.FullName;
                var suffix = viewName.EndsWith("View") ? "Model" : "ViewModel";
                var viewModelName = String.Format(CultureInfo.InvariantCulture, "{0}{1}", viewName, suffix);
                var assembly = viewType.GetTypeInfo().Assembly;
                var type = assembly.GetType(viewModelName, true);
                return type;
            });
        }
    }


John Meers

Determine mouse button inside context menu handler

$
0
0

WPF, VS 2015 Update 3

I have a context menu handler:

private void RefreshDisplay(object sender, RoutedEventArgs e)

Which gets called whether I click the menu item with the right button or the left button. However, I want to know which button was used to initiate the call. Is this possible?

Passing checkbox value as a parameter to Converter

$
0
0
I've a following code in my WPF app.My xaml screen has 2 controls...checkbox button and a textbox.

I need to be able to trigger MandatoryFieldConverter and pass the checkbox value to it so that I can take an appropriate action.
How do I achieve this please? 


Thanks.

MainWindowXaml.cs

    <CheckBox         Name="chkPlaceholder"         Command="{Binding PlaceholderCheckboxCommand}"         VerticalAlignment="Center"         IsChecked="{Binding IsSecurityPlaceholderChecked}"         Style="{DynamicResource PlaceholderToggleButtonStyle}"         ></CheckBox>    <TextBox         HorizontalAlignment="Left"         Height="23"         VerticalAlignment="Top"         Width="180"         TabIndex="1"         Text="{Binding Price,NotifyOnSourceUpdated=True,  UpdateSourceTrigger=PropertyChanged}"         Background="{Binding CommonSecurityAttributes.UnitFactor,Converter ={StaticResource MandatoryFieldConverter}}"         Grid.Row="7"         Grid.Column="4"  />


C# Converter :

    public class MandatoryFieldBackgroundColourConverter : IValueConverter        {            public object Convert(object value, Type targetType, object parameter, CultureInfo culture)            {                string defaultBgColor = "BurlyWood";                    try                {                    if (string.IsNullOrEmpty(value.ToString()))                    {                        return defaultBgColor;                    }                    else                    {                        return "LightGreen";                    }                }                catch (Exception)                {                    return defaultBgColor;                }            }                public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)            {                return value;            }        }

Thanks for your help.


richtextbox is focused but first input invalid

$
0
0
i want use a hotkey to show a window,in this window have a richtextbox, when window shows up,richtextbox should be focused,and i can typing something in richtextbox directly. 

private IntPtr MainWindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) //system message callback { switch (msg) { case HotKey.WM_HOTKEY: { int sid = wParam.ToInt32(); if (sid == alts) //input Alt+S hotkey { this.WindowState = WindowState.Normal; this.Topmost = true; Keyboard.Focus(richTextBox); ; } else if (sid == altd) //try use Alt+D to hide window { this.WindowState = WindowState.Minimized; } handled = true; break; } }


when i use alt-s, the window show up, the input cursor has been flashing, but first input invalid, but when I continue to input, everything is normal again.

buttons acting as arrow keys in wpf

$
0
0
On treeview, when i hit left arrow in keyboard the selected item in treeview expands and when i hit down arrow key the next item in the treeview is selected..So here I have two Buttons btnStepIn, btnStepOut which should exactly act like left and down arrow key..On btnStepIn button click right arrowkey functionality should be performed and on btnStepOut button click down arrow key functionality should be performed..

XBAP application throws exception when Anonymous Authenticaion of IIS is disabled

$
0
0

I have developed a scanner application using WIA and XBAP technology  which is hosted in IIS. It works fine if I enable Anonymous Authentication. But I am getting the following error if I disable Anonymous Authentication of IIS web server. 

PLATFORM VERSION INFO
 Windows    : 6.1.7601.65536 (Win32NT)
 Common Language Runtime  : 4.0.30319.42000
 System.Deployment.dll   : 4.6.1055.0 built by: NETFXREL2
 clr.dll    : 4.6.1076.0 built by: NETFXREL3STAGE
 dfdll.dll    : 4.6.1055.0 built by: NETFXREL2
 dfshim.dll    : 4.0.41209.0 (Main.041209-0000)

SOURCES
 Deployment url   : http://localhost/ScannerBrowserAppHost/ScannerBrowserApp.xbap

ERROR SUMMARY
 Below is a summary of the errors, details of these errors are listed later in the log.
 * An exception occurred while downloading the manifest. Following failure messages were detected:
  + Downloading http://localhost/ScannerBrowserAppHost/ScannerBrowserApp.xbap did not succeed.
  + The remote server returned an error: (401) Unauthorized.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
 No transaction error was detected.

WARNINGS
 There were no warnings during this operation.

OPERATION PROGRESS STATUS
 No phase information is available.

ERROR DETAILS
 Following errors were detected during this operation.
 * [10/18/2016 9:16:57 AM] System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
  - Downloading http://localhost/ScannerBrowserAppHost/ScannerBrowserApp.xbap did not succeed.
  - Source: System.Deployment
  - Stack trace:
   at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
   at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
   at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
   at System.Deployment.Application.DownloadManager.DownloadManifestAsRawFile(Uri& sourceUri, String targetPath, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
   at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirect(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
   at System.Deployment.Application.DownloadManager.DownloadDeploymentManifest(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, IDownloadNotification notification, DownloadOptions options)
   at System.Deployment.Application.DeploymentManager.BindCore(Boolean blocking, TempFile& tempDeploy, TempDirectory& tempAppDir, FileStream& refTransaction, String& productName)
   at System.Deployment.Application.DeploymentManager.BindAsyncWorker()
  --- Inner Exception ---
  System.Net.WebException
  - The remote server returned an error: (401) Unauthorized.
  - Source: System
  - Stack trace:
   at System.Net.HttpWebRequest.GetResponse()
   at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)

COMPONENT STORE TRANSACTION DETAILS
 No transaction information is available.

I searched in Google but I did not find solution. Any kind of help or hints are appreciated.

Disable/Hide RibbonButton

$
0
0

Hi,

I have a WPF MAsk with a Menue

</RibbonGroup><RibbonGroup Header="Drucken Vorbereitung"><!-- <Ribbon:RibbonMenuButton Label="Wahlvorbereitung" Name="RIMBDRV"  LargeImageSource="C:\WVIS-WPF\Bmp\Unbenannt2.png"> --><RibbonMenuButton Label="Wahlvorbereitung" Name="RIMBDRV"><RibbonMenuButton.Items><RibbonButton Label="Wahlkreise"                Name="RIBTDRVWKRS" HorizontalAlignment="Left" Click="RIBTDRVWKRS_Click" Focusable="False" IsEnabled="False" IsHitTestVisible="False" PreviewMouseMove="RIBTDRVWKRS_PreviewMouseMove" /><RibbonButton Label="Wohnbezirke"               Name="RIBTDRVWOBZ" HorizontalAlignment="Left" /><RibbonButton Label="Wahlbezirke"               Name="RIBTDRVWBEZ" HorizontalAlignment="Left" /><RibbonButton Label="Wahlbezirksschilder"       Name="RIBTDRVWBEZS" HorizontalAlignment="Left"/><RibbonButton Label="Parteien"                  Name="RIBTDRVPAR"  HorizontalAlignment="Left"/><RibbonButton Label="Bewerber"                  Name="RIBTDRVBEW"  HorizontalAlignment="Left"/><RibbonButton Label="Öffentliche Bekanntmachung" Name="RIBTDRVOEBEK" HorizontalAlignment="Left" Click="RIBTDRVOEBEK_Click"/><RibbonButton Label="Stimmzettel"               Name="RIBTDRVSTZ"  HorizontalAlignment="Left"/><RibbonButton Label="Blanko Zählliste"          Name="RIBTDRVBZL"  HorizontalAlignment="Left"/><RibbonButton Label="Blankoschnellmeldung"      Name="RIBTDRVBLSM" HorizontalAlignment="Left"/><RibbonButton Label="Vollständigkeitskontrolle" Name="RIBTDRVVSK"  HorizontalAlignment="Left"/></RibbonMenuButton.Items></RibbonMenuButton></RibbonGroup>

How can i Disable/Hide the "RIBTDRVWKRS" Button so that nowbody can click on this Button.

Have anyone an idea?

IsEnable=false; / Focusable=fasle; is not enought... (I can klick on the Button)...

Best Regards

Bernd

Change Template Of Button Dynamically?

$
0
0

Hi Am Developing WPF app where i need to change Control Template of Button Dynamically based on some property.

How can i change the same?

Any Suggestion would be of great help.

thanks


Arjun

How to add a combobox dynamically based on a boolean value?

$
0
0
Hi All,
I'm trying to add a combobox dynamically in bettween the two combox box. Depending upon the boolean value, the visibility is set. But, the problem is it should'nt consume the hidden space in between the other two comboboxes. Further, I'm using the Grid layout, in which by row definition I place the comboboxes in it's respective cells.
 
Please refer to my below XAML code:
<Grid><Grid.RowDefinitions><RowDefinition Height="28"/><RowDefinition Height="28"/><RowDefinition Height="*"/><Grid.RowDefinitions/><Combobox Grid.Row="0" Name="cmBox_Main" ItemSource="{Binding myData}"/><Combobox Grid.Row="1" Name="cmbBox_Sub" Visibility="Collapsed"/><TextBox Grid.Row="2" FontSize=14 FontWeight="Normal"/><Grid/>

Note: By default, the 2nd combo box is collapsed/hidden from the view. Upon selection from the 1st combobox, it is validated in the code behind and the visibility is set. But, it should not consume space when no such selection is made from the 1st combo box.

 
Eventhough, I had collapsed it's visibility it occupies the space and appears as a blank area, which is not desireable.
 
Please share your ideas to achieve this requirement.
 
Thanks in advance.
 
Regards,
Amresh S. 

WPF - The WebBrower Control does not show up for some reason

$
0
0

On a WPF project, I drag and drop a WebBrowser control and a button on the MainWindow.  Then, I click on the button (button_Click).  However, the WebBrowser control doesn't show up, why?  Anyone knows about this

     private void button_Click(object sender, RoutedEventArgs e)
        {

            WebBrowser browser = new WebBrowser();
            browser.Navigate(new Uri("http://www.bing.com"));

        }

Viewing all 18858 articles
Browse latest View live


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