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

Undo & redo for gdi graphics

$
0
0

Im trying to implement undo and redo using gdi in wpf. I am not very familiar with gdi and my attempts have been unsuccessful.

On my mouse move event I draw like this:

   using (var g = Gdi.Graphics.FromImage(tempBitmap))
    {
        g.SmoothingMode = Gdi.Drawing2D.SmoothingMode.AntiAlias;
        g.CompositingQuality = Gdi.Drawing2D.CompositingQuality.HighQuality;
        if (currentTool == "eraserBrush")
            g.CompositingMode = Gdi.Drawing2D.CompositingMode.SourceCopy;
        else
            g.CompositingMode = Gdi.Drawing2D.CompositingMode.SourceOver;
        g.DrawLine(pen,p0,p1);
    }

    // Copy GDI bitmap to WPF bitmap.
    var hbmp = tempBitmap.GetHbitmap();
    var options = BitmapSizeOptions.FromEmptyOptions();
    this.writableBmp.Source = Imaging.CreateBitmapSourceFromHBitmap(hbmp,
        IntPtr.Zero, Int32Rect.Empty, options);

    // Redraw the WPF Image control.
    this.writableBmp.InvalidateMeasure();
    this.writableBmp.InvalidateVisual();

tempBitmap is a Gdi bitmap

On my mouse up event I push tempBitmap to a stack, and on my undo event I pop from the stack and do the following:

if (paintStack.Count <= 1)
                    return;

                paintStack.Pop();
                tempBitmap = paintStack.Peek();
 var hbmp = paintStack.Peek().GetHbitmap();
                var options = BitmapSizeOptions.FromEmptyOptions();
                this.writableBmp.Source = Imaging.CreateBitmapSourceFromHBitmap(hbmp,
                    IntPtr.Zero, Int32Rect.Empty, options);

                // Redraw the WPF Image control.
                this.writableBmp.InvalidateMeasure();
                this.writableBmp.InvalidateVisual();

But hitting undo does nothing. I believe I am pushing and poping the wrong item to the stack. I think I should be doing the gdi graphics, and not the tempbitmap, but I am not sure how.


WPF by C-Pad programming

$
0
0

C-Pad is what i intrepret as cmd and notepad programming.I have done VB.Net and C# with C-Pad successfully--given any complicated programme.Even with 250 textboxes,12 butons etc etc.

 I am trying the same with wpf.I am not geting a grip of it.Can any expert suggest a simple programme where in a simple wpf programme--say messagebox with "Hello,world" is achieved.I shall follow it up from there.I am getting difficulty in calling the compiler and also how to compile the xaml file with vb file.Thanks in advance.

   I am not a professional programmer.I am aged 68 and is interested in prgrammming as a hobby.

Thanks in advance.

Venkatraman

Registering events for a com object on the running object table

$
0
0

We have a legacy application written in Smalltalk that is currently tightly coupled to a dotnet module that it starts through COM. We are now developing a new Dot net application that will need to be run separately to this legacy application. In order to do this we are trying to register the new application on the running objects table, and then pick up the running object through a Dotnet Com interface when the legacy application runs.

So far I've managed to get the object registered on the running object table, and accepting calls from the client application.  However I can't work out how to attach to the events that I'm declaring on the server object.

Demo Application can be downloaded from https://skydrive.live.com/redir?resid=A36A8BD9FDD6DC54!24421

Can anyone help please?

Material Design In XAML Toolkit

$
0
0

Hi all, now that WPF is cool again ;) I wanted to share some Material Design WPF stuff I've been working on.  

https://github.com/ButchersBoy/MaterialDesignInXamlToolkit

Thanks,

James


Surface pro 3 camera recording problem

$
0
0

Hi,

I am trying to record camera feed, front or back camera, of the surface pro 3 in my WPF application. I am using directx capture to achieve this. But i am not able to record. I get the message saying that the camera is in use. The same application works on Surface pro 2? Did anyone face the same problem?

Thanks,

Rajesh

[WPF] ComboBox MultiBinding: convert called two times

$
0
0

Hi,

in my datagrid I insert a TextBlock and ComboBox for edit cell.

When I click in the cell for edit, my Convert is called two times.

I not understand why.

XAML

<DataGridTemplateColumn Header="{StaticResource datagridDay}"><DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding Day, Mode=TwoWay}" /></DataTemplate></DataGridTemplateColumn.CellTemplate><DataGridTemplateColumn.CellEditingTemplate><DataTemplate><ComboBox Name="dgCmbDay" DataContext="{Binding}" DisplayMemberPath="Items"><ComboBox.ItemsSource><MultiBinding Converter="{StaticResource DateNumNameConverter}" ><MultiBinding.Bindings><Binding ElementName="dgPlan" Path="CurrentItem"/><Binding Source="{StaticResource AnalysisPlanViewModel}" Path="ListDayNameOfWeek"/><Binding Source="{StaticResource AnalysisPlanViewModel}" Path="ListDayNumOfMonth"/><Binding Path="Items"></Binding></MultiBinding.Bindings></MultiBinding></ComboBox.ItemsSource></ComboBox></DataTemplate></DataGridTemplateColumn.CellEditingTemplate></DataGridTemplateColumn>

My Converter:

    public class DayNumName : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values == null || values.Length < 4)
                return null;

            AnalysisPlanItemExt analisysPlanItem = (AnalysisPlanItemExt)values[0];
            List<string> listDayOfWeek = (List<string>)values[1];
            List<string> listDayNumOfMonth = (List<string>)values[2];

            if (analisysPlanItem.Type != null)
            {
                //Day of Weeks
                if (analisysPlanItem.Type.Value.Equals(Definition.SchedTypeEnum.DayOfWeek))
                    return listDayOfWeek;

                if (analisysPlanItem.Type.Value.Equals(Definition.SchedTypeEnum.DayOfMonth))
                    return listDayNumOfMonth;
            }

            return null;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new System.NotImplementedException();
        }
    }
Thanks!

create a trigger which set Image source with binding to a dependency property.

$
0
0

I'm trying to create a specified button which switch images every time it pressed, without using the Click CBFunction, so I'm using toggle button and triggers (checked unchecked) and I want this button to supply DP of string so who ever uses is button will only have to specify the images paths and a click CBFuntion toperform what ever he wishes.

I managed to create the
mechanism for switching images with triggers(but the triggers image paths are hard coded and not using DP) and to enable setting a click CBFunction. When I switch the hard coded image path with a DP which return a string with the path the program crush, an exception is thrown.

U.C xaml:

<UserControl x:Class="ButtonChangeImage.UserControl1"
             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"
             mc:Ignorable="d"><Grid><ToggleButton x:Name="btnCI"><ToggleButton.Content ><Image Name="img" Source="C:\Users\AmitL\Desktop\joecocker.jpg"/></ToggleButton.Content><ToggleButton.Triggers><EventTrigger RoutedEvent="ToggleButton.Checked"><EventTrigger.Actions><BeginStoryboard><Storyboard><ObjectAnimationUsingKeyFrames Storyboard.Target="{x:Reference img}" Storyboard.TargetProperty="Source"><DiscreteObjectKeyFrame KeyTime="0:0:0"><DiscreteObjectKeyFrame.Value><BitmapImage UriSource="{Binding FirstImage}"/><!--<BitmapImage UriSource="C:\Users\AmitL\Desktop\james-brown-010.jpg"/>--><!--if I switch to this line it works fine!--></DiscreteObjectKeyFrame.Value></DiscreteObjectKeyFrame></ObjectAnimationUsingKeyFrames></Storyboard></BeginStoryboard></EventTrigger.Actions></EventTrigger><EventTrigger RoutedEvent="ToggleButton.Unchecked"><EventTrigger.Actions><BeginStoryboard><Storyboard><ObjectAnimationUsingKeyFrames Storyboard.Target="{x:Reference img}" Storyboard.TargetProperty="Source"><DiscreteObjectKeyFrame KeyTime="0:0:0"><DiscreteObjectKeyFrame.Value><BitmapImage UriSource="C:\Users\AmitL\Desktop\joecocker.jpg"/></DiscreteObjectKeyFrame.Value></DiscreteObjectKeyFrame></ObjectAnimationUsingKeyFrames></Storyboard></BeginStoryboard></EventTrigger.Actions></EventTrigger></ToggleButton.Triggers></ToggleButton></Grid></UserControl>

U.C cs:

public partial class UserControl1 : UserControl
    {
        public static readonly DependencyProperty FirstImageDP  = DependencyProperty.Register("FirstImage", typeof(string), typeof(UserControl1), new PropertyMetadata(@"C:\Users\AmitL\Desktop\james-brown-010.jpg", new PropertyChangedCallback(FirstImageSource)));

        private string m_strFirstImage = string.Empty;
        private BitmapImage m_oBMImage = null;

        private static void FirstImageSource(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            UserControl1 l_UCBtnSwitchImage = (UserControl1)obj;
            l_UCBtnSwitchImage.m_strFirstImage = (string)args.NewValue;

            l_UCBtnSwitchImage.m_oBMImage = new BitmapImage(new Uri(l_UCBtnSwitchImage.m_strFirstImage, UriKind.Absolute));
        }

        public string FirstImage
        {
            get
            {
                string l_strTemp = (string)GetValue(FirstImageDP);
                return l_strTemp;
            }
            set
            {
                SetValue(FirstImageDP, value);
            }
        }

        public event RoutedEventHandler Click
        {
            add { btnCI.Click += value; }
            remove { btnCI.Click -= value; }
        }

        public UserControl1()
        {
            InitializeComponent();
        }
    }
window xaml:
<Window x:Class="ButtonChangeImage.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:m="clr-namespace:ButtonChangeImage"
        Title="MainWindow" Height="350" Width="525"><Grid><m:UserControl1 Click="ToggleButton_Checked" FirstImage="C:\Users\AmitL\Desktop\james-brown-010.jpg"></m:UserControl1></Grid></Window>



The exception:

A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll

Additional information: 'Provide value on 'System.Windows.StaticResourceExtension' threw an exception.' Line number '20' and line position '46'.

I would love to know why when I switch the hard coded value with DP it suddenly throw exception, how to fix it or if there is other way to achieve U.C with those demands.
Thanks.

[WPF] DataGrid: add a new line, what is the best solution?

$
0
0
Hello everyone,
in my WPF application, the user can add a new line, so I added in the definition of the DataGrid:

CanUserAddRows = "True"


In the current structure of the DataGrid are 6 columns:
1) the first two are not editable (so do not expect a <DataGridTemplateColumn.CellEditingTemplate> in XAML
2) the others are editable via Combobox (prevendono a <DataGridTemplateColumn.CellEditingTemplate> in XAML with relative ComboBox)

In the case in which the user must add a new row, should select the values of the various columns via Combobox populated by DB.

According to you, what would be the best solution for this purpose?

Thank You.

[WPF] ComboBox MultiBinding: not show selected item in the cell of datagrid

$
0
0

Hi,

in my datagrid I insert a TextBlock and ComboBox for edit cell.

When I click in the cell for edit and I select an item of combox, the item selected is not shown in cell of DataGrid.

Why?

XAML

<DataGridTemplateColumn Header="{StaticResource datagridDay}"><DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding Day, Mode=TwoWay}" /></DataTemplate></DataGridTemplateColumn.CellTemplate><DataGridTemplateColumn.CellEditingTemplate><DataTemplate><ComboBox Name="dgCmbDay" DataContext="{Binding}" DisplayMemberPath="Items"><ComboBox.ItemsSource><MultiBinding Converter="{StaticResource DateNumNameConverter}" ><MultiBinding.Bindings><Binding ElementName="dgPlan" Path="CurrentItem"/><Binding Source="{StaticResource AnalysisPlanViewModel}" Path="ListDayNameOfWeek"/><Binding Source="{StaticResource AnalysisPlanViewModel}" Path="ListDayNumOfMonth"/><Binding Path="Items"></Binding></MultiBinding.Bindings></MultiBinding></ComboBox.ItemsSource></ComboBox></DataTemplate></DataGridTemplateColumn.CellEditingTemplate></DataGridTemplateColumn>

My Converter:

    public class DayNumName : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values == null || values.Length < 4)
                return null;

            AnalysisPlanItemExt analisysPlanItem = (AnalysisPlanItemExt)values[0];
            List<string> listDayOfWeek = (List<string>)values[1];
            List<string> listDayNumOfMonth = (List<string>)values[2];

            if (analisysPlanItem.Type != null)
            {
                //Day of Weeks
                if (analisysPlanItem.Type.Value.Equals(Definition.SchedTypeEnum.DayOfWeek))
                    return listDayOfWeek;

                if (analisysPlanItem.Type.Value.Equals(Definition.SchedTypeEnum.DayOfMonth))
                    return listDayNumOfMonth;
            }

            return null;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new System.NotImplementedException();
        }
    }
Thanks!

Can WPF be used to perform finite element analysis?

$
0
0

Hi All,

We are using C#.net, WPF to build a visualization application to mathematically design 3d models for optimization and interface it with Pro E Wildfire. We are able to derive the unstructured wireframe of the model, but would like to view it with a structured (uniform rectangular) wireframe. Also we want to see if there are ways in WPF with which one can peform stress / Force analysis on the 3d model. Is there any external API compatible with WPF available that can be made use of.

Every single direction/ clue is appreciated.

ThanKs n regards,
RM

WPF: how to restrict how many characters to type in DataGrid cell?

$
0
0

how to restrict how many characters to type in DataGrid cell?

For an example, if one column only allow 20 characters, if type more than 20 character, it do nothing. thx!


JaneC

WPF: How can we allow the DataGrid column to expand and shrink by drag column header separator?

$
0
0

How to restrict how many characters to type in DataGrid cell?

Do we need to set any DataGrid property? Thx


JaneC

DelegateCommand complains if I don't add a type to the action var - what is the correct way to proceed?

$
0
0

I created a sample project (VS2012) which populates some datagrids using Entity Framework against sql server 2008 R2 (using DBContext).  I can also add rows to the database from my sample Project.  This is where I use the Delegate command.  Everything appears to work correctly, but, basically, I kludged this together (through trial and error) and now ask the following so that I have at least some idea what I'm doing -- source code below.  My issue is that in the in the command that I bind to an "Add Row" button in the view -- for the Delegate command (the way I set it up) I have

--sample A -- in the DelegateCommand class

private Action<object> m_Action;
public DelegateCommand(Action<object> action)
{
    this.m_Action = action;
}

as opposed to

--Sample B -- I omit the <object> here and get an error

private Action m_Action;
public DelegateCommand(Action action)
{
    this.m_Action = action;
}

because without the <object> type identifier -- I get a complaint from

public void Execute(object parameter)
{
    m_Action(parameter);
}

--Error 1 Delegate 'System.Action' does not take 1 arguments

If I re- add <object> as in sample A then the error goes away.

Based on the following source code -- my question is if it would be possible to modify my setup here so that I don't have to add the <object> for the Action, and what would that look like?  This is purely an exercise, as I would prefer to know what I'm doing rather than just kludging stuff together -- like in public ICommand AddRowCommand section -- it does not appear to matter if I have a "set" -- the project performs correctly with or with out the "set".  The idea is to not be writing code based on "luck", but based on I know what I'm doing.

--code in ViewModel

public void AddRow() { if (this.AuthorID != null && this.AuthorName != null) { var flds = new Author { AuthorId = int.Parse(this.AuthorID), AuthorName = this.AuthorName }; ctx.Authors.Add(flds); ctx.SaveChanges(); FillAuthors(); Console.WriteLine("Row Added!"); } else MessageBox.Show("cannot insert a blank row", "No values to insert", MessageBoxButton.OK, MessageBoxImage.Exclamation); } private ICommand _addRowCommand; public ICommand AddRowCommand { get { if (_addRowCommand == null) { _addRowCommand = new DelegateCommand((abc) => AddRow()); } return _addRowCommand; } //--I noticed that it does not seem to make a difference if I have a set{ _addRowCommand = value; } here } public class DelegateCommand : ICommand { private Action<object> m_Action; public DelegateCommand(Action<object> action) { this.m_Action = action; } public bool CanExecute(object parameter) { return true; }

public event EventHandler CanExecuteChanged; public void Execute(object parameter) { m_Action(parameter); } }



Rich P

Checkbox and RadioButton don't have a ReadOnly property?

$
0
0
I want to check my CheckBoxes and RadioButtons programmatically, and disallow the user checking/unchecking them. Yet I don't see a ReadOnly property for them...
Photographer/Writer/Drummer: www.iceagetrail.posterous.com

MediaPlayer hangs, MediaOpened never fires.

$
0
0
I tried to make a playlist. Due to the asynchronous nature of the MediaPlayer I put all the files in a Queue and:
1. Tell MediaPlayer to Open a file.
2. MediaOpened fires, I read the NaturalDuration, close the file, and tell MediaPlayer to open the next file in the queue, if any.

The problem is that this process magically stops after processing about 20 files. The next MediaOpened never fires. What to do?

class RecordingFolderWatcher : FolderWatcher<Recording> 
    class QueueItem 
    { 
        public KeyValuePair<string, Recording> item; 
        public RecordingFolderWatcher watcher; 
 
        public QueueItem(KeyValuePair<string, Recording> item, RecordingFolderWatcher watcher) 
        { 
            this.item = item; 
            this.watcher = watcher; 
        } 
    } 
 
    static MediaPlayer player; 
    static Queue<QueueItem> queue = new Queue<QueueItem>(); 
    static bool playerBusy = false
    delegate void InvokeMediaPlayerOpen(Uri source); 
 
    public RecordingFolderWatcher() 
    { 
        if (player == null
        { 
            player = new MediaPlayer(); 
            player.MediaOpened += new EventHandler(player_MediaOpened); 
            player.MediaFailed += new EventHandler<ExceptionEventArgs>(player_MediaFailed); 
        } 
    } 
 
    protected override KeyValuePair<string, Recording> CreateItem(string key) 
    { 
        KeyValuePair<string, Recording> item = new KeyValuePair<string, Recording>(key, new Recording(Path + "\\" + key)); 
        queue.Enqueue(new QueueItem(item, this)); 
        ProcessQueue(); 
        return item; 
    } 
 
    static void player_MediaOpened(object sender, EventArgs e) 
    { 
        QueueItem item = queue.Dequeue(); 
        item.item.Value.Length = player.NaturalDuration; 
        player.Close(); 
        playerBusy = false
        ProcessQueue(); 
        if (DesignerProperties.GetIsInDesignMode(App.Current.MainWindow)) return
        item.watcher.OnCollectionChanged(new NotifyCollectionChangedEventArgs(System.Collections.Specialized.NotifyCollectionChangedAction.Replace, item.item, item.item)); 
    } 
 
    static void ProcessQueue() 
    { 
        Debug.WriteLine(queue.Count.ToString() + " items left"); 
        if (queue.Count > 0 && !playerBusy) 
        { 
            playerBusy = true
            // Because FileSystemWatcher's thread runs through here sometimes. Pay no attention.
            dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new InvokeMediaPlayerOpen(player.Open), new Uri(System.IO.Path.GetFullPath(queue.Peek().item.Value.Path))); 
        } 
    } 
 
    static void player_MediaFailed(object sender, ExceptionEventArgs e) 
    { 
        queue.Dequeue(); 
        playerBusy = false
        ProcessQueue(); 
    } 


Does WPF waits for GPU present to complete?

$
0
0

I'm testing how frequently WPF display can change when I have one window per monitor. My frame rate isn't amazing, and using xperf and GPUView it looks like WPF prepares both windows and then calls "Present packet" on both at the same time, and waits for both to complete before moving on to send the next frames to the video card. I think my frame rate could have been faster if WPF didn't wait for the present to complete on both displays. When I run two WPF processes, each with one window on one monitor, the present packets are independent, so parallel processing is more efficient and the frame rate is higher.

Did anyone observe the same behavior? Is there a flag I can set to make the WPF windows of one process more independent? 

A proper solution to a WPF application using On Screen Keyboard

$
0
0
Hi.

I´ve been working for some time on a good OSK solution for my WPF apps, that are running on a tablet. But it´s hard working with the OSK.exe and tabtip.exe, because of several bugs, strange behaviour and no standardized solution to this ordinary problem.

What I (probably) need is a custom textbox control, which inherits from System.Windows.Controls.TextBox, and overrides some methods.

The simple requirements for this textbox should be:
1. When a user clicks in a textfield, the tabtip.exe (or alike) keyboard should pop up at the bottom of the screen (default).
2. If the keyboard pops up on top of the textbox, the contentframe should scroll so that the textbox is visible.
3. When the textbox loses focus, the keyboard should close automatically, except if the user clicks on another textbox.

This seems like pretty standard behaviour right? Well I´ve looked a long time for solutions (there is no standard microsoft way which is kind of weird), and as said I´ve tried making my own but with no luck. For example, sometimes when I try to kill the process, it fails. When I click the close button in the upperright corner on the keyboard, like 5-6-7 times, it closes. The behaviour from PC to tablet is not consistent. The ScrollViewer.ScrollToVerticalOffset(x); sometimes doesent work on a tablet, and so on.

So does any of you know a good solution to this common problem?

Listview filter from Another

$
0
0

I get a list of HOLEID from an SQL database.
I load these into a MVVM ViewModel using a SQL Query

I can display the fields of a ListView (UserGrid)  selected item in a Textbox by using.

Text="{Binding SelectedItem.HoleID, ElementName-"UserGrid"}".

I have a second ListView which should retrieve related records from another SQL table which I can do although I have to get them all as I haven't figured out how to load only once an item is selected in the first ListView.

What I would like is to then filter the second ListView (UserGrid2) by the selected item in the first.

I currently display the (UserGrid2) ListView by using a DataContext and DisplayMemberBinding for header and autogenerate rows.

Thanks

DataGrid Refresh

$
0
0

Is there a way that I can refresh the items in my DataGrid?. I am using C#. Some says that DataGrid.Items.Refresh() is the solution, but it doesn't work. Here's a snippet of my code.

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {

        MongoClient mongoClient { get; set; }
        MongoServer server { get; set; }
        MongoDatabase database { get; set; }
        MongoCollection<facultyData> collection { get; set; }


        public MainWindow()
        {
            InitializeComponent();

            loginDialog dlg = new loginDialog();
            dlg.ShowDialog();



            var dateTime = DateTime.Now;
            dateTime_label.Content = dateTime;

        }

        public void Window_Loaded(object sender, RoutedEventArgs e)
        {

                MongoClient mongoClient = new MongoClient();
                MongoServer server = mongoClient.GetServer();
                MongoDatabase database = server.GetDatabase("facultyDataAndSchedule");
                MongoCollection<facultyData> collection = database.GetCollection<facultyData>("faculty");
                var results = collection.FindAll();
                List<facultyData> resultList = results.ToList<facultyData>();
                // Bind result data to WPF view.
                if (resultList.Count() > 0)
                {
                    Binding bind = new Binding(); //create a new binding to be used on the wpf
                    facultyDataGrid.DataContext = resultList; //sets the data binding for the control
                    facultyDataGrid.SetBinding(DataGrid.ItemsSourceProperty, bind); //syncs the data
                    facultyID_Textbox.DataContext = resultList;
                    facultyID_Textbox.SetBinding(DataGrid.ItemsSourceProperty, bind);
                    lastName_TextBox.DataContext = resultList;
                    lastName_TextBox.SetBinding(DataGrid.ItemsSourceProperty, bind);




                }


        }

        private void viewMenu_click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("Hello", "hiThere");
        }

        private void fRViewMenu_click(object sender, RoutedEventArgs e)
        {
            documentViewer docViewer = new documentViewer();
            docViewer.ShowDialog();
        }

        private void selectionChanged(object sender, SelectionChangedEventArgs e)
        {
            facultyData row = (facultyData)facultyDataGrid.SelectedItem;
            facultyID_Textbox.Text = row.facultyID;
            lastName_TextBox.Text = row.lastName;
            firstName_TextBox.Text = row.firstName;
            middleName_TextBox.Text = row.middleName;
            age_TextBox.Text = row.age.ToString();
        }

        public void addData_Click(object sender, RoutedEventArgs e)
        {
            var connectionString = "mongodb://localhost";
            var client = new MongoClient(connectionString);
            var server = client.GetServer();
            var database = server.GetDatabase("facultyDataAndSchedule");
            var collection = database.GetCollection<facultyData>("faculty");



                var entity = new facultyData { facultyID = facultyID_Textbox.Text.ToString(),
                    age= Int32.Parse(age_TextBox.Text),
                    firstName= firstName_TextBox.Text.ToString(),
                    lastName = lastName_TextBox.Text.ToString(),
                    middleName = middleName_TextBox.Text.ToString(),
                    dateOfBirth="11/11/2011",
                    program= "progra", rank="gegs", services="gegsg", status="geh", yearsOfTeachingO=1, yearsOfTeachingS=1};
                collection.Insert(entity);


        }

        private void refreshButton_Click(object sender, RoutedEventArgs e)
        {

        }
    }

    class facultyData
    {
        public ObjectId _id { get; set; }
        public string facultyID { get; set; }
        public string acadYear { get; set; }
        public string program { get; set; }
        public string lastName { get; set; }
        public string firstName { get; set; }
        public string middleName { get; set; }
        public string dateOfBirth { get; set; }

    }



}

Touch gesture

$
0
0

Hello,

I want to make a palm gesture in my project to clean the drawn area, is it possible to make a palm gesture in wpf?.

If it is not possible to make palmgesture in wpf , can i use full handgesture to do same work in wpf?.


Viewing all 18858 articles
Browse latest View live


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