|
Cool. Have a great time with WPF!
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi there,
I want to start silverlight.Where I can find it. Please suggest a link for me so that I can download the same.Codeproject is only one site that I can access...
|
|
|
|
|
|
|
If CodeProject is the only site you can access you're not going to be able to download Silverlight.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Go to the Silverlight Site[^] and click on Get Started[^].
creend wrote: Codeproject is only one site that I can access...
??? Good luck.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am developing WPF custom controls. I want to know the name of the evnt which gets fired when the user deletes the custom control from the cider. I found "public event RoutedEventHandler Unloaded" event of some help, but it gets fired when both control is deleted from cider & the xaml page is unloaded. I am seraching for an event (event name)which gets fired only when a control is deleted from cider.
Thanks,
Vinod
modified on Thursday, July 2, 2009 11:41 AM
|
|
|
|
|
You can check if the control is in design mode and then run your code.
DesignerProperties.GetIsInDesignMode(new DependencyObject())
Search the web for" is in design mode" Very easy to use.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi Karl,
I want to know which event gets fired when the control is deleted from window in Cider.
How does IsInDesignMode will be helpful in that ?
|
|
|
|
|
Vinod C S wrote: How does IsInDesignMode will be helpful in that ?
It's not.
I'll do some checking and see if I can find the information you need.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Vinod,
Trying to figure out "why" you need your control to be notified when being removed from Cider. Is there some clean up you need? If so, IDisposable may work for you.
Let me know.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi Karl,
Thanks for ur reply.
I checked by implementing IDispose, but I didn't get notification in dispose();.
I found another way of doing this task, its by providing a PrimarySelectionTaskProviderfor the Window class:
internal class FSFWindowTaskProvider : PrimarySelectionTaskProvider {
public FSFWindowTaskProvider() {
}
protected override void Activate(ModelItem item) {
ModelService service = Context.Services.GetService(typeof(ModelService)) as ModelService;
service.ModelChanged += new EventHandler<ModelChangedEventArgs>(service_ModelChanged);
base.Activate(item);
}
private void service_ModelChanged(object sender, ModelChangedEventArgs e) {
IEnumerable<Microsoft.Windows.Design.Model.ModelItem> enumerator = e.ItemsRemoved;
foreach (ModelItem mi in enumerator) {
MessageBox.Show(mi.Properties["Name"].ComputedValue.ToString() + "deleted");
string cntrlName = mi.Properties["Name"].ComputedValue.ToString();
if (string.IsNullOrEmpty(cntrlName)) {
continue;
}
}
}
}
internal class Metadata : IRegisterMetadata {
....
builder.AddCustomAttributes(typeof(myWindow),
new FeatureAttribute(typeof(FSFWindowTaskProvider)));
}
In service_ModelChanged, we will get the notification for control deletion.
|
|
|
|
|
Very glad you got this sorted out.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Vinod,
I got this from my team. Please verify you are doing this:
Make sure your customer also overrides Deactivate and removes the event handler he’s added. A new task provider will be created and activated each time his control gets selected.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Here is another block of code I was sent by a team member.
Something slightly tighter is – I don’t know if they’re writing against the old or new Model, hopefully this should work on both.
private void service_ModelChanged(object sender, ModelChangedEventArgs e) {
foreach (ModelItem mi in = e.ItemsRemoved) {
if (typeof(MyControl).IsAssignableFrom(mi.ItemType)) {
}
}
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi Karl,
thanks for the reply. but I can not check for a particular type of control. there
are any custom controls. I have one doubt , can I track the Ctrl + X event here. I mean
I want to know whether ther the user has pressed Ctrl-X or Delete button. In
e.ItemsRemoved I get the control in both the cases.
thanks,
vinod
|
|
|
|
|
Hello,
I am just a begginer in WPF. My query is written below . please give a solution.
I have two classes named "Student" and "Employee" both derived from a base class named "Person". I want seperate data templates for student and employee. ie. for student i wish to display only name with a text box and for emplyee i want two text boxed with name and salary. I will populate a list by setting the item source as Person objects. now when i click on the list the template corresponding to the class that is "Student" or "Employee" should be displayed in the screen. how can i do this.?
Thanks
Jithesh
|
|
|
|
|
Enjoy[^].
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
hi friend i am newbie in WPF i want to use expander control so that i have two toogle button in expander control if First one click then it should expand Down and if the second one click then it should expand right side.
WANTED wasim khan(Killed 50 Innocent Buggs, Distroyed 200 Exception, make 5 Project Hostage) any Compnay Hire him will pay 30,000. Best place where u can get him is Sorcim Technologies Murre Road RWP
|
|
|
|
|
You'll need to retemplate the Expander control, add a second expander button to execute the required code.
Retemplating is not hard once you understand WPF. There are plenty of examples here on Code Project for retemplating controls.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi all,
I want to create twolist box ,one in left side and other in right side in runtime.I wrote one code but i cant set the correct margin
can any one help me.. here is my source code..
in xaml code:
<StackPanel x:Name="stkPnlCaption"
Orientation="Vertical" Height="500" Width="800">
</StackPanel>
in xaml.cs::
ListBox list = new ListBox();
list.Width = 200;
list.Height = 200;
list.Margin = new Thickness(148, 131, 0, 131);
list.HorizontalAlignment = HorizontalAlignment.Left ;
list.VerticalAlignment = VerticalAlignment .Top ;
stkPnlCaption.Children.Add(list);
CheckBox checkBox = new CheckBox();
checkBox.Content = "Yes" ;
list.Items.Add(checkBox);
ListBox list1 = new ListBox();
list1.Width = 200;
list1.Height = 200;
list1.Margin = new Thickness(298, 131, 280, 131);
list1.HorizontalAlignment = HorizontalAlignment.Right;
list1.VerticalAlignment = VerticalAlignment.Top;
stkPnlCaption.Children.Add(list1);
CheckBox checkBox1 = new CheckBox();
checkBox1.Content = "Yes" ;
list1.Items.Add(checkBox1);
i want the both the list box in same height and width ..one in left side and other in right side(paralley).
|
|
|
|
|
An easier way to do this is to use a Grid with two columns, both of which are the same size. Don't set any size info in your listboxes, just assign them to the appropriate grid column and let the grid take care of laying your items out.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
|
|
Hi to all,
i have a small problem.
I have a stackpanel and in this stackpanel i have added some usercontrol. I have implemented a scroll funcionality for this stackPanel childrens. how can I check if a UserControl is visible at that time or is it hidden?
TY
|
|
|
|