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

Getting ERRORS when I try to use MSBuild or LocBaml with a WPF Application.

$
0
0

I am getting ERRORS when I try to use MSBuild or LocBaml with a WPF Application. Here is what I am doing.

 

I need help in learning how toLocalize an WPF Application according to Microsoft textbook "MCTS EXAM 70-511 Windows Application Development with Microsoft .NET Framework 4 (Self-Paced Training Kit)", starting at the bottom of page 472.

 

STEP 1:

First, I built a very simple WPF application. The XAML is shown below:

 

MainWindow.xaml

<Window x:Class="WpfApplication1.MainWindow"

       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

       Title="MainWindow" Height="100" Width="300">

   <Grid>

       <Label Content="Title" Name="label1"/>

   </Grid>

</Window>

 

Step 2:

Then, I un-commented the following line is "AssemlyInfo.cs" and rebuild the project.

 

AssemlyInfo.cs

[assembly:NeutralResourcesLanguage("en-US",UltimateResourceFallbackLocation.Satellite)]

 

 

Step 3:

Third, I opened my csproj file "WpfApplication1.csproj" in Notepad and added the following line within the<PropertyGroup> tag, saved the file, reopened the project in VS2010 and rebuild the application.

 

WpfApplication1.csproj

<UICulture>en-US</UICulture>

 

Step 4:

Then I attempted to have MSBuild.exe add all the Uid tags in my XAML file. But that did not work.  So I attempted manually in insert the Uid tag, and that also did not work. Below are the details.

 

I copied the MSBuild.exe file into the directory that held the .csproj file, opened a command prompt, and attempted to run the following command:

MSBuild /t:updateuid WpfApplication1.csproj

 

In reply, I received the following error. I have copied exactly what was in the command prompt.

 

Information from Command Prompt (2010) window

Setting environment for using Microsoft Visual Studio 2010 x86 tools.

 

c:\WpfApplication1\WpfApplication1>MSBuild /t:updateuid WpfApplication1.csproj

 

Microsoft ® Build Engine Version 4.0.30319.1

[Microsoft .NET Framework, Version 4.0.30319.2391]

Copyright (C) Microsoft Corporation 2007. All rights reserved.

 

Build started 11/28/2011 12:56:42 PM.

Project "c:\WpfApplication1\WpfApplication1\WpfApplication1.csproj" on node 1(updateuid target(s)).

c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(483.9): error : The OutputPath property is not set for project 'WpfApplication1.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug'  Platform='MCD.  You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [c:\WpfApplication1\WpfApplication1\WpfApplication1.csproj]

Done Building Project "c:\WpfApplication1\WpfApplication1\WpfApplication1.csproj" (updateuid target(s)) -- FAILED.

 

Build FAILED.

"c:\WpfApplication1\WpfApplication1\WpfApplication1.csproj" (updateuid target(s)) ->

(_CheckForInvalidConfigurationAndPlatform target) ->

 c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.target(483.9): error : The OutputPath property is not set for project 'WpfApplication1.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug'  Platform='MCD.  You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [c:\WpfApplication1\WpfApplication1\WpfApplication1.csproj]

 

0 Warning(s)

1 Error(s)

 

Time Elapsed 00:00:00.09

 

c:\WpfApplication1\WpfApplication1>

 

So, I checked the properties of the MSBuld.exe by right-clicking it and selecting properties. Below is what I saw.

 

Information from "Details" tab from MSBuild.exe Properties

File description  MSBuild.exe

Type              Application

File version      4.0.30319.1

Product name      Microsoft® .NET Framework

Product version   4.0.30319.1

Copyright         ©Microsoft Corporation. All rights reserved.

Size              129 KB

Data modified     3/18/2010 5:23 PM

Language          English (United States)

Original filename MSBuild.exe

 

Then, I decided that instead of using MSBuild to add the Uid tags to my XAML file, I would manually insert at least one myself. See the XAML file below, and rebuild the project.

 

MainWindow.xaml

<Window x:Class="WpfApplication1.MainWindow"

       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

       Title="MainWindow" Height="100" Width="300">

   <Grid>

       <Label Content="Title" Name="label1"x:Uid="label1" />

   </Grid>

</Window>

 

 

Step 5:

Then I attempted to run LocBaml. I copied LocBaml.exe into the Debug folder, and run it in the Command Prompt (2010) window. Here is what I typed:

LocBaml /parse en-US\WpfApplication1.resources.dll /out:My.csv

 

Here is the error I got back from that attempt.

 

Command Prompt Window

c:\WpfApplication1\WpfApplication1\bin\Debug>LocBaml /parse en-US\WpfApplication1.resources.dll

Microsoft (R) Baml Localization Utility 0.0.0.0

Copyright (C) Microsoft Corporation 2005. All rights reserved.

 

Could not load file or assembly 'file:///c:\WpfApplication1\WpfApplication1\bin\Debug\en-US\WpfApplication1.resources.dll' or one of its dependencies.  An attempt was made to load a program with an incorrect format.

 

c:\WpfApplication1\WpfApplication1\bin\Debug>

 

 

 

So, I checked the properties of the MSBuld.exe by right-clicking it and selecting properties. Below is what I saw.

 

Information from "Details" tab from LocBaml.exe Properties

File description  

Type              Application

File version      0.0.0.0

Product name      

Product version   0.0.0.0

Copyright         

Size              34.5 KB

Data modified     11/18/2010 2:26 PM

Language          Language Neutral

Original filename LocBaml.exe

 

 

Summary

Now I have tried many other procedure combinations go get localization to work. My objection is to do it the why the book says to since that most likely will be on the exam. I have found other procedures on the internet from good quality writers, but I think I need to learn this method. What am I doing wrong?  Or what system problem do I have? 

 

Thanks for reading this and helping me.

 

Mike


Leaving a dropped down ComboBox swallows focus in WPF

$
0
0

I have the following problem: on a WPF window I placed a combo box and a button. I drop down the combo box and while the combo box is still dropped down I click on the button. The button does not react on the mouse click but the dropped down combo box closes. After a second mouse click the button reacts. And here's the code sample:

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Height="100"Width="300"><Grid><ComboBoxVerticalAlignment="Top"HorizontalAlignment="Left"Width="100"IsSynchronizedWithCurrentItem="True"><ComboBoxItemContent="item 1"/><ComboBoxItemContent="item 2"/><ComboBoxItemContent="item 3"/></ComboBox><ButtonContent="Test"VerticalAlignment="Bottom"HorizontalAlignment="Right"Width="100"Click="Button_Click"/></Grid></Window>

and the code behind:

privatevoidButton_Click(object sender,RoutedEventArgs e){MessageBox.Show("Button clicked");}

How can I prevent the combo box to swallow the focus on the button? Thanks.

regards mc

Can't change ComboBox Background

$
0
0

I have two machines with Visual Studio 2013. I am developing in WPF. On one machine I am able to change the ComboBox Brushes either in code or via the property grid. On the other machine I can change the values but nothing happens to the ComboBox. When changing from the properties panel I can see the XAML change but the ComboBox stays its default colors. Has anyone else run into this? What do I need to do to correct it?

Filter WPF datagrid comboboxcolumn based on another datagrid comboboxcolumn

$
0
0
I have a datagrid in Windows Presentation Foundation with two comboboxes. The first combobox is Provinces and the second is Districts. I have tables in SQL for provinces and districts with proper relations. I want to populate only the districts for the selected provinces in the datagrid. I have looked at many articles on the web, but couldn't figure this out. I hope someone will help. 
 
Here is the XAML for the datagrid.
  
<DataGrid x:Name="dgBranches" Background="White" BorderBrush="#5ac7ff" HorizontalAlignment="Left" Margin="34,321,0,0" VerticalAlignment="Top" Height="120" Width="600" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" GridLinesVisibility="All" AutoGenerateColumns="False" IsSynchronizedWithCurrentItem="True"><DataGrid.Columns><DataGridCheckBoxColumn Binding="{Binding MainBranch}" ClipboardContentBinding="{x:Null}" Header="Main Branch" Width="100"/><DataGridComboBoxColumn SelectedValueBinding="{Binding ProvinceID}" x:Name="cbxBranch" DisplayMemberPath="Province" SelectedValuePath="ProvinceID" Header="Province" /><DataGridComboBoxColumn SelectedItemBinding="{Binding DistrictID}" x:Name="cbxDistrict" DisplayMemberPath="District" SelectedValuePath="DistrictID" Header="District" ItemsSource="{Binding Path=Districts}" /><DataGridTextColumn Binding="{Binding Village}" Header="Village"/><DataGridTextColumn Binding="{Binding Location}" Header="Location"/><DataGridTextColumn Binding="{Binding NameOfMarket}" Header="Market Name"/><DataGridTextColumn Binding="{Binding ShopNo}" Header="Shop Number"/></DataGrid.Columns></DataGrid>


 

And the code to populate the comboboxes is 
 
 
Private Sub PopulateProvinces()
    Dim qry As String = "Select * From Provinces"
    Dim a As New SqlDataAdapter(qry, ConnectionRefDB.DBSql)
    Dim d As New DataTable
    a.Fill(d)
    Me.cbxIssuedFrom.ItemsSource = d.DefaultView
    Me.cbxBranch.ItemsSource = d.DefaultView
End Sub
Private Sub PopulateDistricts()
    Dim qry As String = "Select * From Districts"
    Dim a As New SqlDataAdapter(qry, ConnectionRefDB.DBSql)
    Dim d As New DataTable
    a.Fill(d)
    Me.cbxDistrict.ItemsSource = d.DefaultView
End Sub


CLR property in ViewModel set to DataTemplate

$
0
0

Hi,

I have CLR property which has collection of custom class and I want to bind on DataTemplate.

Please help.

WPF Windowless App - Weird Icon

$
0
0

Hi all,

I have a windowless app, that is effectively a silent background app. It has no footprint in the tray. However I've recently noticed that it is in fact displaying a small, circular icon, that I've never seen before. Here it is, can anyone shed any light on how I can remove this? Or just what it is!

UFO!

Regards,

Jib

VB/WPF: How to clone a DataGrid and it's data to a DataGrid on another form

$
0
0

I need the ability to create an exact copy of a DataGrid, along with it's data and column formatting, for showing in a separate form. We have a VB6 version of this working where we duplicate a Listview by looping through the columns and rows, copying the data to a new Listview as we go. I was hoping with .NET/WPF there might be a more efficient way of doing this. 

This copy feature is used when the original DataGrid is small due to size restrictions, and the user wants a larger area to view the data. It's also used to to allow the user to delete unwanted rows from the DataGrid prior to exporting to Excel, without affecting the data in the original DataGrid.

Any help would be appreciated. Thanks!

BTW, I'm not using MVVM (still learning the basics of WPF)

How to design a desktop application with Visual Studio' look and feel

$
0
0
Hello,

I want to open different documents, drag and drop in tabs, I wnat auto hide tabs that can be pinned, toggle views one documen on top to another or split window in halve.

Thanks in advance.

Ribbon Gallery Item/Button Positioning

$
0
0

Hi,

I've created an Excel add-in Ribbon with a gallery in it containing both items and buttons. By default, the buttons are below the gallery items, but I'd like them to be on top. Is there a way to do this?

when to use .net set collection in real time ?

$
0
0

Hi,

when i have to use .net set collection ? could you please explain me with real time example ?

Thanks

Batcha, Alavudeen

Transforms/Animation Effect?

$
0
0

Hello All,

I'm new to WPF and for the life of me I cannot figure out what types of tranforms/animations were done to create this effect in the pic below. The effect I'm most interested in is how the window/page on the left is transformed and the other window/page is in view. What type of layouts and containers were used? Are these windows or pages? Are these actual containers that are being manipulated? The book I copied this pic from has a link tohttp://windowsclient.net, but it leads me here to MSDN. I'm not necessarily looking for detailed code, but that would be amazing to have. I'm really interested in what techniques were used to create the effects.

Thanks in advance!!!

Show/Hide Datagrid RowDetail

$
0
0

Hello 

please, is it possible to HIDE and SHOW Datagrid RowDetails without using ToggleButon, Arrow , Buton, or checkbox ??

Just onclick on row ==> RowDetails Expand

click again on the same row ==> RowDetails Collapse.

Thanks in advance

ObservableCollection and Thread Safety

$
0
0
I have a thread safe implementation of the ObservableCollection that locks when adding, removing and firing the CollectionChanged event (in case a listener would like to iterate it).

Now I'm wondering, if a control (like ListView) that binds to this collection migth initiate an enumeration without recieving the CollectionChanged event, iterating it without locking it.
Is there a way to make sure this doesn't happen, or do I have to implement the IEnumerable interface myself, and return the enumerator of a copy of the collection in the GetEnumerator method.

Troels

ScrollIntoView lose focus with virtualization

$
0
0

I'm trying to focus my SelectedItem with ScrollIntoView but it won't work because of the virtualization

Here is my code on the SelectionChanged method

 AnimalDataGrid.Focus();
      if (AnimalDataGrid.Items.Count == 0) return;

      var index = AnimalDataGrid.SelectedIndex;
      if (index < 0) return;

      Action action = () =>
      {
        AnimalDataGrid.ScrollIntoView(AnimalDataGrid.SelectedItem);

        var item = AnimalDataGrid.ItemContainerGenerator.ContainerFromIndex(index) as DataGridRow;
        if (item == null) return;

        item.Focus();
      };

      Dispatcher.BeginInvoke(DispatcherPriority.Background, action);

Here is my datagrid

<DataGrid x:Name="AnimalDataGrid" Margin="0,0,0,4" MinHeight="50" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
              EnableRowVirtualization="True"
              EnableColumnVirtualization="True"
              VirtualizingStackPanel.IsVirtualizing="True"
              VirtualizingStackPanel.VirtualizationMode="Standard"
              SelectedItem="{lcwd:ExtendedBinding Path=SelectedAnimal, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
              ItemsSource="{lcwd:ExtendedBinding Path=AnimalList, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 
              IsSynchronizedWithCurrentItem="True"  
              SelectionChanged="AnimalDataGrid_SelectionChanged"
              Sorting="AnimalDataGrid_Sorting">

Font Family Names not sorted

$
0
0

I have a simple ComboBox with font family names like

<ComboBoxName="FontNames"HorizontalAlignment="Center"VerticalAlignment="Center"Width="144"ItemsSource="{x:Static Member=Fonts.SystemFontFamilies}"SelectedIndex="0"SelectionChanged="FontNames_SelectionChanged"/>

If I build my app using .NET Framework 4 Client Profile, the list is not sorted. It looks like a couple of sorted lists were appended, not merged. If I instead use the 3.5 Client Profile, the list is sorted. Same set of names.

Is this a bug, or do we now need to use a CollectionViewSource with a SortDescription? What about other static system resources?


Which approach is good for creating a document viewer in WPF?

$
0
0

I need to create a document viewer in WPF.

  • The document is read-only. This is not an editor.
  • The document usually is very long and not paginated (meaning it is a long scrolling document).
  • The document should be scrolled smoothly, even if it is large.
  • The document control should not hang (unresponsive) while loading a large document (at least show "loading...", instead of freezing).
  • The document needs to be word-wrapped when the user resize the window.
  • The document may contain images and push buttons and hypertext links.
  • It need to support folding like the Visual Studio editor.

First I tried to use the FlowDocument in .NET, but the performance was not so good when the document was long. If I create a document viewer control myself, is there any article or approach that I can refer to? I am thinking about drawing everything using Visuals on a custom control. Is this a good approach?

Scorm Reader in WPF

$
0
0
How can I integrate Scorm reader to WPF APPLICATION?

How to Save/Restore GridSplitter Position?

$
0
0
How do I retain the position that a user has set a GridSplitter to?
I have a grid with two ListViews separated by a GridSplitter.  If the user sets the splitter position I would like to save it using the apps default settings.  I cannot figure out the proper property on the Splitter to capture/restore.  Thanks!

Report Viewer doesn't update with new parameters in the same session.

$
0
0

Hello every body,

I'm writing a reporting application in WPF. Firstly I created the stored procedure in SQL server to collection infos with 2 parameters (@from and @to both date type).

I create a RDLC file in the same project with threes parameters: @from,@to(date) and @chuky (I mean period type likes daily,weekly...etc). Because I had two parameters in stored procedure, so I thought I didn't need to create filter in tablix in RDLC file.

Here is load report and set parameter functions. 

 DateTime from;
 DateTime to;

            if (!(DateTime.TryParse(dpFrom.Text, out from) && DateTime.TryParse(dpTo.Text, out to)))
            {
                MessageBox.Show("Please try again !!", "Data Exception", MessageBoxButton.OK, MessageBoxImage.Stop);
                return;
            }
            Microsoft.Reporting.WinForms.ReportDataSource reportSource = new Microsoft.Reporting.WinForms.ReportDataSource();
            NhaHangDataSet dataSet = new NhaHangDataSet();
            dataSet.BeginInit();
            reportSource.Name = "DataSet1";
            reportSource.Value = dataSet.spReportMonAn;
            _reportViewer.LocalReport.ReportEmbeddedResource = "Nhahang1.Reports.ReportMonAn.rdlc";
            _reportViewer.LocalReport.DataSources.Add(reportSource);
            dataSet.EndInit();
            NhaHangDataSetTableAdapters.spReportMonAnTableAdapter adapter = new NhaHangDataSetTableAdapters.spReportMonAnTableAdapter();
            adapter.ClearBeforeFill = true;
            adapter.Fill(dataSet.spReportMonAn, from, to);
            SetParameters(_reportViewer);            
            _reportViewer.RefreshReport();        
 private void SetParameters(ReportViewer rv)
        {
            ReportParameter[] parameters = new ReportParameter[3];
            parameters[0] = new ReportParameter("from",dpFrom.Text);
            parameters[1] = new ReportParameter("to", dpTo.Text);
            parameters[2] = new ReportParameter("chuky", ((ComboBoxItem)cbbxPeriod.SelectedItem).Tag.ToString());
            rv.LocalReport.SetParameters(parameters);
        }

Everything works well.

But now is the problem. Let's see the first

and the second image.

 As you can see, with the same date condition but not the same data display.

The first image: firstly I created report with coditions are from 10-4-2014 to 10-4-2014 these conditions gave no data display, then I changed the time to (10-4-2011 to 10-4-2014) which is hoped display data, but no data displayed,it updated condition but didn't update the data.

The second image: I opened new windows and  filled the codition (10-4-2011 to 10-4-2014) at once and the data displayed in the second image.

Question: Is there any problem in my C# code. Thanks for reading.

Please help me. 


yenthuan

How to make a window automatically grow with its contents

$
0
0

Hello All,

I have a window, with the windows title bar removed, and in there, I have a custom defined listbox, lst, that binds to code behind. 

The minimum amount of items in this list is one - and hence I would like the size of my window, to only grow big enough to have one list item display nicely. 

Like so:

However, of my list in code behind contains more than one entry, ( lets say 3 entries) I want the listbox and the window to grow bigger and not look like this:

Could you please help me in figuring this out? Sorry I dont think you can copy and paste my xaml as there are too many code dependencies. Here is the xaml anyway:

<Window 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:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
    xmlns:cl="clr-namespace:CommunicationLayer"
    xmlns:System="clr-namespace:System;assembly=mscorlib" x:Class="CommunicationLayer.CustomListControl"
    Closing="Window_Closing" ResizeMode="CanResizeWithGrip" Topmost="True"
    AllowsTransparency="True" WindowStyle="None" Background="Transparent"
    SizeToContent="Width"    
    Left="{cl:SettingBinding Left}" Top="{cl:SettingBinding Top}"
    MinHeight="180" MinWidth="200"
    mc:Ignorable="d" x:Name="Annotation"  Title="{Binding DatabaseColumnName}"><Window.Resources><!-- DV Link Colours --><Color x:Key="InputBoxBorderColour">Black</Color><Color x:Key="DVLinkLightBlue">#7f23b7c2</Color><SolidColorBrush x:Key="DVLinkLightBlueBrush" Color="{DynamicResource DVLinkLightBlue}" /><Color x:Key="DVLinkBlue">#FF00C7D5</Color><SolidColorBrush  x:Key="DVLinkBlueBrush" Color="{DynamicResource DVLinkBlue}" /><Color x:Key="DVLinkBlueComboSelectionBG">#00C7D5</Color><SolidColorBrush  x:Key="DVLinkBlueComboSelectionBGBrush" Color="{DynamicResource DVLinkBlueComboSelectionBG}" /><Color x:Key="DVLinkBlueGradientStop">White</Color><Color x:Key="DVLinkBorderGray">Gray</Color><SolidColorBrush  x:Key="DVLinkBorderGrayBrush" Color="{DynamicResource DVLinkBorderGray}" /><Color x:Key="DisabledForegroundColor">Red</Color><Color x:Key="DVLinkDropdownBGColour">LightGray</Color><Color x:Key="BorderMediumColor">#FF888888</Color><Style x:Key="DVLinkListboxStyle"><!-- this overrides the colour that is displayed when a listbox item is selected (default windows blue theme) --><Style.Resources><ImageBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" /><!-- Background of selected item when not focussed --><SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/></Style.Resources></Style><ControlTemplate x:Key="ComboBoxToggleButtonCircle" 
                 TargetType="{x:Type ToggleButton}"><Grid  ><Grid.ColumnDefinitions><ColumnDefinition /><ColumnDefinition Width="20" /></Grid.ColumnDefinitions><Border x:Name="Border" Grid.ColumnSpan="2" CornerRadius="2" BorderThickness="0.5"   ><Border.BorderBrush><SolidColorBrush Color="DarkGray" /><!--This will change the colour of the combobox's textbox border (not the dropdown's border)--></Border.BorderBrush></Border><Border Grid.Column="0"
                        CornerRadius="0,0,0,0"
                        Margin="0"  ><!--Margin of 0.75 above neccessary to prevent the RHS colour from 'spilling' throug on the left --><Border.Background><SolidColorBrush Color="Transparent"/></Border.Background></Border><Grid Grid.Column="1"><Ellipse Grid.Column="1" Width="16" Height="16" Fill="{DynamicResource DVLinkBlueBrush}"  Stroke="DarkGray" HorizontalAlignment="Center"
                      VerticalAlignment="Center" Margin="0,0,2,0" /><Path x:Name="Arrow"
                      Grid.Column="1"
                      HorizontalAlignment="Center"
                      VerticalAlignment="Center"
                      Data="M 0 0 L 4 4 L 8 0 Z" Margin="0,0,2,0" ><Path.Fill><SolidColorBrush Color="{DynamicResource DVLinkBorderGray}"/></Path.Fill></Path></Grid></Grid></ControlTemplate><ControlTemplate x:Key="ComboBoxTextBox"
                 TargetType="{x:Type TextBox}"><Border x:Name="PART_ContentHost" Focusable="True" Background="{TemplateBinding Background}"  /></ControlTemplate><Style x:Key="{x:Type ComboBox}"
               TargetType="{x:Type ComboBox}"><Setter Property="Margin" Value="0,10,0,0"/><Setter Property="Width" Value="120"/><Setter Property="Height" Value="24"/><Setter Property="OverridesDefaultStyle" Value="true" /><Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" /><Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /><Setter Property="ScrollViewer.CanContentScroll" Value="true" /><Setter Property="MinWidth" Value="120" /><Setter Property="MinHeight" Value="24" /><Setter Property="VerticalContentAlignment" Value="Center"/><Setter Property="Foreground" Value="{DynamicResource DVLinkBlueBrush}"/><!-- * The currently selected text : displayed in the textbox part of combobox *--><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type ComboBox}"><Grid><VisualStateManager.VisualStateGroups><VisualStateGroup x:Name="CommonStates"><VisualState x:Name="Normal" /><VisualState x:Name="Disabled"><Storyboard><ColorAnimationUsingKeyFrames Storyboard.TargetName="PART_EditableTextBox"
                                                Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"><EasingColorKeyFrame KeyTime="0" Value="{StaticResource DisabledForegroundColor}" /></ColorAnimationUsingKeyFrames></Storyboard></VisualState></VisualStateGroup><VisualStateGroup x:Name="EditStates"><VisualState x:Name="Editable"><Storyboard><ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="PART_EditableTextBox"><DiscreteObjectKeyFrame KeyTime="0"  Value="{x:Static Visibility.Visible}" /></ObjectAnimationUsingKeyFrames><ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ContentSite"><DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Hidden}" /></ObjectAnimationUsingKeyFrames></Storyboard></VisualState><VisualState x:Name="Uneditable" /></VisualStateGroup><VisualStateGroup x:Name="FocusStates"><VisualState x:Name="Focused"/><!-- ripped out the FocusedState Storyboard so it doesnt do anything when focused.--><VisualState x:Name="Unfocused"/></VisualStateGroup></VisualStateManager.VisualStateGroups><ToggleButton x:Name="ToggleButton"
                                          Template="{StaticResource ComboBoxToggleButtonCircle}"
                                          Grid.Column="2"
                                          Focusable="false"
                                          ClickMode="Press"
                                          IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/><ContentPresenter x:Name="ContentSite"
                                              IsHitTestVisible="False"
                                              Content="{TemplateBinding SelectionBoxItem}"
                                              ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                                              ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                                              Margin="5,3,23,3"
                                              VerticalAlignment="Center" 
                                              HorizontalAlignment="Left"></ContentPresenter><TextBox x:Name="PART_EditableTextBox"  
                                     Style="{x:Null}"     
                                     Template="{StaticResource ComboBoxTextBox}"
                                     HorizontalAlignment="Left"
                                     VerticalAlignment="Center"
                                     SelectionBrush="{DynamicResource DVLinkLightBlueBrush}"
                                     VerticalContentAlignment="Center"
                                     Margin="3,3,23,3"
                                     Focusable="True" 
                                     Background="Transparent"
                                     Text="{TemplateBinding Text}"
                                     Visibility="Hidden"
                                     Foreground="{DynamicResource DVLinkBlueBrush}"
                                     IsReadOnly="{TemplateBinding IsReadOnly}"/><!-- ** VerticalAlignment centers the text in the editable part of the combobox ** --><Popup x:Name="Popup"
                                   Placement="Bottom"
                                   IsOpen="{TemplateBinding IsDropDownOpen}"
                                   AllowsTransparency="True"
                                   Focusable="False"
                                   PopupAnimation="Slide"><Grid x:Name="DropDown"
                                      MinWidth="{TemplateBinding ActualWidth}"
                                      MaxHeight="{TemplateBinding MaxDropDownHeight}"><Border x:Name="DropDownBorder"
                                            BorderThickness="1" ><Border.BorderBrush><SolidColorBrush Color="{DynamicResource DVLinkBorderGray}" /></Border.BorderBrush><Border.Background><LinearGradientBrush EndPoint="0,1" StartPoint="0,0"><GradientStop Color="#e0e4e7" Offset="0"/><GradientStop Color="#a0a3a5" Offset="1"/></LinearGradientBrush></Border.Background></Border><ScrollViewer Margin="4,6,4,6"><StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" /></ScrollViewer></Grid></Popup></Grid><ControlTemplate.Triggers><Trigger Property="HasItems" Value="false"><Setter TargetName="DropDownBorder" Property="MinHeight" Value="95" /></Trigger><Trigger Property="IsGrouping" Value="true"><Setter Property="ScrollViewer.CanContentScroll" Value="false" /></Trigger><Trigger SourceName="Popup" Property="AllowsTransparency" Value="true"><Setter TargetName="DropDownBorder" Property="CornerRadius" Value="2" /><Setter TargetName="DropDownBorder" Property="Margin" Value="0,2,0,0" /></Trigger><MultiTrigger><MultiTrigger.Conditions><Condition Property="IsEditable" Value="false" /><Condition Property="SelectedItem" Value="{x:Null}" /></MultiTrigger.Conditions><Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible"/></MultiTrigger></ControlTemplate.Triggers></ControlTemplate></Setter.Value></Setter></Style><Style x:Key="{x:Type ComboBoxItem}"
               TargetType="{x:Type ComboBoxItem}"><Setter Property="Foreground" Value="Black" /><!-- * text displayed in the dropdown is black in colour * --><Style.Resources><SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#00C7D5"/><!-- * when the mouse moves over a combobox entry (item), the colour is our own custom blue, instead of windows system default colour 
                note : somehow the colour parameter above does not accept DVLink defined colours
                * --></Style.Resources></Style><ControlTemplate x:Key="TextBoxBaseControlTemplate" TargetType="{x:Type TextBoxBase}" ><Border Background="{TemplateBinding Background}" BorderBrush="{DynamicResource DVLinkBorderGrayBrush}"
                BorderThickness="1" CornerRadius="2" ><ScrollViewer x:Name="PART_ContentHost"/><!-- This line will ensure that the text is displayed --></Border></ControlTemplate></Window.Resources><Border  HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="#3d3d3d" BorderThickness="5" CornerRadius="30" MinHeight="180" Width="200"><Border.Background><LinearGradientBrush EndPoint="0,1" StartPoint="0,0"><GradientStop Color="#e0e4e7" Offset="0"/><GradientStop Color="#a0a3a5" Offset="1"/></LinearGradientBrush></Border.Background><Grid Background="Transparent" ><Grid.RowDefinitions><RowDefinition Height="60*" /><RowDefinition Height="60*" /><RowDefinition Height="60*" /></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinition/></Grid.ColumnDefinitions><Image Name="DragImage" ToolTip="Drag to move application." MinHeight="17" HorizontalAlignment="Right" Margin="0,4,20,0"  VerticalAlignment="Top" Width="16" Source="..\images\MinimizeAndMove\move-button.png" MouseLeftButtonDown="DragApplicationAround"/><Label Content="Window Title" FontSize="18" Height="38" Background="#FF00C7D5" Foreground="DarkGray" HorizontalAlignment="Left" Margin="0,27,0,0" x:Name="Name_lbl" VerticalAlignment="Top" Width="337" VerticalContentAlignment="Center" /><ListBox Grid.Row="1"  Style="{StaticResource DVLinkListboxStyle}" x:Name="lst" Background="Transparent" Margin="0,0,0,0" ItemsSource="{Binding}" DataContext="{Binding}" HorizontalContentAlignment="Stretch" BorderBrush="Transparent" Grid.RowSpan="2"><ListBox.ItemTemplate>  <DataTemplate><StackPanel Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center"   Visibility="{Binding SourceVisibility}"  ><TextBlock Name="validationRule" Text="{Binding Path=Validation}" Background="Transparent" Foreground="Yellow" Margin="14,18,0,0"   Visibility="Collapsed"/><Label Name="DatabaseColumnName" Content="{Binding DatabaseColumnName}" Foreground="{DynamicResource DVLinkBlueBrush}" Height="28" Width="150" Background="Transparent" /><ComboBox x:Name="comboBox1"
                                Margin="0,0,0,8"
                                Background="Transparent"
                                Foreground="{DynamicResource DVLinkBlueBrush}"
                                ItemsSource="{Binding Options}"
                                BorderBrush="Transparent"
                                IsEditable="{Binding SourceMode}"
                                SelectedValue="{Binding DefaultMode, Mode=OneWay}"
                                SelectionChanged="ComboSelectionChanged"
                                Visibility="{Binding ComboVisibility}"
                                ToolTip="{Binding ValidationTooltip}"
                                Height="24" Width="150" />       <TextBox x:Name="textBox1"
                                Margin="0,0,0,8"
                                Background="Transparent"
                                Foreground="{DynamicResource DVLinkBlueBrush}"
                                Visibility="{Binding TextboxVisibility}"
                                ToolTip="{Binding ValidationTooltip}" 
                                Text="{Binding DefaultMode, Mode=OneWay}"
                                TextChanged="TextBoxContentChanged"
                                Height="24" Width="147"/><Line X1="0" Y1="0" X2="170" Y2="0" Stroke="AliceBlue" StrokeThickness="0.5" Margin="0,5,0,0" VerticalAlignment="Bottom"/> </StackPanel></DataTemplate></ListBox.ItemTemplate></ListBox><Button Grid.Row="2" Grid.Column="0" Content="Annotate" BorderThickness="0" Height="29" HorizontalAlignment="Center" Margin="0,0,0,0" x:Name="SubmitAnnotation_btn" VerticalAlignment="Bottom" Width="125" Click="SubmitAnnotation_btn_Click"><Button.Background><LinearGradientBrush StartPoint="0,0" EndPoint="0,1"><LinearGradientBrush.GradientStops><GradientStopCollection><GradientStop Color="{DynamicResource DVLinkBlueGradientStop}" /><GradientStop Color="{DynamicResource DVLinkBlue}" Offset="1.0" /></GradientStopCollection></LinearGradientBrush.GradientStops></LinearGradientBrush></Button.Background><Button.Style><Style TargetType="{x:Type Button}"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type Button}"><Border Background="{TemplateBinding Background}" CornerRadius="2"><ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/></Border></ControlTemplate></Setter.Value></Setter><Style.Triggers><Trigger Property="IsMouseOver" Value="True"><Setter Property="Background" Value="Tomato"/></Trigger></Style.Triggers></Style></Button.Style></Button></Grid></Border></Window>

Best Regards,

Harriet

Viewing all 18858 articles
Browse latest View live


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