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

Could not find file 'C:\Users\User\AppData\Local\Temp\Test.exe.manifest'.

$
0
0

When I run my wpf browser application in visual studio and open it in IE it work OK but when I load it to the server and run it I get this error and I don't know why

PLATFORM VERSION INFO
    Windows             : 6.1.7601.65536 (Win32NT)
    Common Language Runtime     : 4.0.30319.18444
    System.Deployment.dll         : 4.0.30319.18408 built by: FX451RTMGREL
    clr.dll             : 4.0.30319.18444 built by: FX451RTMGDR
    dfdll.dll             : 4.0.30319.18408 built by: FX451RTMGREL
    dfshim.dll             : 4.0.41209.0 (Main.041209-0000)

SOURCES
    Deployment url            : file:///C:/Users/User/AppData/Local/Temp/Test-4.xbap

IDENTITIES
    Deployment Identity        : Test.xbap, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6fb93d1c7c91095f, processorArchitecture=msil

APPLICATION SUMMARY
    * Online only application.

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 file:///C:/Users/User/AppData/Local/Temp/Test.exe.manifest did not succeed.
        + Could not find file 'C:\Users\User\AppData\Local\Temp\Test.exe.manifest'.
        + Could not find file 'C:\Users\User\AppData\Local\Temp\Test.exe.manifest'.
        + Could not find file 'C:\Users\User\AppData\Local\Temp\Test.exe.manifest'.

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.
    * [06/05/2014 23:51:28] System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
        - Downloading file:///C:/Users/User/AppData/Local/Temp/Test.exe.manifest 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.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, IDownloadNotification notification, DownloadOptions options, Uri& appSourceUri, String& appManifestPath)
            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
        - Could not find file 'C:\Users\User\AppData\Local\Temp\Test.exe.manifest'.
        - Source: System
        - Stack trace:
            at System.Net.FileWebRequest.EndGetResponse(IAsyncResult asyncResult)
            at System.Net.FileWebRequest.GetResponse()
            at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
        --- Inner Exception ---
        System.Net.WebException
        - Could not find file 'C:\Users\User\AppData\Local\Temp\Test.exe.manifest'.
        - Source: System
        - Stack trace:
            at System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint)
            at System.Net.FileWebRequest.GetResponseCallback(Object state)
        --- Inner Exception ---
        System.IO.FileNotFoundException
        - Could not find file 'C:\Users\User\AppData\Local\Temp\Test.exe.manifest'.
        - Source: mscorlib
        - Stack trace:
            at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
            at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
            at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
            at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
            at System.Net.FileWebStream..ctor(FileWebRequest request, String path, FileMode mode, FileAccess access, FileShare sharing, Int32 length, Boolean async)
            at System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint)

COMPONENT STORE TRANSACTION DETAILS
    No transaction information is available.

Thanks


wpf Ribbon

$
0
0

 I have created this ribbon as a test

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525" xmlns:my="http://schemas.microsoft.com/winfx/2006/xaml/presentation/ribbon">    <Grid>        <my:Ribbon>  <my:RibbonTab Name="Taxonomies" Header="Taxonomies" ToolTip="Taxonomies"><my:RibbonGroup Name="grouptaxonomies" Header="Taxonomies" ToolTip="Taxonomies" >                    <my:RibbonButton x:Name="btntopen" Label="Open" ToolTip="Open"/><my:RibbonButton x:Name="btntclose" Label="Close" ToolTip="Close"/><my:RibbonButton x:Name="btntedit" Label="Edit" ToolTip="Edit"/><my:RibbonButton x:Name="btntcopy" Label="Copy" ToolTip="Copy" /><my:RibbonButton x:Name="btntpaste" Label="Paste" ToolTip="Paste"/><my:RibbonButton x:Name="btntprint" Label="Print" ToolTip="Print"/><my:RibbonButton x:Name="btntprintpreview" Label="Print Preview" ToolTip="Print Preview"/></my:RibbonGroup></my:RibbonTab><my:RibbonTab Name="Collections" Header="Collections" ToolTip="Collections"><my:RibbonGroup Name="groupcollections" Header="Collections" ToolTip="Collections">                  <my:RibbonButton x:Name="btncopen" Label="Open" ToolTip="Open"/><my:RibbonButton x:Name="btncclose" Label="Close" ToolTip="Close"/><my:RibbonButton x:Name="btncedit" Label="Edit" ToolTip="Edit"/><my:RibbonButton x:Name="btnccopy" Label="Copy" ToolTip="Copy"/><my:RibbonButton x:Name="btncpaste" Label="Paste" ToolTip="Paste"/><my:RibbonButton x:Name="btncprint" Label="Print" ToolTip="Print"/><my:RibbonButton x:Name="btncprintpreview" Label="Print Preview" ToolTip="Print Preview"/>                   </my:RibbonGroup>                    </my:RibbonTab><my:RibbonTab Name="Indexes" Header="Indexes" ToolTip="Indexes"><my:RibbonGroup Name="groupindexes" Header="Indexes" ToolTip="Indexes" ><my:RibbonButton x:Name="btniopen" Label="Open" ToolTip="Open"/><my:RibbonButton x:Name="btniclose" Label="Close" ToolTip="Close"/><my:RibbonButton x:Name="btniedit" Label="Edit" ToolTip="Edit"/><my:RibbonButton x:Name="btnicopy" Label="Copy" ToolTip="Copy"/><my:RibbonButton x:Name="btnipaste" Label="Paste" ToolTip="Paste"/><my:RibbonButton x:Name="btniprint" Label="Print" ToolTip="Print"/><my:RibbonButton x:Name="btniprintpreview" Label="Print Preview" ToolTip="Print Preview"/></my:RibbonGroup></my:RibbonTab><my:RibbonTab Name="ResearchReviews" Header="Research Reviews" ToolTip="Research Reviews"><my:RibbonGroup Name="groupresearchreviews" Header="Research Reviews" ToolTip="Research Reviews" ><my:RibbonButton x:Name="btnrropen" Label="Open" ToolTip="Open"/><my:RibbonButton x:Name="btnrrclose" Label="Close" ToolTip="Close"/><my:RibbonButton x:Name="btnrredit" Label="Edit" ToolTip="Edit"/><my:RibbonButton x:Name="btnrrcopy" Label="Copy" ToolTip="Copy"/><my:RibbonButton x:Name="btnrrpaste" Label="Paste" ToolTip="Paste"/><my:RibbonButton x:Name="btnrrprint" Label="Print" ToolTip="Print"/><my:RibbonButton x:Name="btnrrprintpreview" Label="Print Preview" ToolTip="Print Preview"/></my:RibbonGroup></my:RibbonTab><my:RibbonTab Name="Audit" Header="Audit" ToolTip="Audit"><my:RibbonGroup Name="groupaudit" Header="Audit" ToolTip="Audit" ><my:RibbonButton x:Name="btnaopen" Label="Open" ToolTip="Open"/><my:RibbonButton x:Name="btnaclose" Label="Close" ToolTip="Close"/><my:RibbonButton x:Name="btnaedit" Label="Edit" ToolTip="Edit"/><my:RibbonButton x:Name="btnacopy" Label="Copy" ToolTip="Copy"/><my:RibbonButton x:Name="btnapaste" Label="Paste" ToolTip="Paste"/><my:RibbonButton x:Name="btnaprint" Label="Print" ToolTip="Print"/><my:RibbonButton x:Name="btnaprintpreview" Label="Print Preview" ToolTip="Print Preview"/></my:RibbonGroup></my:RibbonTab></my:Ribbon>        </Grid></Window>

I have two questions

1) What is the point of the dropdown that you get. If you click on it it is empty

2) How can I add a sortable grid or list to the page? I get content propery is set more than once


 Thanks

how to get selected row value from listview

$
0
0
 <ListView x:Name="ListView1" HorizontalAlignment="Left" Height="694" Margin="610,146,0,0" VerticalAlignment="Top" Width="774" FontSize="20"  SelectionChanged="ListView1_SelectionChanged_1"  SelectionMode="Single"><ListView.Background><LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"><GradientStop Color="#FFB3DAD7" Offset="0"/><GradientStop Color="#FFA6B8B6" Offset="1"/></LinearGradientBrush></ListView.Background><ListView.ItemContainerStyle><Style TargetType="{x:Type ListViewItem}"><Setter Property="BorderBrush" Value="LightGray" /><Setter Property="BorderThickness" Value="0,0,0,1" /></Style></ListView.ItemContainerStyle><ListView.View><GridView><GridView.ColumnHeaderContainerStyle><Style><Setter Property="FrameworkElement.Visibility" Value="Collapsed"/></Style></GridView.ColumnHeaderContainerStyle><GridViewColumn Width="480"  DisplayMemberBinding="{Binding company_name}" /><GridViewColumn Width="130"  DisplayMemberBinding="{Binding floor}"/><GridViewColumn Width="180"  DisplayMemberBinding="{Binding unit_no}"/></GridView></ListView.View></ListView>
  Private Sub Page4_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
        ListView1.Items.Clear()
        Dim dt As DataTable = New DataTable
        ' Dim dtlist As DataTable

        con.ConnectionString = connection
        If con.State = ConnectionState.Closed Then

            Dim sqlquery As String = "select unit_no, company_name, floor, description from company_management where floor='" & queryfloor & "' order by company_name"
            Try
                con.Open()
                Dim da As MySqlDataAdapter = New MySqlDataAdapter(sqlquery, connection)
                da.Fill(dt)
                ' dtlist = dt

                ListView1.DataContext = dt
                ListView1.SetBinding(ListView.ItemsSourceProperty, New Binding)
                con.Close()

            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End If
        con.Close()

    End Sub
  Private Sub ListView1_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles ListView1.SelectionChanged
       
        CnameTextblock.Text = ListView1.SelectedItems(0).SubItems(0).Text
        LocationLabel.Content = ListView1.SelectedItems(0).SubItems(2).Text

    End Sub 
i got listview populated data from database. I want when user select the row, it will fill the the textblock or label with the selected row value.



How to implement SpellCheck property in one UserControl?

$
0
0

Hi all of you,


I am taking advantatge of one UserControl which inherits from one RichTextControl control. I would like to decide in my front-end whether spelling features on it are enable or not. It is not rocket science I suppose but I do not how to implement in my assembly such property..

UserControl project:


<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:RTFEditor="clr-namespace:RTFEditor"
	mc:Ignorable="d"
	x:Class="RTFEditor.RTFBox"
	x:Name="RTFEditor"    
	d:DesignWidth="600" d:DesignHeight="600" Loaded="RTFEditor_Loaded"><UserControl.Resources><ObjectDataProvider x:Key="FontListKlasse" d:IsDataSource="True" ObjectType="{x:Type RTFEditor:FontList}"/><ObjectDataProvider x:Key="FontHeightKlasse" d:IsDataSource="True" ObjectType="{x:Type RTFEditor:FontHeight}"/></UserControl.Resources>   <DockPanel><ToolBar x:Name="ToolBarOben" DockPanel.Dock="Top"><Button x:Name="ToolStripButtonPrint" Click="ToolStripButtonPrint_Click"><Image Source="Images\Print.png" Stretch="None"/>				</Button><Separator/><ToggleButton x:Name="ToolStripButtonBold" Command="EditingCommands.ToggleBold" ToolTip="Bold"><Image Source="Images\Bold.png" Stretch="None"/></ToggleButton><ToggleButton x:Name="ToolStripButtonItalic" Command="EditingCommands.ToggleItalic" ToolTip="Italic"><Image Source="Images\Italic.png" Stretch="None"/></ToggleButton><ToggleButton x:Name="ToolStripButtonUnderline" Command="EditingCommands.ToggleUnderline" ToolTip="Underline"><Image Source="Images\Underline.png" Stretch="None"/></ToggleButton><ToggleButton x:Name="ToolStripButtonStrikeout" ToolTip="Strikeout" Click="ToolStripButtonStrikeout_Click"><Image Source="Images\Strikeout.png" Stretch="None"/></ToggleButton><ToggleButton x:Name="ToolStripButtonAlignLeft" Command="EditingCommands.AlignLeft" ToolTip="Align Left" Click="ToolStripButtonAlignLeft_Click"><Image Source="Images\AlignLeft.png" Stretch="None"/></ToggleButton><ToggleButton x:Name="ToolStripButtonAlignCenter" Command="EditingCommands.AlignCenter" ToolTip="Align Center" Click="ToolStripButtonAlignCenter_Click"><Image Source="Images\AlignCenter.png" Stretch="None"/></ToggleButton><ToggleButton x:Name="ToolStripButtonAlignRight" Command="EditingCommands.AlignRight" ToolTip="Align Right" Click="ToolStripButtonAlignRight_Click"><Image Source="Images\AlignRight.png" Stretch="None"/></ToggleButton></ToolBar>                           <RichTextBox x:Name="RichTextControl"   VerticalScrollBarVisibility="Auto" AcceptsReturn="True" AcceptsTab="True"
                     SelectionChanged="RichTextControl_SelectionChanged" 
                     TextChanged="RichTextControl_TextChanged" KeyDown="RichTextControl_KeyDown" KeyUp="RichTextControl_KeyUp" /> </DockPanel></UserControl>



Client project:

I'm calling this object as it customary:


    xmlns:rtf="clr-namespace:RTFEditor;assembly=RTFEditor"<rtf:RTFBox  SpellCheck.IsEnabled="True"  Height="160" Width="300" Canvas.Left="2" Canvas.Top="3"></rtf:RTFBox>

If I try to put SpellCheck.Enabled="True"  it raises a couple of errors:


Error    1    Property 'IsEnabled' is not attachable to elements of type 'RTFBox'.    C:\puesto\Cuadro_de_Mando\GIT\Vistas\Orden_Reparacion.xaml    119    51    GIT_CuadroMando
Error    2    The attached property "IsEnabled" can only be applied to types that are derived from "TextBoxBase".    C:\puesto\Cuadro_de_Mando\GIT\Vistas\Orden_Reparacion.xaml    119   51    GIT_CuadroMando

How to implement this property in my assembly?


TIA,

Strange error from event handler in style

$
0
0

Hi there, I am aware that event setters should be used to attach handles in styles. However, can anyone explain this error?

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><Window.Resources><Style TargetType="DataGridCell" x:Key="MenuStyle"><Setter Property="ContextMenu"><Setter.Value><ContextMenu><MenuItem Header="Hello!" Click="MenuItem_Click" /></ContextMenu></Setter.Value></Setter></Style></Window.Resources><Grid> <!-- cast target --><DataGrid><DataGrid.Columns><DataGridTextColumn Header="Column" CellStyle="{StaticResource MenuStyle}" /></DataGrid.Columns></DataGrid></Grid></Window>

where the handler is empty (private void MenuItem_Click(object sender, EventArgs e) {}).

Designer is happy with this. However, at runtime, a XamlParseException is thrown ('Set connectionId threw an exception.' Line number '9' and line position '26'.) with this inner exception: "Unable to cast object of type 'System.Windows.Controls.MenuItem' to type 'System.Windows.Controls.Grid'."

I have observed that it tries to cast MenuItem to whatever parent is there to the DataGrid, or, if not parented, to the DataGrid itself.

I don't quite understand why, or what the intent is. Does anybody have a clue?
(I am trying to understand the cause of the exception, not to fix it.)

Thanks,
Jan


TextBox not receiving touch input

$
0
0

Dear all,

I have build a simple WPF application with a simple list box which have as a test following Items layout

<StackPanel Orientation="Horizontal"><TextBlock x:Name="_price" Text="{Binding StringSpecialOfferPrice,UpdateSourceTrigger=PropertyChanged}" Foreground="{DynamicResource ProductPrice}" Style="{DynamicResource DetailCardTitle}" Margin="5,0,0,0"/><TextBlock Text="X" Style="{DynamicResource DetailCardTitle}" VerticalAlignment="Center" Foreground="{DynamicResource ProductDetailMainText}"  Margin="5,0,10,0"/><TextBox Text="{Binding Quantity,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource RoundedTextBoxStyle}" Background="Transparent" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="20" FontWeight="SemiBold"  Foreground="Black" Width="59" /></StackPanel>

What is happening is that when I touch the TextBox it is not receiving the touch or something prevent it so that I am not able to go in edit mode. Clicking with mouse inside works of course.

I am running it under W7 and Framwework 4

Any reason ?

thnaks

Improving My WPF startup time

$
0
0

I have develop a WPF application but I found it really slow when starting up on some computers. I've read the instructions in (Improving WPF applications startup time). And I''ve figured out some ways to improve it.

My application has a great deal of usercontrols. Most of them have animations and they don't need to be displayed immediately after the application is started. How can I load them later when the application really need them?

Setting the visibility to 'Collapsed' or disabling them doesn't work because the code-behind (animations) still runs. And adding these usercontrol programmatically or dynamically will be tedious job. Do you have any better ideas?

Thank you~!

Apply image slider shader effect progmmatically

$
0
0

Hi Guys, in my application i'm applying various image effects(Pixel Shader Effects) using 'Shader Effect library'  at the same time i'm using the Sliders for Red, Green, Blue ,Contrast, brightness to change the color over the image. 

The problem; to show the difference of the image effects, i called the ' ViewedPhoto.Effect = null;' for each button click

Once I call the  ViewedPhoto.Effect = null; then the slider "BrightContrastEffect" image effect which are binded with the sliders are not working.

How can i call the "BrightContrastEffect" image effects for the sliders progmmatically?

Kindly help me with this. Thank you

Image Element:

<Viewbox  x:Name="cImage" Stretch="Uniform"  Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" Margin="0"><Image x:Name="ViewedPhoto"   Source="IMG_0071.jpg" 
		Stretch="None" VerticalAlignment="Top" HorizontalAlignment="Left" MouseDown="ViewedPhoto_MouseDown" Margin="0,5,0,95" ><Image.Effect><l:BrightContrastEffect 
				Brightness="{Binding Value, ElementName=bVal}"
				Contrast="{Binding Value, ElementName=cVal}"
				Red="{Binding Value, ElementName=rVal}"
				Green="{Binding Value, ElementName=gVal}"
				Blue="{Binding Value, ElementName=blVal}"
			/></Image.Effect></Image></Viewbox>

BrightContrastEffect Class:

 public class BrightContrastEffect : ShaderEffect
    {
        private static PixelShader m_shader =
            new PixelShader() { UriSource = MakePackUri("bricon.ps") };

        public BrightContrastEffect()
        {

            PixelShader = m_shader;
            UpdateShaderValue(InputProperty);
            UpdateShaderValue(BrightnessProperty);
            UpdateShaderValue(ContrastProperty);
            UpdateShaderValue(RedProperty);
            UpdateShaderValue(GreenProperty);
            UpdateShaderValue(BlueProperty);

        }

        // MakePackUri is a utility method for computing a pack uri 
        // for the given resource.  
        public static Uri MakePackUri(string relativeFile)
        {
            Assembly a = typeof(BrightContrastEffect).Assembly;

            // Extract the short name. 
            string assemblyShortName = a.ToString().Split(',')[0];

            string uriString = "pack://application:,,,/" +
                assemblyShortName +";component/" +
                relativeFile;

            return new Uri(uriString);
        }

        public Brush Input
        {
            get { return (Brush)GetValue(InputProperty); }
            set { SetValue(InputProperty, value); }
        }

        public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(BrightContrastEffect), 0);

        public float Brightness
        {
            get { return (float)GetValue(BrightnessProperty); }
            set { SetValue(BrightnessProperty, value); }
        }

        public static readonly DependencyProperty BrightnessProperty = DependencyProperty.Register("Brightness", typeof(double), typeof(BrightContrastEffect), new UIPropertyMetadata(0.0, PixelShaderConstantCallback(0)));

        public float Contrast
        {
            get { return (float)GetValue(ContrastProperty); }
            set { SetValue(ContrastProperty, value); }
        }

        public static readonly DependencyProperty ContrastProperty = DependencyProperty.Register("Contrast", typeof(double), typeof(BrightContrastEffect), new UIPropertyMetadata(0.0, PixelShaderConstantCallback(1)));


        public float Red
        {
            get { return (float)GetValue(RedProperty); }
            set { SetValue(RedProperty, value); }
        }

        public static readonly DependencyProperty RedProperty = DependencyProperty.Register("Red", typeof(double), typeof(BrightContrastEffect), new UIPropertyMetadata(0.0, PixelShaderConstantCallback(2)));

        public float Green
        {
            get { return (float)GetValue(GreenProperty); }
            set { SetValue(RedProperty, value); }
        }

        public static readonly DependencyProperty GreenProperty = DependencyProperty.Register("Green", typeof(double), typeof(BrightContrastEffect), new UIPropertyMetadata(0.0, PixelShaderConstantCallback(3)));

        public float Blue
        {
            get { return (float)GetValue(BlueProperty); }
            set { SetValue(BlueProperty, value); }
        }

        public static readonly DependencyProperty BlueProperty = DependencyProperty.Register("Blue", typeof(double), typeof(BrightContrastEffect), new UIPropertyMetadata(0.0, PixelShaderConstantCallback(4)));

        //private static PixelShader m_shader = new PixelShader() { UriSource = new Uri(@"pack://application:,,,/CustomPixelRender;component/bricon.ps") };

    }
  

Sliders & textBoxes :

<StackPanel Margin="10,10,10,0" Grid.Column="2" Grid.Row="1"  Orientation="Vertical" Grid.RowSpan="3"  Background="AliceBlue"><TextBlock Text="Brightness" Margin="0,-1,-1,0"/><Slider Maximum="1" Minimum="-1"  x:Name="bVal"  TickFrequency="1" TickPlacement="BottomRight"  Style="{StaticResource NL_ColorSlider_Brightness}"/><StackPanel Orientation="Horizontal"><TextBox Text="{Binding Value, ElementName=bVal, UpdateSourceTrigger=PropertyChanged}"  TextAlignment="Right" Width="30"  Height="10" Margin="0" RenderTransformOrigin="-1.167,0.423" Visibility="Hidden"/><Button x:Name="bReset" Content="R" Height="10" Width="30" Margin="35,0,0,0" Click="bReset_Click"/></StackPanel><!--Style="{StaticResource NL_ColorSlider_Red}"--><TextBlock Text="Contrast"/><Slider Maximum="1" Minimum="-1" x:Name="cVal" TickFrequency="1" TickPlacement="BottomRight" Style="{StaticResource NL_ColorSlider_Contrast}"/><StackPanel Orientation="Horizontal"><TextBox Text="{Binding Value, ElementName=cVal, UpdateSourceTrigger=PropertyChanged}"  TextAlignment="Right" Width="30"  Height="10"  Margin="0,0" Visibility="Hidden" /><Button x:Name="cReset" Content="R" Height="10" Width="30" Margin="35,0,0,0" Click="cReset_Click"/></StackPanel><TextBlock Text="Cyan                                  Red"/><Slider Maximum="1" Minimum="-1" x:Name="rVal" TickFrequency="1" TickPlacement="BottomRight"  Style="{StaticResource NL_ColorSlider_Red}"/><StackPanel Orientation="Horizontal"><TextBox Text="{Binding Value, ElementName=rVal, UpdateSourceTrigger=PropertyChanged}"  TextAlignment="Right" Width="30" Visibility="Hidden"/><Button x:Name="rReset" Content="R" Height="10" Width="30" Margin="35,0,0,0" Click="rReset_Click"/></StackPanel><TextBlock Text="Magenta  Green"/><Slider Maximum="1" Minimum="-1" x:Name="gVal" TickFrequency="1" TickPlacement="BottomRight" Style="{StaticResource NL_ColorSlider_Green}"/><StackPanel Orientation="Horizontal"><TextBox Text="{Binding Value, ElementName=gVal, UpdateSourceTrigger=PropertyChanged}"  TextAlignment="Right" Width="30" Visibility="Hidden"/><Button x:Name="gReset" Content="R" Height="10" Width="30" Margin="35,0,0,0" Click="gReset_Click"/></StackPanel><TextBlock Text="Yellow Blue"/><Slider Maximum="1" Minimum="-1" x:Name="blVal" TickFrequency="1" TickPlacement="BottomRight" Style="{StaticResource NL_ColorSlider_Blue}"/><StackPanel Orientation="Horizontal"><TextBox Text="{Binding Value, ElementName=blVal, UpdateSourceTrigger=PropertyChanged}"  TextAlignment="Right" Width="30" Visibility="Hidden"/><Button x:Name="bbReset" Content="R" Height="10" Width="30" Margin="35,0,0,0" Click="bbReset_Click"/></StackPanel><GroupBox Header="Color Effects" Margin="0"><ComboBox x:Name="cColorEffects"  VerticalAlignment="Top"   Style="{StaticResource ComboBoxStyle}" 
				FontFamily="{DynamicResource FontFamilyRes}" FontSize="{DynamicResource Button_Font_Size_1}" 
				Visibility="Visible" HorizontalAlignment="Left" Grid.Column="2" Grid.Row="1" Margin="-5,0,0,0" Width="152" Height="23" SelectionChanged="cColorEffects_SelectionChanged" /></GroupBox><GroupBox Header="Add LOGO" Margin="0,3"><Button Name="bAddLogo" Height="35" Width="100" Content="Add Logo" Template="{DynamicResource Generic_Button_Glass_Blue}" FontFamily="{DynamicResource DNP-FontFamily}" FontSize="{DynamicResource Generic_Button_Text_Size}" Foreground="White"/></GroupBox><GroupBox Header="Add BORDER" Margin="0,2,-1,2" Height="77"><Button Name="bAddBorder" Height="35" Width="100" Content="Add Border" Template="{DynamicResource Generic_Button_Glass_Blue}" FontFamily="{DynamicResource DNP-FontFamily}" FontSize="{DynamicResource Generic_Button_Text_Size}" Foreground="White"/></GroupBox><!--<UniformGrid Grid.Row="2"><TextBlock Text="Contrast"/><Slider Maximum="1" Minimum="-1"  Name="cVal" TickFrequency="1" TickPlacement="BottomRight"/><TextBox Text="{Binding ElementName=cVal, Path=Value, 
 UpdateSourceTrigger=PropertyChanged}"  TextAlignment="Right" Width="30" /></UniformGrid>--></StackPanel>



Binding ListBox Item IsSelected inside ListBox.ItemTemplate

$
0
0
I have some xaml like this:

<ListBox....
     <ListBox.ItemTemplate
          <DataTemplate>
               <Grid>
                    <ToggleButton ...... >

The ListBox's ItemsSource is set in the .cs to a BindingList<MyObject>. I need to bind the ToggleButton's IsChecked property to the ListBox's Item IsSelected. Thus, when the toggle button is checked the ListBox's Item IsSelected gets set to true. How can I set up this binding? Thanks in advance!

How do I make the menuitem control open its submenu only on click?

$
0
0
<Menu><Menu.ItemsPanel><ItemsPanelTemplate ><VirtualizingStackPanel Orientation="Vertical"/></ItemsPanelTemplate></Menu.ItemsPanel><MenuItem Header="Level1 Test 1" ><MenuItem Header="Level2 Test 1"/><MenuItem Header="Level2 Test 2"/><MenuItem Header="Level2 Test 3"><MenuItem Header="Level3 1"/><MenuItem Header="Level3 2"/><MenuItem Header="Level3 3"><MenuItem Header="Level4 1"/><MenuItem Header="Level4 2"/></MenuItem></MenuItem></MenuItem><MenuItem Header="Delete"/></Menu>

In wpf menu items with children automatically open the submenu when you hover over the item. How do I make it so the submenu only opens when I click on the menuitem? Further, if the user clicks on it while its submenu is open, it should close the submenu. For some reason overriding OnClick() does not call.

DataGrid

$
0
0

This is my Datagrid

<DataGrid AutoGenerateColumns="False" Name="DataGrid1" Margin="12,173,12,0" CanUserResizeColumns="True" CanUserResizeRows="False" CanUserSortColumns="True" Width="450"><DataGrid.Columns><DataGridTemplateColumn Header="Column 1" Width="150" ><DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock x:Name="txtColumn1" Text="{Binding Path=MyColumn1}" /></DataTemplate></DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn><DataGridTemplateColumn Header="Column 2" Width="150"><DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock x:Name="txtColumn2" Text="{Binding Path=MyColumn2}" /></DataTemplate></DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn><DataGridTemplateColumn Header="Column 3" Width="150"><DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock x:Name="txtColumn3" Text="{Binding Path=MyColumn3}"/></DataTemplate></DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn></DataGrid.Columns></DataGrid>

In my code behind I have

Class Page1
    Public MyColumn1 As New List(Of String) From {"aa", "bb", "cc"}
    Public MyColumn2 As New List(Of String) From {"dd", "yy", "xx"}
    Public MyColumn3 As New List(Of String) From {"rr", "ff", "dd"}
End Class

What am I missing as the texbox binds aren't showing up

Thanks


combobox border win8

$
0
0

Hello there guys,

I wonder why this is happening...

Code: 

<Window x:Class="WpfApplication6.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"><Grid><ComboBox HorizontalAlignment="Left" BorderBrush="Red" Margin="166,122,0,0" VerticalAlignment="Top" Width="120"/></Grid></Window>

Result under windows7: (expected)

windows 8:



-- Jorge_M_P

Problem with moving items up and down in CheckedListBox using ObservableCollection

$
0
0

Hello, I'm upgrading a VB6 app to .NET (WPF) and have run into a problem. I have a Checked ListBox and it's populated with a series of class instances that I've pulled into an ObservableCollection so that I can synch the Checkbox Checked state to the collection. All that's working well. But in the VB6 app we have the ability to move a ListBox item up and down in the ListBox. That's where I'm having my problem. I can't seem to figure out how to handle that. 

The first problem is that with the code like it is, when I click on an item in the ListBox, the ListBox doesn't get a SelectedItem, so I don't even have a reference to the item I want to move up or down. I can change that by using RelativeSource in the XAML:

<CheckBox Content="{Binding Path=Name}" IsChecked="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}" />
 

but this will select each item I check and I only really need the last checkbox clicked on to be selected.

The next problem would be the movement of the items in the ListBox. In VB6 it's a simple matter to remove a specific item from a ListBox and then re-insert it back into a different spot. So far the only thing I can think of in .NET is to use a second collection, pulling the items in the correct order from the first collection, then putting them all back into the original collection, now sorted correctly. Seems klunky but I think it would be a straight-forward process to do that.

Also, the VB6 app takes one click to select the item in the CheckedListBox and another click to actually check or uncheck it. This is the action I'd prefer since if I'm only wanting to re-order the items in the list I don't want them to check/uncheck while I'm selecting the items.

I've put together an simple example of what I'm attempting. Here's the XAML:

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525"><Grid><Grid.ColumnDefinitions><ColumnDefinition></ColumnDefinition></Grid.ColumnDefinitions><Grid.RowDefinitions><RowDefinition></RowDefinition><RowDefinition Height="Auto"></RowDefinition></Grid.RowDefinitions><ListBox Name="lst" SelectionMode="Multiple"><ListBox.ItemTemplate><DataTemplate><CheckBox Content="{Binding Path=Name}" IsChecked="{Binding Path=IsSelected}" /></DataTemplate></ListBox.ItemTemplate></ListBox><StackPanel Orientation="Horizontal" Grid.Row="1"><Button Name="btnMoveUp" Margin="3" Click="btnMoveUp_Click">/\</Button><Button Name="btnMoveDown" Margin="3" Click="btnMoveDown_Click">\/</Button></StackPanel></Grid></Window>

Here's my Code-behind:

Imports System.Collections.ObjectModel

Class MainWindow
    Private objects As New ObservableCollection(Of clsObject)

    Private Sub lst_SelectionChanged_1(sender As Object, e As SelectionChangedEventArgs)
        Debug.Print("SelectionChanged")
    End Sub

    Private Function FillObjectCollection() As Boolean
        For x As Integer = 1 To 10
            Dim obj As New clsObject(x, "Object " & x.ToString, "Test Description " & x.ToString, x, False)
            objects.Add(obj)
        Next
        objects(3).IsSelected = True
        objects(6).IsSelected = True
        objects(7).IsSelected = True
    End Function

    Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
        FillObjectCollection()
        lst.ItemsSource = objects
    End Sub

    Private Sub btnMoveUp_Click(sender As Object, e As RoutedEventArgs)
        Dim obj1 As clsObject = DirectCast(lst.SelectedItem, clsObject)
        If obj1.Sequence > 0 Then
            Dim tmpSequenceID As Integer = obj1.Sequence
            For Each obj2 As clsObject In lst.Items
                If obj2.Sequence = tmpSequenceID - 1 Then
                    obj1.Sequence = obj2.Sequence
                    obj2.Sequence = tmpSequenceID
                    ' now how to resort the ListBox?
                End If
            Next
        End If
    End Sub

    Private Sub btnMoveDown_Click(sender As Object, e As RoutedEventArgs)

    End Sub
End Class

And here's the class I'm using for my objects:

Imports System.ComponentModel

Public Class clsObject
    Implements INotifyPropertyChanged

    Private _id As Integer = 0
    Private _name As String = ""
    Private _description As String = ""
    Private _sequence As Integer = 0
    Private _isSelected As Boolean = False

    Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged

    Public Property ID As Integer
        Get
            Return _id
        End Get
        Set(value As Integer)
            _id = value
        End Set
    End Property

    Public Property Name As String
        Get
            Return _name
        End Get
        Set(value As String)
            _name = value
        End Set
    End Property

    Public Property Description As String
        Get
            Return _description
        End Get
        Set(value As String)
            _description = value
        End Set
    End Property

    Public Property Sequence As Integer
        Get
            Return _sequence
        End Get
        Set(value As Integer)
            _sequence = value
        End Set
    End Property

    Public Property IsSelected As Boolean
        Get
            Return _isSelected
        End Get
        Set(value As Boolean)
            _isSelected = value
            OnPropertyChanged(New PropertyChangedEventArgs("IsSelected"))
        End Set
    End Property

    Public Sub OnPropertyChanged(ByVal e As PropertyChangedEventArgs)
        If Not PropertyChangedEvent Is Nothing Then
            RaiseEvent PropertyChanged(Me, e)
        End If
    End Sub

    Public Sub New(ByVal pID As Integer, ByVal pName As String, ByVal pDescription As String, ByVal pSequence As Integer, ByVal pIsSelected As Boolean)
        Me.ID = pID
        Me.Name = pName
        Me.Description = pDescription
        Me.Sequence = pSequence
        Me.IsSelected = pIsSelected
    End Sub

    Public Overrides Function ToString() As String
        Return Me.Name
    End Function

End Class
In this example I want to be able to click on an item, then click the up or down button to move the item accordingly.
 
Any help would be appreciated. And sorry for the long post

How do i can play mp4 file without using media element control in wpf ?

$
0
0
I want to play video (mp4) file in wpf but dont want to use mediaElement control. Is there any other way to do it.

how do i get image from database to a rectangle?

$
0
0
<Rectangle x:Name="ads" Height="194" Margin="524,0,0,34" VerticalAlignment="Bottom" Opacity="0.865" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Width="1"><Rectangle.Fill><ImageBrush/></Rectangle.Fill>
If con.State = ConnectionState.Closed Then
            con.Open()
            Dim ds As New DataSet
            Dim adp As New MySqlDataAdapter
            adp = New MySqlDataAdapter("select bannerimage from banner where bannerid = '1'", con)
            adp.Fill(ds)
            Dim saveImage As IO.MemoryStream
            Dim arrImage As Byte()
            Dim intImage As Integer = 0
            If ds.Tables.Count > 0 Then
                Try
                    For intImage = 0 To ds.Tables(0).Rows.Count - 1
                        If ds.Tables(0).Rows(0)("bannerimage") Is DBNull.Value Then
                        Else
                            arrImage = ds.Tables(0).Rows(0)("bannerimage")
                            saveImage = New IO.MemoryStream(arrImage)
                            Dim tempimg As ImageBrush = New ImageBrush()

                            ads.Source = BitmapFrame.Create(saveImage, BitmapCreateOptions.None, BitmapCacheOption.OnLoad)
                           

                        End If
                    Next
                Catch ex As Exception
                    MsgBox(ex.Message)
                    con.Close()

                End Try


            End If
        End If

i am able to insert the image into image field but rectangle i don't know how to do it. Can anyone help? because my designer used expression blend to design the rectangle that have animation. i want the image get source from database so, user can remote edit the image.

WPF 4.5 Multitouch application - zIndex problem

$
0
0

Hello all,

I am new in WPF and I work on simple multitouch program. Basic idea is to show JPG images from folder and let user to move, rotate and zoom them on screen. I have done all this - reading files from folder, creating ObservableCollection and bind it to itemsControl. It works well, but I am not able to bring last manipulated image to top.

I found some examples like that, but it doesn't work with dynamicaly bound objets.

   Private Sub Window_ManipulationStarting(ByVal sender As Object, ByVal e As ManipulationStartingEventArgs)
        e.ManipulationContainer = Me

        Dim element As FrameworkElement = CType(e.Source, FrameworkElement)
        Dim pnl As Panel = CType(element.Parent, Panel)
        For i As Integer = 0 To pnl.Children.Count - 1
            If pnl.Children(i) Is element Then
                Panel.SetZIndex(VisualTreeHelper.GetParent(pnl.Children(i)), pnl.Children.Count)
            Else
                Panel.SetZIndex(VisualTreeHelper.GetParent(pnl.Children(i)), i)
            End If
        Next

        e.Handled = True
    End Sub

Any advice wil be welcomed.Thank you

Miroslav

How do I remove the scroll from just one window?

$
0
0

 I have 2 different windows and I want to keep the scroll only in one of them. I've posted the xaml code where the scroll can be found, the code that triggers when the user selects and image, and also a few illustrative screenshots. I hope I made myself clear. If you need more details, don't hesitate to ask.

<k:KinectScrollViewer Grid.Row="0" Name="scrollViewer" HorizontalScrollBarVisibility="Visible"  VerticalScrollBarVisibility="Disabled"><WrapPanel VerticalAlignment="Center" x:Name="wrapPanel" Orientation="Vertical" k:KinectTileButton.Click="KinectTileButtonClick"><!-- items for design layout.  They will be replaced at runtime. --><k:KinectTileButton Label="1"/><k:KinectTileButton Label="2"/><k:KinectTileButton Label="3"/><k:KinectTileButton Label="4"/><k:KinectTileButton Label="5"/><k:KinectTileButton Label="6"/><k:KinectTileButton Label="7"/><k:KinectTileButton Label="8"/><k:KinectTileButton Label="9"/><k:KinectTileButton Label="10"/><Image Height="150" Name="image1" Stretch="Fill" Width="200" /></WrapPanel>
 protected void KinectTileButtonClick(object sender, RoutedEventArgs e)
        {

            var button = (KinectTileButton)e.Source;
          
            if (button.Tag is WineGroupModel)
            {
                C1 C1 = new C1(); //mainwindow
                C1.ImagesDir = (button.Tag as WineGroupModel).WinesDir;
                

                C1.Show();
            }
            else if (button.Tag is WineModel)
            {
                var wineModel = button.Tag as WineModel;
                var selectionDisplay = new SelectionDisplay(wineModel);
                this.kinectRegionGrid.Children.Add(selectionDisplay);
                e.Handled = true;
            }
            else
            {
                throw new NotImplementedException("Unkown Wine object type");
            }
        }


Show special character in Grid Control

$
0
0
    • Hi,

      Is there any way to display special character (e.g. Ascii character 1 (SOH ) ) in column? Currently it is not showing special character in any column type.

How to close parent to parent window.

$
0
0

Hello,

I have wpf window A , window B and window C,

window A -> Window B -> Window C

how to close (Parent to Parent) window  from window C. Pleases guide me. Currently i am closing current window by this.close() but how i close parent to parent window.

Regards

Suraj Singh

How to Secure the WPF application with Local Database on Client Machine

$
0
0

Hi,

How to secure the WPF Application and Local Database file (.mdf) on Client machine.

Thanks,

Nagu

Viewing all 18858 articles
Browse latest View live


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