|
There's bound to be one or two you can follow here[^].
|
|
|
|
|
You cant give direct Sql Connectity in the database.
Try using a WCF service to connect to the database.
|
|
|
|
|
The question is in the title. I just need to relieve myself of the gnawing worries, that is, until someone answers "No".
|
|
|
|
|
It should be safe because you are only changing the style and do not delete it or anything like that.
|
|
|
|
|
Thank you, but one more thing: I have come across examples that involve replacing DataGridColumn objects in handlers for AutoGeneratingColumn event. Would you consider that unsafe?
|
|
|
|
|
I have no experience with this. But it sounds kinda scry to me
|
|
|
|
|
You are trying to replace an Event (AutoGeneratingColumn) with an object?
I think you mean and auto generated column with a customised datagridcolumn, therefore replacing one object with the same type of object just custom built. I would think this would be reasonable, be prepared for the column collection to object but I don't see how.
I would locate the column in the collection and customise it in place rather than replacing it.
Caveat - I have never done this either!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thank you, too, but I had written "... replacing DataGridColumn objects in handlers for AutoGeneratingColumn event ...". The author of such an example also expressed concerns, like you did.
|
|
|
|
|
Ah that makes more sense, I would still try and change the existing columns properties rather than replacing it.
In one scenario I know the content of the first 4 columns and change the individual formats in the afterautocolumngenerated event (the event name maybe wrong ). The remainder are from a pivot query and are not formatted.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Is there any possibility to send mail to a specific time when the fact that the whole program on the server
|
|
|
|
|
What does that have to do with Silverlight / WPF ?
I'd use a Scheduled Task.
|
|
|
|
|
Not through Silverlight (since you will not know if the client is running at all times or not).
Use the server to build a scheduled task.
|
|
|
|
|
Is it preferable to move ur desktop application to web based application for enterprise solution...
|
|
|
|
|
Preferable in what sense? It depends on the application, the user community, and what you are trying to achieve.
|
|
|
|
|
Personally I prefer desktop application.
But "Enterprisy people" like web for mostly 2 reason:
1. it's "multiplatform" (you know it work on the 2% of mac and 05% of linux, and on iPad and smart phone, which are more common)
2. it's non brainer deploy once in on a webserver it's out there for every one, and that's the latest version!
Desktop are favored by people who don't mind run an installer an need performance, data crunching, more advanced UI (Javascript is becoming quite good those days, particularly HTML5 e err.. the latest JS) still elaborate user experience is a desktop thing.
For the update of desktop always a problem (you see, in some entreprisy environment, user CAN'T install anything, including update, the likely mandatory .NET framework, etc.) click once does a relatively good job in most case for .NET app and, on WIndows 8, metro app update seemlessly! (although there are curretnly some nasty limitation for .NET business app, like crippled file access, nosql access, this can be handled on the server side as, thankfully, WCF work in metro app!!)
|
|
|
|
|
thanx for ur suggestions...
|
|
|
|
|
I am newbie of WPF and regardless that I am starting my own project in order to learn more everyday.
Before I ask the question I will explain you what I did so far.
Mainwindow.xaml have:
"Button" =
private void ModifyButton_Click(object sender, RoutedEventArgs e)
{
Window1 win2 = new Window1();
win2.ShowDialog();
}
Window1.xaml have:
"image"
"Buttonlink1" "Buttonlink2"
Ok that´s all.
What I want do now is this:
From the Mainwindow.xaml for the button click of "button" I want send 3 path (variables) for the "image" "buttonlink1" and "Buttonlink2" situated in Window1.xaml.
The idea is to have many buttons in the Mainwindow.xaml and each one represent a fix for a software error, this buttons will keep different data. In the "image" I have to send the path of a .jpg that will show an error dialog box. In the "buttonlink1" I have to send the path of a .bat fix that will fix the issue. In the "buttonlink2" I have to send the path of a .bat that will remotely resolve the issue.
So my question is: How i can send this 3 variables (path) from Mainwindow.xaml to window1.xaml? and how "image" "buttonlink1" "buttonlink2" will read it and execute it?
Thank you in advance for your help, I am sorry for eventual grammar errors. If something is not clear, just let me know.
Giuseppe Colello
Newbie WPF/C#
modified 10-Feb-13 14:54pm.
|
|
|
|
|
In your ModifyButton_Click you can detect the sender which is an object, cast the object as a button and get the buttons names. (sender as Button).name
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
May you write an example for me? Sorry
|
|
|
|
|
I have this Image Button class:
public class ImageButton : Button
{
public enum Direction
{
Horizontal,
Verticle
}
StackPanel panel = null;
Image _Image = null;
TextBlock _TextBlock = null;
private Direction _Layout = Direction.Horizontal;
public Direction Layout
{
get { return _Layout; }
set
{
if (_Layout != value)
{
_Layout = value;
panel.Orientation = _Layout == Direction.Horizontal ? System.Windows.Controls.Orientation.Horizontal : System.Windows.Controls.Orientation.Vertical;
}
}
}
public string Text
{
get
{
if (_TextBlock != null)
return _TextBlock.Text;
else
return String.Empty;
}
set
{
if (_TextBlock != null)
_TextBlock.Text = value;
}
}
public ImageSource Image
{
get
{
if (_Image != null)
return _Image.Source;
else
return null;
}
set
{
if (_Image != null)
_Image.Source = value;
}
}
public double ImageWidth
{
get
{
if (_Image != null)
return _Image.Width;
else
return double.NaN;
}
set
{
if (_Image != null)
_Image.Width = value;
}
}
public double ImageHeight
{
get
{
if (_Image != null)
return _Image.Height;
else
return double.NaN;
}
set
{
if (_Image != null)
_Image.Height = value;
}
}
public ImageButton()
{
_Image = new Image();
_TextBlock = new TextBlock();
panel = new StackPanel();
panel.Orientation = System.Windows.Controls.Orientation.Horizontal;
panel.Children.Add(_Image);
panel.Children.Add(_TextBlock);
this.Content = panel;
}
}
This works great, except for one thing. When I set the Layout to Verticle...
<controls:ImageButton Grid.Row="1"
Grid.Column="0"
Image="Media/Images/customer_16.png"
ImageHeight="16"
ImageWidth="16"
Text="Test"
Layout="Verticle"
Height="55"
Width="100"
Command="{Binding OpenCustomerSelectionCommand}"/>
...the Layout property does not show the enum values. If I set it like I did above, it works, but I'd like the enaum values to appear.
Not sure how to do this. Can someone help me out here?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
|
Maybe data flow isn't the right question, maybe application organization describes my quandary a little better. Here is what I am trying to do and could stand a bit of help getting there.
The app I am creating basically sits between two pieces of equipment and provides data management and communications management between the two. On one side is a piece of equipment that views its world as dealing with a single entity that provides a go no-go result. The other side is a piece of gear that can have of measurements to keep up with. Essentially all this data must be gathered, analyzed and a go no-go be sent. One side expects a TCP/IP server the other is a GPIB bus master. The comms are handled as that was the easy part.
Where I am a bit stuck is gluing all this together. The GPIB code and the logic to handle the data is done and runs as a task. The TCP/IP server is done and it runs as a task. I need to add one more piece of logic to handle the decision making plus have a UI that needs to be kept up to date.
Right now I have test programs for testing the comms etc. There I have the UI registering event handlers to get notifications of something happening. I use EventWaitHandles to notify the thin interface layers that sit about the comms. All works great! But when I put all this together..............???
I want areas of functionality as loosely coupled as I can for better reuse. In the UNIX world this is simple but in this world, not so much. My inclination is let the MainWindow code behind kick off each task and the tasks expose public methods or permit registering event handlers. But something about this doesn't feel right. In the UNIX world I would have started POSIX threads to handle each functional area and used message queues to facilitate data flow. That way synchronous functionality is grouped and asynchronous is grouped. But the Windows world doesn't seem to operate that way. What I have seen is all the classes/objects are gathered into a single app and there is a lots of "peeking" over the wall to do things which I think tends to make things very tightly coupled.
Suggestions?
TIA,
Doug
|
|
|
|
|
|
Explain why the method works so crooked add to the collection and display DataGrid.Ispolzuyu binding in XAML
<Window x:Class="bild.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:bild"
Title="MainWindow" Height="519" Width="525">
<Window.Resources>
<sys:ViewModel x:Key="DataSource"/>
</Window.Resources>
<Grid>
<ListBox ItemsSource="{Binding Source={StaticResource DataSource}, Path=Persons}"
DisplayMemberPath="Name"
HorizontalAlignment="Left" Margin="49,21,0,201" Name="listBox1" Width="425" />
<Grid DataContext="{Binding Source={StaticResource DataSource}}" Height="149" HorizontalAlignment="Left" Margin="49,134,0,0" Name="grid1" VerticalAlignment="Top" Width="425">
<DataGrid
ItemsSource="{Binding Source={StaticResource DataSource}, Path=Persons}"
AutoGenerateColumns="False" Height="143" HorizontalAlignment="Left" Margin="36,0,0,0" Name="dataGrid1" VerticalAlignment="Top" Width="383" >
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Age}" Header="Age" ></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="296,290,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
</Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace bild
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
ViewModel r = new ViewModel();
r.ad();
dataGrid1.ItemsSource = r.Persons;
}
}
public class ViewModel
{
public ViewModel()
{
this.Persons = new ObservableCollection<Person>();
this.Persons.Add(new Person("Ivan", 23));
this.Persons.Add(new Person("Stefan", 34));
this.Persons.Add(new Person("Maria", 16));
this.Persons.Add(new Person("Michael", 78));
}
public void ad()
{
this.Persons = new ObservableCollection<Person>();
this.Persons.Add(new Person("Maria", 16));
this.Persons.Add(new Person("Michael", 78));
}
public ObservableCollection<Person> Persons
{
get;
set;
}
}
public class Person
{
public Person(string name, int age)
{
this.Name = name;
this.Age = age;
}
public string Name
{
get;
set;
}
public int Age
{
get;
set;
}
}
}
|
|
|
|
|
What is the exact problem?
After a quick view, I see two things:
1)
After calling the ctor of ViewModel, there will be Ivan, Stefan, Maria and Michael in the Persons collection. After calling ViewModel.Add() there will be only Maria and Michael, because you create a new collection.
2)
class Person needs to implement INotifyPropertyChanged and after changing a property it has to call the PropertyChangedEvent.
Hope it helps
Andy
|
|
|
|