|
There are several ways to do waht you want. I suppose the most application answer would be to ask what you want to set the tag to. It can be any object, and you could use data binding to accomplish your goal.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Hi,
How is it possible to fill a listbox with a colour?
I have populated the listbox but using the background colour does not fill all the background of each item.
How is this solved please?
Thanks
|
|
|
|
|
Try setting the item background to tansparent.
The chase down each element in item and make them transparent as well.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Hello Everyone,
I am viewing a pdf file which is generated in Temp folder in WebBrowser in WPF.
After viewing that there is a button for deleting that file. But while doing
File.Delete(filePath);
It gives me an error of Access denied.File is used by another process.
It is a AcrRdr which is locking the PDF file.but how to delete that file?
Thanks In Advance,
Ashish
|
|
|
|
|
I believe you must close the file so that it is no longer being viewed within the webbrowser, then you should be able to delete it.
|
|
|
|
|
Thanks,
I have done WebBrowser.Dispose(); and it releases the file.
But the webbrowser variable declared in XAML. I need to view another new file again it will not work since the object is Disposed.
Can you help me out how can I release PDF file? I have surfed on google It says AcrRdr holds the file since it is the last file.There is nothing where the browser can be redirected.
Help Needed please.
Regards,
Ashish
|
|
|
|
|
When you do WebBrower.Dispose(), you are "throwing out" your Web Browser control and all its content into the "trash can". All you have to do to release the PDF file it to close the file stream - something like pdfFileStream.Close(), with this you will be able to delete the PDF file and view another PDF file in your web browser
|
|
|
|
|
I am using
webbrowser1.source = filepath;
so there is not anything like filestream..
|
|
|
|
|
Before you delete set webbrowser1.source = null; or try = ""; the point is the system sees it as being used by the webbrowser control and therefore won't allow it to be deleted.
|
|
|
|
|
Thanks for reply..
I have tried Webbrowser1.source = null;
but its not releasing file.
|
|
|
|
|
Hi
I am looking for a open source project which is a vector editor (like MS Visio)using Silverlight. Any information will be appreciated.
Best regards,
|
|
|
|
|
I have some code written as such:
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
if ((object)Template != null)
{
CheckBox chkBox = Template.FindName("chkBox", this) as CheckBox;
}
}
at runtime, this code works perfectly fine and everything is peachy. Inside of the designer, it apperently fails to find the CheckBox. I'm not really sure why... I can find parts that are in the "standard" template like Border "Bd" and ContentPresenter "PART_Header", but nothing in my overridden template.
Any ideas?
|
|
|
|
|
Hmm... kind of weird, but it seems like triggers aren't executed in the designer or something? I set the template via a trigger. If I hard code the template instead, it does show up... so it seems like my trigger isn't getting executed and its not picking my template.
|
|
|
|
|
OK, first of all have you added the template parts you expect to the class? You'd do this normally like:
[TemplatePart(Name="PART_Box", Type=typeof(CheckBox)] Then, have you set the metadata through the DefaultStyleKey ?
DefaultStyleKeyProperty.OverrideMetadata(typeof(TreeViewEx), new FrameworkPropertyMetadata(typeof(TreeViewEx)));
|
|
|
|
|
Isn't TemplatePartAttribute only used by designers like Expression Blend when you go to style the control? At least, thats my understanding of the attribute.
Anyways, what I was doing was setting the template via a trigger:
<Trigger Property="internal:UIHelper.IsAeroTheme" Value="True">
<Setter Property="Template" Value="{StaticResource AeroTreeViewItemTemplate}" />
</Trigger>
<Trigger Property="internal:UIHelper.IsAeroTheme" Value="False">
<Setter Property="Template" Value="{StaticResource TreeViewItemTemplate}" />
</Trigger>
These triggers get executed at runtime, but they don't seem to get executed at design time, so as far as the designer is concerned, I'm using the standard control template.
I just added this code to my TreeViewItem constructor:
if (DesignerProperties.GetIsInDesignMode(this))
{
if (Internal.UIHelper.GetIsAeroTheme(this))
Template = FindResource("AeroTreeViewItemTemplate") as ControlTemplate;
else
Template = FindResource("TreeViewItemTemplate") as ControlTemplate;
}
and it seems to have solved the problem.
|
|
|
|
|
How can I Changing domain host for silverlight and WCF 
|
|
|
|
|
Hello all,
I'm building an app for WP7 (but because my problem seems related to Silverlight/WPF things, I'm asking here). I have a slider wich values are updated every x milliseconds. This leads to unwanted behaviour when the user is dragging the slider to another position. Therefor, I created a new class that inherits from the Slider class, named BusySlider (see below). The problem is now, that my SliderBusy property always seems to be false, even when I'm actually dragging the slider... Any suggestions?
The BusySlider.cs
public class BusySlider : Slider
{
public bool SliderBusy
{
get;
private set;
}
protected override void OnMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e)
{
this.SliderBusy = true;
base.OnMouseLeftButtonDown(e);
}
protected override void OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e)
{
base.OnMouseLeftButtonUp(e);
this.SliderBusy = false;
}
}
And here is a frangment of my Dispatcher.BeginInvoke where the slider gets updated;
Dispatcher.BeginInvoke(new Action(delegate()
{
...
if (!slidePosition.SliderBusy)
{
slidePosition.Maximum = (double)state.CurrentTrack.Length;
slidePosition.Value = (double)state.CurrentTrack.Position;
}
}));
Thanks in advance,
MadMatt
|
|
|
|
|
Hello,
I very new to WPF but i have a little experience in MFC.
I am trying to create a simple GUI based app. In MFC when i add new button for example and i go to button properties i can see a list of avaliable events button can send in WPF i cant find such list.
How can i add event handlers to controls beside doing it directly in the XML file?
Thanks!!!
|
|
|
|
|
If you set the Name property of your button then you can use it in your code behind. Eg.:
Xaml:
<Button Name="myButton" Content="Click Me!"/>
Code behind:
myButton.Click += OnMyButtonClick;
I would suggest you look into commands if you haven't done so already.
Sacha Barber has written a good series of articles which introduces the WPF concepts here is a link to the 3rd which covers commands
WPF: A Beginner's guide: Part 3 of n[^]
|
|
|
|
|
If you are using Visual Studio 2010, open the window/user control in the designer and then select the control you want to add an event for. In the properties panel, there's an Event tab that you can use to choose the event.
|
|
|
|
|
Hello Everyone,
My XBAP Appication is having two things web server and web client.
There is another machine where I am sharing a folder to Windows user(Of Client Machine) which is mapped to client as x: drive.
I need to generate PDF/XLS/TXT file to that mapped drive path which is given by client as destination path.
I am passing UNC Path to server But While doing Directory.GetAccesscontrol it throws an exception 'DirectoryNotFound Exception'.
Here is the Code..
(CODE RUNS ON CLIENT)
{
string FolderUNCPath = GetUNCPath("x:\\Reporting\\Reports"); //(x is Mapped drive)
}
(CODE RUNS ON SERVER)
{
string folderPath = "\\\\AnotherMachine\\Reporting\\Reports"; //(Which is FolderUNCPath...)
DirectorySecurity dirSecurity = Directory.GetAccessControl(folderPath);
}
Throws exeception..(DirectoryNotFound)..
Thanks all in Advance.
Ashish Parmar
|
|
|
|
|
I only ask this question because MSDN says its not allowed, but some posts on the internet say it is allowed, but in my experience, it works 50% of the time. Kind of a shame to not allow binding to internal or protected internal types because that means having to expose private DPs to the world just so you can bind to them.
In regards to my 50% example... I have an internal DP in a ListViewEx : ListView class and ListViewItemEx : ListViewItem can bind to it all day long with no problem.
Copied the code exactly to a TreeViewEx : TreeView class and TreeViewItemEx : TreeViewItem class and the TreeViewItemEx can't access the internal property.
WEIRD.
|
|
|
|
|
Ah you want a discussion, I was just going to parrot the doco. I do know non public does not work, one of the early gotchas I found. "Ok I know I've create the property, there it is in the viewmodel why can't the bloody view see it" - private DUH!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I don't think I've ever seen a private property work in any scenario. Ditto for protected internal. Internal by itself works in a lot of scenarios. I am binding to some internals as we speak. The reason it didn't work earlier was a C&P error . Changed everything from ListViewEx to TreeViewEx except the class type for the registration on the new DPs. Once I changed the new DPs to be registered for the right class, it allowed me to bind to internals.
I don't mind have internal, protected internal or private properties that I use internally for my own nefarious purposes... but I do mind having a public CheezyHackDP .
|
|
|
|