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

Model classes in WPF MVVM pattern

$
0
0

Hi,

I am a bit confused after reading similar threads here in addition to Microsoft Prism guidelines on MVVM section.  I do understand the interaction between View and ViewModel classes, but my understanding on the connection between VewModel and Model classes are a bit blurred. 

For instance in Prism's MVVM section it states this:

Typically, the model implements the facilities that make it easy to bind to the view. This usually means it supports property and collection changed notification through the INotifyPropertyChanged and INotifyCollectionChanged interfaces.

But I thought those Interfaces implemented by ViewModel classes.  Also, when I created Data Model through EF in VS it automatically created EF entity classes.  I presume these are my model classes to use, but the comments inside say that I shouldn't change those generated classes.  How then can I implement the above Interfaces ?

Thank you



How to default print preference to A5 when printing flowdocument

$
0
0

Hello,

I'm having a problem. I need my printer to default to A5 print out without altering the print preferences but by doing it through code.

here is my print Code:

 System.Windows.Controls.PrintDialog pd = new System.Windows.Controls.PrintDialog();
           
            if (pd.ShowDialog() == true)
            {
              

                myFlowDocument.PageHeight = pd.PrintableAreaHeight;                
                myFlowDocument.PageWidth = pd.PrintableAreaWidth;
                myFlowDocument.PagePadding = new Thickness(45, 40, 30, 30);                
                //myFlowDocument.PagePadding = new Thickness(50);
                myFlowDocument.ColumnGap = 0;
                myFlowDocument.ColumnWidth = pd.PrintableAreaWidth;
                HeaderedFlowDocumentPaginatorResult paginator = new HeaderedFlowDocumentPaginatorResult(myFlowDocument);                    
                pd.PrintDocument(paginator, "flow doc");

}

Thank you in advance

Async warnings

$
0
0

What's the idea that compiler gives warnings about asyncs:

        public async void AddButton()
        {
            int found = -1;
            ...
            Task<int> findName = CheckNameAsync(FirstName, LastName);<other stuff>
            found = await findName;
            ...
        }

        async Task<int> CheckNameAsync(string first, string last)
        {
            int found = -1;
            Console.WriteLine("CheckNameAsync");
            using (var ctx = new NorthwindEntities())
            {
                foreach (Employee emp in ctx.Employees.Select(c => c))
                {
                    if ((emp.FirstName == first) && (emp.LastName == last))
                    {
                        found = emp.EmployeeID;
                    }
                }
            }
            await Task.Delay(1000);
            return found;
        }

This is fine, but if I comment the line "await Task.Delay(1000)" I get a warning:

[quote]

Warning 1 This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. C:\Users\xxx\Documents\Visual Studio 2012\Projects\NorthwindCaliburn\NorthwindCaliburn\ViewModels\EmpAddViewModel.cs 296 25 NorthwindCaliburn

[/quote]

Why does the compile thing there needs to be some waiting involved to cause delay that calls for asynchronity? Especially when the compiler may not know the internals of some library function that may internally do some waiting.

Also, what does zero delay value do? The documentation doesn't tell.

Does it yield, or maybe it has no effect at all?

Binding to an image

$
0
0

Hello All,

I have the following setup in my code behind:

            Binding myImageBinding = new Binding("Status");
            myImageBinding.Source = viewModel;

            myImageBinding.Converter = new ImplementationLayer.Converter.ImageConverter();
            BindingOperations.SetBinding(StatusImage, Image.SourceProperty, myImageBinding);

in my xaml I have the follwing defined:

<Image  Name="StatusImage" Height="40" HorizontalAlignment="Left" Margin="12,14,0,0" Stretch="Fill" VerticalAlignment="Top" Width="40" Grid.Column="1" />

How do I change the xaml, in order for the binding above, to be included in the xaml?

Thank you for helping...

Harriet

How loop through Databound DataTemplated ListBoxItems that are NOT Selected in wpf?

$
0
0

I can loop through selected items using "SelectedItems.Count" & "SelectedItems(i)".
I can loop through all items using "Items.Count" & "Items(i)".
How is one supposed to loop through non selected items given a ListBox with randomly selected items?
In VB6 I would loop through all Items and test using "If Not Selected(i) Then..."
In wpf there doesn't appear to be a "Selected" or "IsSelected" property! Am I missing something?

...

(I'm guessing I need to set "IsSelectedProperty" in the data template somehow, but do I? and how?)


Gouranga Gupta :-)



Sample projects for MVVM Light

$
0
0

Hi,

I've created a project in VS 2012 with MVVM Light(4.5) template.  It comes with few classes and folders.  I was wondering if there are any sample codes or examples on how to customise it for basic needs.

I am struggling to understand ViewModelLocator class, ServiceLocator and SimpleIoc.  I've searched online and understand that the locator is a singleton instance for an entire application and a repository for all viewModels. 

I don't understand do I need to create properties in this class for each viewModel or how does it work ?  Are there any simple but real word examples  - I am just failing to grasp the basics of MVVM Light and it's template.

thanks

MultiColumn ComboBox...

$
0
0

I'm trying to build a MultiColumn ComboBox. I followed this example:

http://zamjad.wordpress.com/2012/08/15/multi-columns-combo-box/

However, I have two problems...

1. It does not show two or three columns in the drop down, it only shows one column.

2. For some reason, when I change the value in the combobox the whole record changes!!

Here is my code:

       ICollectionView source { get; set; }
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            System.Windows.Data.CollectionViewSource orderViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("orderViewSource")));
            orderViewSource.Source = App.StoreDB.getAllOrders();
            source = (this.FindResource("orderViewSource") as CollectionViewSource).View;
        }

   public class StoreDB
    {
        NorthwindEntities context = new NorthwindEntities();

        public ICollection<Order> getAllOrders()
        {
            var orders = (from o in context.Orders
                          select o).OrderBy(o => o.OrderID).ToList();
            return orders;
        }
    }

XAML:

<Window
        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:NorthWindData="clr-namespace:NorthWindData;assembly=NorthWindData" mc:Ignorable="d" x:Class="WpfMultiColumnComboBoxFromDB.MainWindow"
        Title="MainWindow" Height="374.539" Width="602.491" Loaded="Window_Loaded"><Window.Resources><CollectionViewSource x:Key="orderViewSource" d:DesignSource="{d:DesignInstance {x:Type NorthWindData:Order}, CreateList=True}"/></Window.Resources><Grid><Grid x:Name="grid1" VerticalAlignment="Top" Margin="152,49,0,0" HorizontalAlignment="Left" DataContext="{StaticResource orderViewSource}"><Grid.RowDefinitions><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions><Label VerticalAlignment="Center" Grid.Row="0" Margin="3" HorizontalAlignment="Left" Grid.Column="0" Content="Order ID:"/><TextBox x:Name="orderIDTextBox" Width="120" VerticalAlignment="Center" 
                     Text="{Binding OrderID, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" 
                     Grid.Row="0" Margin="3" Height="23" HorizontalAlignment="Left" Grid.Column="1" IsEnabled="False"/><Label VerticalAlignment="Center" Grid.Row="1" Margin="3" HorizontalAlignment="Left" Grid.Column="0" Content="Customer ID:"/><TextBox x:Name="customerIDTextBox" Width="120" VerticalAlignment="Center" Text="{Binding CustomerID, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" Grid.Row="1" Margin="0,6,-166,4" Height="22" HorizontalAlignment="Right" Grid.Column="1"/><ComboBox x:Name="CustomerIDComboBox" Grid.Column="1" Grid.Row="1" 
                          ItemsSource="{Binding}" HorizontalContentAlignment="Stretch"><ComboBox.ItemTemplate><DataTemplate><TextBlock Margin="2" Text="{Binding CustomerID}"/></DataTemplate></ComboBox.ItemTemplate><ComboBox.ItemContainerStyle><Style TargetType="{x:Type ComboBoxItem}"><Setter Property="Template"><Setter.Value><ControlTemplate><Grid><Grid.ColumnDefinitions><ColumnDefinition/><ColumnDefinition/><ColumnDefinition/></Grid.ColumnDefinitions><TextBlock Margin="5" Grid.Column="0" Text="{Binding CustomerID}"/><TextBlock Margin="5" Grid.Column="1" Text="{Binding CompanyName}"/><TextBlock Margin="5" Grid.Column="2" Text="{Binding ContactName}"/></Grid></ControlTemplate></Setter.Value></Setter></Style></ComboBox.ItemContainerStyle></ComboBox><Label VerticalAlignment="Center" Grid.Row="2" Margin="3" HorizontalAlignment="Left" Grid.Column="0" Content="Employee ID:"/><TextBox x:Name="employeeIDTextBox" Width="120" VerticalAlignment="Center" Text="{Binding EmployeeID, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" Grid.Row="2" Margin="3" Height="23" HorizontalAlignment="Left" Grid.Column="1"/><Label VerticalAlignment="Center" Grid.Row="3" Margin="3" HorizontalAlignment="Left" Grid.Column="0" Content="Freight:"/><TextBox x:Name="freightTextBox" Width="120" VerticalAlignment="Center" Text="{Binding Freight, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" Grid.Row="3" Margin="3" Height="23" HorizontalAlignment="Left" Grid.Column="1"/><Label VerticalAlignment="Center" Grid.Row="4" Margin="3" HorizontalAlignment="Left" Grid.Column="0" Content="Order Date:"/><DatePicker x:Name="orderDateDatePicker" VerticalAlignment="Center" SelectedDate="{Binding OrderDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" Grid.Row="4" Margin="3" HorizontalAlignment="Left" Grid.Column="1"/><Label VerticalAlignment="Center" Grid.Row="5" Margin="3" HorizontalAlignment="Left" Grid.Column="0" Content="Required Date:"/><DatePicker x:Name="requiredDateDatePicker" VerticalAlignment="Center" SelectedDate="{Binding RequiredDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" Grid.Row="5" Margin="3" HorizontalAlignment="Left" Grid.Column="1"/></Grid><Button HorizontalAlignment="Left" x:Name="btnFirst" Width="35" Height="23" VerticalAlignment="Top" Click="btnFirst_Click" Content="|&lt;" Margin="369,278,0,0"/><Button HorizontalAlignment="Left" Margin="410,278,0,0" x:Name="btnPrevious" Width="35" Height="23" VerticalAlignment="Top" Click="btnPrevious_Click" Content="&lt;"/><Button Margin="454,278,0,0" x:Name="btnNext" HorizontalAlignment="Left" Width="35" Height="23" VerticalAlignment="Top" Click="btnNext_Click" Content="&gt;"/><Button HorizontalAlignment="Left" Margin="498,278,0,0" x:Name="btnLast" Width="35" Height="23" VerticalAlignment="Top" Click="btnLast_Click" Content="&gt;|"/></Grid></Window>

Any Help will be greatly appreciated...


Guisselle

Custom UIElementCollection inside Panel

$
0
0

Hi,

I am trying to write my custom collection of UIElements inside my custom Panel that shall only add or remove UIElements without any additional logic like probably the standard microsoft InternalChildren collection might contain.

The custom collection shall kind of work like I mentioned already as standard microsoft InternalChildren. As I already mentioned I am writing a custom Panel and I would like to understand what is going on under the hood of such panels in Wpf therefore I am doing this.

I realized that just overriding methods like GetChildrenCount or GetVisualChild doesnt do the job since for some reason children collection behaves bit strange once inside Panels. What I mean by strange is that once I try to do add action on my custom collection of type List<UIElement> while inside MeasureOverride of the panel I get exceptions thought when I use the standard InternalChildren everything works fine. I assume that microsoft does some additional internal logic. 

I need to have my custom UIElementCollection just to manage the items without any additional logic.

Am I missing something except overriding GetChildrenCount and GetVisualChil(index) methods?

I appreciate any ideas, suggestions, code example etc.




Vscroll in tabcontrol

$
0
0

hi all

I have tabpage I want add vertical scroll in it but I my code didn't successful

 
tabpage.VerticalScroll.Visible = True
tabpage.VerticalScroll.Enabled = True
tabpage.AutoScroll = True
is there anymetod to insertvscroll to tabpage ??

Switching among opened window in WPF on pressing 'Alt + Ctrl' key

$
0
0

Hello All,

I am stuck with a below problem, I would be very thankful to any genius person who can provide me the solution of this problem.

Problem : In my WPF application I can open 3-4 window(XAML file) as a pop up from main window on different button’s click. Now on my screen around 4-5 WPF window is opened but I can see only top most window. I want to implement the  functionality in which If I press ‘Alt + Ctrl’ key then I can switch among opened WPF window in same manner as we do on pressing ‘Alt + tab’ key for any opened window on window operating system.   

Any quick reply will be very helpful for me.

Regards

Amit

Why does my bound listbox not update when a new item is added to my collection?

$
0
0

I have a listbox that is bound to an observablecollection that is not getting updated if I add an item to the observable collection through a new form. The list is a list of users invited to a current meeting. If the meeting creator wants to add users a new window is opened and the bound observablecollection is supplied to it via constructor. The new window is basically like an address book where they can add more invitations. The only problem is when the user objects are added to this list they do not show on the original window where my list box is located. I suppose I could use events to add the user at the original window but I want to know why this specifically doesnt work. 

This is the style I am using for the listbox

<Style TargetType="ListBox" x:Key="InvitationListStyle"><Setter Property="ItemTemplate"><Setter.Value><DataTemplate><Border BorderThickness="0,0,0,1"
                                BorderBrush="Gray"
                                Margin="2,1,2,1"
                                Background="Azure"><Grid><Grid.RowDefinitions><RowDefinition/><RowDefinition/></Grid.RowDefinitions><!--1st Row--><Grid><Grid.ColumnDefinitions><ColumnDefinition/><ColumnDefinition/><ColumnDefinition/></Grid.ColumnDefinitions><TextBlock HorizontalAlignment="Left"
                                               VerticalAlignment="Center"
                                               Text="{Binding Path=FirstName}"/><TextBlock Grid.Column="1"
                                               HorizontalAlignment="Left"
                                               VerticalAlignment="Center"
                                               Text="{Binding Path=LastName}"
                                               Margin="3,0,0,0"/><TextBlock Grid.Column="2" 
                                               HorizontalAlignment="Left"
                                               VerticalAlignment="Center"
                                               FontStyle="Italic"
                                               Foreground="Gray"
                                               TextDecorations="Underline"
                                               Text="{Binding Path=Title}"
                                               Margin="3,0,0,0"/></Grid><!--Second Row--><Grid Grid.Row="1"><Grid.ColumnDefinitions><ColumnDefinition/><ColumnDefinition/></Grid.ColumnDefinitions><TextBlock HorizontalAlignment="Left"
                                               VerticalAlignment="Center"
                                               FontWeight="Bold"
                                               Text="{Binding Path=OrganizationName}"/><TextBlock Grid.Column="1" 
                                               HorizontalAlignment="Left"
                                               VerticalAlignment="Center"
                                               Text="{Binding Path=Status}"
                                               FontWeight="Bold"
                                               Foreground="Blue"
                                               Margin="6,0,0,0"/></Grid></Grid></Border></DataTemplate></Setter.Value></Setter></Style>

I bind it by setting the listitemsource to my observable collection.

WPF Image Bind Dynamically

$
0
0

Hi,

Please ANS: How to bind multiple image by browsing and store its path in Datagrid

Adding slider control to Datagirdview in wpf 4.0

$
0
0

HI,

 I am  working on WPF project where i Have to Silder control in datagridview in row using Windows Host ?

so please provide solution 

How to create a custom Template for a RangeSlider usercontrol

$
0
0

I followed this article   Creating a Range Slider in WPF  to create a great Range Slider using XAML and a bit of code behind.  I am using this user control within my project.   But I want to create a style for the control that has a custom thumb and track.  

In my main XAML I use the control like this

<local:RangeSlider LowerValue="1" UpperValue="100"  Style="{DynamicResource RangeSliderStyle1}"/>

the template I created looks like this

But I this doesn't apply the ThumbStyle2 to the thumbs in the Range Slider? 

How would I do this so it works?

<Style x:Key="RangeSliderStyle1" TargetType="{x:Type local:RangeSlider}"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type local:RangeSlider}"><Grid>

<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>

<Canvas x:Name="graph_gutter_horizontal" UseLayoutRounding="False"><Canvas x:Name="Layer_2" Width="635" Canvas.Top="1.888" Canvas.Left="2.636" Height="6.001"><Path Width="617.206" Canvas.Top="0.501" Stretch="Fill" Canvas.Left="0.5" Height="5" Fill="#FF1A1A1A" Data="F1 M620.34269,5.3887 C620.34269,6.4887 619.44269,7.3887 618.34269,7.3887 L5.1357,7.3887 C4.0357,7.3887 3.1357,6.4887 3.1357,5.3887 L3.1357,4.3887 C3.1357,3.2887 4.0357,2.3887 5.1357,2.3887 L618.34269,2.3887 C619.44269,2.3887 620.34269,3.2887 620.34269,4.3887 z"/><Path Width="618.206" Canvas.Top="0" Stretch="Fill" Canvas.Left="0" Height="6.001" Data="F1 M5.135,1.888 C3.758,1.888 2.636,3.011 2.636,4.389 L2.636,4.389 2.636,5.388 C2.636,6.767 3.758,7.889 5.135,7.889 L5.135,7.889 618.34199,7.889 C619.72099,7.889 620.84299,6.767 620.84299,5.388 L620.84299,5.388 620.84299,4.389 C620.84299,3.011 619.72099,1.888 618.34199,1.888 L618.34199,1.888 z M3.636,5.388 L3.636,4.389 C3.636,3.561 4.308,2.889 5.135,2.889 L5.135,2.889 618.34199,2.889 C619.16899,2.889 619.84299,3.561 619.84299,4.389 L619.84299,4.389 619.84299,5.388 C619.84299,6.215 619.16899,6.889 618.34199,6.889 L618.34199,6.889 5.135,6.889 C4.308,6.889 3.636,6.215 3.636,5.388"><Path.Fill><LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1"><GradientStop Color="#FF3F4C57" Offset="0"/><GradientStop Color="#FF273137" Offset="0.51371997594833374"/><GradientStop Color="#FF273137" Offset="1"/></LinearGradientBrush></Path.Fill></Path></Canvas></Canvas><Track x:Name="PART_Track" Margin="0,-12.64,10,-9.32" ><Track.Thumb><Thumb Style="{StaticResource ThumbStyle2}"/></Track.Thumb></Track></Grid></ControlTemplate></Setter.Value></Setter></Style>


Jeff Davis

How to update or upgrade PresentationDesignDeveloper.dll and Draft.PresentationDesignMarkup.dll in WPF .Net 4.0 application

$
0
0

Hi, My wpf browser (hosted) application was developed using earlier versions on .net and WPF that used these 2 dlls referenced from a folder and copy local is set True. 

1. PresentationDesignDeveloper.dll [version 0.6.60821.0]

2. Draft.PresentationDesignMarkup.dll [version 0.6.60821.0]



There are some other dlls like PresentationCore and PresentationFrameworkare also automatically added to references that is from GAC and copy local is set to false. 

I recently upgraded the application to .Net framework 4.0 and noticed the cider dlls are still referenced from a folder. I noticed dlls were from Microsoft Cider, and not sure any higher version or latest dlls available today. 

Please refer the attached screenshots for the usage of these dlls in my pages and controls. 

If I set the copy local = false for these 2 dlls and publish as clickonce, then my xbap throws error as it is looking for these 2 dlls. 

Please let me know whether these dlls can be removed from references and how to update the usage to latest wpf controls. Any help on this would be greatly appreciated.

Thanks,

Arun.K.S



WPF Toolkit Chart Can't Add Series From Code-Behind

$
0
0

I have the Feb. 2010 version of WPF Toolkit installed.  I need to be able to dynamically add LineSeries to a chart.  The following code SHOULD work:

Imports System.Windows.Controls.DataVisualization.Charting
Imports System.Collections.ObjectModel

Class MainWindow

    Dim procVal1 As New ObservableCollection(Of KeyValuePair(Of Integer, Double))

    Private Sub MainWindow_Initialized(sender As Object, e As System.EventArgs) Handles Me.Initialized

        procVal1.Add(New KeyValuePair(Of Integer, Double)(1, 410.3))
        procVal1.Add(New KeyValuePair(Of Integer, Double)(1, 411.3))
        procVal1.Add(New KeyValuePair(Of Integer, Double)(1, 412.3))

        Dim mySeries As New System.Windows.Controls.DataVisualization.Charting.LineSeries
        With mySeries
            .Title = "1"
            .DependentValuePath = "Value"
            .IndependentValuePath = "Key"
            .ItemsSource = procVal1
            .IsSelectionEnabled = True
            .ItemsSource = procVal1
        End With
        me.LineChart.Series.Add(mySeries)

    End Sub

End Class

While executing the code, when I get to the line that creates the LineSeries object, execution stops with the following error:

No Source Available.
Locating source for 'C:\dd\WPF_1\src\wpf\src\ControlsPack\WPFToolkit\DataVisualization\Charting\Series\LineSeries.cs'. Checksum: MD5 {1b c6 9c 8d 23 3b 86 df 36 1f c1 94 a2 a3 79 66} The file 'C:\dd\WPF_1\src\wpf\src\ControlsPack\WPFToolkit\DataVisualization\Charting\Series\LineSeries.cs' does not exist. Looking in script documents for 'C:\dd\WPF_1\src\wpf\src\ControlsPack\WPFToolkit\DataVisualization\Charting\Series\LineSeries.cs'... Looking in the projects for 'C:\dd\WPF_1\src\wpf\src\ControlsPack\WPFToolkit\DataVisualization\Charting\Series\LineSeries.cs'. The file was not found in a project. Looking in directory 'c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\'... Looking in directory 'c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\'... Looking in directory 'c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl\'... Looking in directory 'c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\'... The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: C:\dd\WPF_1\src\wpf\src\ControlsPack\WPFToolkit\DataVisualization\Charting\Series\LineSeries.cs. The debugger could not locate the source file 'C:\dd\WPF_1\src\wpf\src\ControlsPack\WPFToolkit\DataVisualization\Charting\Series\LineSeries.cs'.

There is no LineSeries.cs file that I can find in my PC.  I tried uninstalling and re-installing the toolkit.  No help.  I can still define line series in XAML ok, but need to be able to add them dynamically from code-behind.

Any way to solve this?

Thanks...


Ron Mittelman

DataGridRow Background Color is not responding to DatagridComboBoxColumn Value

$
0
0

Hi friends,

The following code expect the DataGridRow background to be changed based on the value of DataGridComboBoxColumn Serviceability. but it is not happening for ComboBox Columns but same is tested with text box columns and same is happening

<DataGrid.Resources><Style TargetType="DataGridRow"><Style.Triggers><DataTrigger Binding="{Binding SERVICEABILTY}" Value="Serviceable"><Setter Property="Background" Value="Green" /></DataTrigger><DataTrigger Binding="{Binding SERVICEABILTY}" Value="NotServiceable"><Setter Property="Background" Value="Red" /></DataTrigger></Style.Triggers></Style></DataGrid.Resources><DataGridComboBoxColumn SelectedValueBinding="{Binding SERVICEABILITY, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectedValuePath="SERVICEABILTY" DisplayMemberPath="SERVICEABILTY" Header="Serviceabilty" ><DataGridComboBoxColumn.ElementStyle><Style TargetType="ComboBox"><Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Page}}, Path=combodisplayMC_CARD}" /><Setter Property="ItemTemplate"><Setter.Value><DataTemplate><TextBlock Foreground="Blue" Text="{Binding Path=SERVICEABILTY}"/></DataTemplate></Setter.Value></Setter></Style></DataGridComboBoxColumn.ElementStyle><DataGridComboBoxColumn.EditingElementStyle><Style TargetType="ComboBox"><Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Page}}, Path=combodisplayMC_CARD}" /><Setter Property="ItemTemplate"><Setter.Value><DataTemplate><TextBlock Foreground="DarkMagenta" Text="{Binding Path=SERVICEABILTY}"/></DataTemplate></Setter.Value></Setter></Style></DataGridComboBoxColumn.EditingElementStyle></DataGridComboBoxColumn>



itismeiqbal

How to animate vertically scrolling dynamic text array?

$
0
0
I have an "array" of text which dynamically grows as data comes into the application, and I would like to be able to scroll (programmatically, not via direct user input) that array vertically, as well as add to it. I tried to put the data into a DataGrid but that's not really what I want (unless I heavily modify the DG which I'm hoping to avoid). I don't need the array contents to be selectable, just viewable and I will scroll the "current" array item into view. What WPF element(s) should I be using to display and dynamically grow the list?

Is it possible to bind a notification property to another non-UI property?

$
0
0

Is it possible to use the WPF binding mechanism in such a fashion so as to bind a notification property so that a non-UI object will be notified when the property changes? If so, how?


Richard Lewis Haggard

Positioning of a container with height using Margin WPF

$
0
0

I am using a webbrowser control to show a html on a awesomium webbrowser ocntrol and structre of window is like this

<Grid HorizontalAlignment="Center" VerticalAlignment="Center"><my:WebControl Name="bookview1"  />                                    </Grid>

Now i want to show a container above webbrowser at a specific point so i added code to the Grid Container

<Grid HorizontalAlignment="Center" VerticalAlignment="Center"><my:WebControl Name="bookview1"  />                 <Border BorderBrush="Black" BorderThickness="2" CornerRadius="3" Margin="30,30,0,0" Name="MenuArea"  Background="Red" ><Grid><Button Name="CloseSelectionMenu"  Click="CloseSelectionMenu_Click"   Style="{StaticResource ResourceKey=CircleButton}" ToolTip="Close">X</Button><TextBlock FontWeight="Bold" FontSize="12" Name="lblSelectionCurrent"  TextWrapping="Wrap">My cs io sid</TextBlock></Grid></Border></Grid>

Now the position is ok but width and height is occupying the whole space remaining like in the image

. So i set <Border  Width="100" Height="200"  > but now margin property is not correct , the Border container is closer to center

Here Margin is not as expected

How can i position the container with specific dimension using Margin


Thanks ***Share Knowledge to gain more***

Viewing all 18858 articles
Browse latest View live


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