|
You may use either Object or CreateObject or CreateObjectEx to achieve this.
You need to pass an initialization parameter to it.
Here is a link which I have followed to create such an application:
http://msdn.microsoft.com/en-us/library/cc265155(VS.95).aspx[^]
Best Regards,
Sam Xavier
www.componentone.com
|
|
|
|
|
You can take a look at my reply. I already told him that he can use initparam but he explained me his scenario again.. ..
|
|
|
|
|
Hi Michael,
Could you please explain me with an example?
Thanks & Regards,
Sumukh
sam
|
|
|
|
|
Hi Sam,
I clicked on the url but not found.
Could u please give me some example?
Thanks & Regards,
Sumukh
sam
|
|
|
|
|
Hello All,
Let's say I have the existing WPF application. There are two kinds of clients who are willing to install my software on their machine and who prefer to use my software like web application without installing on their machine.
I don't like to have two seperated applications (WPF Application and Silverlight Application). I just want to have one application so I'm not so sure what I should do. During these days, I'm just surfing around the internet and collecting the information to make good decision.
1) I think it would be fine if I keep WPF application with ClickOnce for those clients who are willing to install my software on their machine. Can I have an XBAP for those are not happy to install my software? Actually, I don't want to have the seperated applications such as WPF and XBAP. I will have only WPF application but when I deploy that project, I will deploy with ClickOnce once and I will deploy it as XBAP once. Is it possible to do? or Is there any way to convert the WPF project to XBAP project in very easy way? or should I have two differnet applications for two different users?
2) I know there are some differences between WPF and XBAP. Here is the list that I found. Could you please correct me if I'm wrong?
2.1) The client need to install .NET 3.0 or above.
2.2) Coperate Proxy may block the exe file for Xbap application.
2.3) XBAP runs on sandbox so that it has the following limitations
---------Windows and Popup won't work. We need to convert it as a Page.
---------can't use BitmapEffects and Image Encoding
---------Only run in IE6/7/8 browsers and Firefox
---------supports only Windows XP SP2 and later, Server 2K3 and later, and all flavors of Vista
---------XBAPs doesn't work in Windows Vista Sidebar, ActiveX does!
---------You cann't connect the database directly.
---------unable to load a custom mouse cursor in an xbap
---------SaveFileDialog
---------Cross Domain Access
---------File System & Registry Access
---------WindowsForms Interop ("Crossbow")
---------XAML Serialization (via XamlWriter.Save)
---------Full Speech Support
---------RTF Clipboard
---------Full XAML Clipboard Support
---------Drag & Drop
---------HwndHost
3) Some articles said that if we are using ClickOnce, the application will be installed to the client machine. but if we are using XBAP then, it won't install to the client machine and it will be cached. Based on my research, I totally don't agreed with this statement. Xbap application will be downloaded into the Application Cache like what ClickOnce does. (except it won't show in Add/Remove Program and StartMenu). What do you say?
4) no built-in way for XBAPs to prompt and request more permissions but it is possible to use ClickOnce-based methods to gain access to trusted actions
References:
http://scorbs.com/2006/11/09/wpf-internet-sandbox-feature-list-xbaps-loose-xaml/
http://www.charlespetzold.com/blog/2006/11/120718.html
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1536464&SiteID=1&mode=1
http://www.wpflearningexperience.com/?p=23
|
|
|
|
|
Hi
I'm creating a Windows Forms Application with an WPF Element Host.
I want to the user to set the background of an WPF element with use of a ColorDialog.
So I need to convert the System.Drawing.Color to a System.Windows.Media.Brush.
I got it to work when the Color is a NamedColor (isNamedColor) but else I cannot get it to work.
System.Windows.Media.BrushConverter bc = new System.Windows.Media.BrushConverter();
if (_color.IsNamedColor)
{
ColorBrush = (System.Windows.Media.Brush)bc.ConvertFromString(_color.Name);
}
else
{
???????????
}
What should I put at the ?????????
|
|
|
|
|
You can use Color.FromArgb to generate the appropriate values.
ColorBrush.Color.FromArgb(_color.ToArgb()); I'm doing this off the top of my head, so you may need to tweak it slightly but this should work.
|
|
|
|
|
The System.Windows.Media.Brush ColorBrush doesn't contain anything like Color or FromArgb. Neither does the BrushConverter.
|
|
|
|
|
Colours and Brushes are two different things. As mentioned above you can access the components of the colour individually to swap between a System.Drawing and a WPF color.
using (System.Windows.Forms.ColorDialog d = new System.Windows.Forms.ColorDialog())
{
d.ShowDialog();
System.Drawing.Color c = d.Color;
Background = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(c.A,c.R,c.G,c.B));
}
|
|
|
|
|
I Found It.
System.Windows.Media.BrushConverter bc = new System.Windows.Media.BrushConverter();
if (_color.IsNamedColor)
{
ColorBrush = (System.Windows.Media.Brush)bc.ConvertFromString(_color.Name);
}
else
{
ColorBrush = (System.Windows.Media.Brush)bc.ConvertFromString("#"+_color.Name);
}
When it is not a NamedColor it returns for example ffffff80. When you add a # it recognizes and converts it.
Thanks Anyway
|
|
|
|
|
System.Drawing.Color c1 = new System.Drawing.Color();
c1 = System.Drawing.Color.FromName(mycolorString);
System.Windows.Media.Color c2 = new Color();
c2 = Color.FromArgb(c1.A, c1.R, c1.G, c1.B);
modified on Saturday, April 16, 2011 11:21 AM
|
|
|
|
|
Hy! I'm trying to bind a given color to a rectangle in WPF... by now without success.
Here's my not working) approach:
XAML:
<Rectangle Fill="{Binding Path=color1}"
Margin="10,10,10,10"
Height="Auto" Width="Auto"
Grid.Column="0" Grid.Row="0"
/>
...
C# Code:
public Window2()
{
InitializeComponent();
bgColors.SetColors(Colors.Green, Colors.Green, Colors.Red, Colors.Red);
MainDockPanel.DataContext = bgColors;
}
and
internal class BGColors : INotifyPropertyChanged
{
private Color Color1;
public Color color1
{
get { return Color1; }
set { Color1 = value;
NotifyPropertyChanged("color1");
}
}
private Color Color2;
public Color color2
{
get { return Color2; }
set { Color2 = value;
NotifyPropertyChanged("color2");
}
}
private Color Color3;
public Color color3
{
get { return Color3; }
set
{
Color1 = value;
NotifyPropertyChanged("color3");
}
}
private Color Color4;
public Color color4
{
get { return Color4; }
set
{
Color2 = value;
NotifyPropertyChanged("color4");
}
}
public void SetColors(Color color1, Color color2, Color color3, Color color4)
{
this.color1 = color1;
this.color2 = color2;
this.color3 = color3;
this.color4 = color4;
}
private void NotifyPropertyChanged(string p)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(p));
}
}
public override string ToString()
{
return color1.ToString();
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
}
Binding the values as string to a label works perfectly, but no Colors can be assigned.
Help would be appreciated.
Thx in advance
|
|
|
|
|
When a data binding is not working, the first place to look is the Immediate Window. The message I got when trying your code is:
Cannot create default converter to perform 'one-way' conversions between types 'System.Windows.Media.Color' and 'System.Windows.Media.Brush'.
Either you will need to change the BGColors class to give brushes, or you will need to write a converter.
|
|
|
|
|
Also - make sure that the Color type you are binding is of the right kind. You can't bind a System.Drawing.Color to a WPF element - you need to use a System.Windows.Media.Color type. I got caught by this not so long ago and it had exactly the symptoms you describe - no problem reported however the color was ignored.
Melbourne. Australia.
modified 10-Jul-19 21:02pm.
|
|
|
|
|
|
Fill property of a Rectangle takes in a string. Try giving the name of color1 instead of the Color itself. It will work.
|
|
|
|
|
Hi there.
I want to convert Brushes.* to the hexadecimal numbers to using in HTML's files.
For example I'd like to convert Brushes.Black to the #000000 or Brushes.White to the #FFFFFF.
Can you help me ?
Freshman
|
|
|
|
|
Well - you can always get this using the Colors.A, Colors.R, Colors.G and Colors.B from the brush colour.
|
|
|
|
|
Thank you.
Can you write a sample code (Please)
I'm new
Freshman
|
|
|
|
|
Thinking about it, the simplest way is to do this:
SolidColorBrush brush = Brushes.Aqua ;
string color = string.Format("#{0}",brush.ToString().Substring(3)); The brush includes an alpha component at the start, so you need to remove it from the text. This means you need to do a substring on the ToString() which returns the full ARGB version of the colour.
|
|
|
|
|
Nice
You're expert in WPF.
Thank you very much Pete
Freshman
|
|
|
|
|
I have the Implementaion for Displaying treeListView but, don't know how to do DragDrop in it??
|
|
|
|
|
Josh has an excellent article here[^] that can be easily adapted to treeview drag/drop.
|
|
|
|
|
hi,
how we can set F1 key for image button to open chm file in wpf
|
|
|
|
|
I have got it.
Add Window.CommandBindings in xaml file.
Add tag CommandBinding Command='ApplicationCommands.Help' Executed='OnClickContents' as the child of </Window.CommandBindings>
We can write code under event handler for event Executed.
|
|
|
|