|
Put it in a stackview or grid.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I have a slider and I want to change the bitmap used for the slider control, and the size of the slider, based on a boolean property.
So within a style for the slider, I want to change ' Slider_Thumb' in the following:
<Track Name="PART_Track">
<Track.Thumb>
<Thumb x:Name="Thumb" Style="{StaticResource Slider_Thumb}"/>
</Track.Thumb>
</Track>
and the height in this line:
<Setter Property="Height" Value="16" />
How do I go about doing that ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian - take a look at this[^] article from Sacha and Marlon. They have restyled the slider control (about 3 quarters of the way down).
|
|
|
|
|
thanks - but i think they are just styling it. I've done that. I want to change the style I use, in code, based on a property
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Where does the boolean property come from?
If it is one of the Sliders or Thumbs properties a Trigger will work. See the ControlTemplate example for slider, it uses a Trigger to change the color of the thumb on mouse over and change the size of the slider based on its orientation.
If the property is from elsewhere a DataTrigger might work but you would probably have to alter your resources a bit.
|
|
|
|
|
Looks promising - thanks.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Hello,
i'm studying WPF for quite a while and i've some problems understanding how to perform a simple implementation i usually use in my programs. I've a treeview representing at the various levels different types of items. When i click on an item i can see a form/property grid/etc showing the attributes of that element so i can modify/see them. Of coruse each type of element has different attributes.
There's also another situation when you have a list of items and not a treeview, but each item is logically attached to a serie of data (see for example an options dialog when you have the list of categories on the left and on the right the options of the selected category)
I'm thinking about two ways to do that and i'd like your opinions:
1) Assign a window (or i presume, an user control) to a panel on the fly when the selected item is change. Is it possible? There's a way to do that only via xaml?
2) Load each type of details control via xaml and somehow bind the visibily property of each control to the type of the selected item
3) As you can do a datatemplate to represent each item in the treeview, apply different templates to the panel binded to the selected item of the treeview, using the DataType property of the template to bind the correct panel to the current item type. Is it possible? Is there any example of that?
Thanks
|
|
|
|
|
It sounds to me like you are describing what would normally be done with a tab control. I would start there and style the tab control to get the "tabs" to look how you want. Since TabControl inherits from ItemsControl, any trick you used for other list/tree controls should work there as well. Hopefully some sort of style would work, but if not, you could always write a new control template.
If that does not work, I would recommend your option 2. I would use radio buttons (with the template modified to not show the circles) in a stack panel and bind the Visibility of the options "pages" to the IsChecked of the radio button. Since Visibility is not a boolean, this will of course require either a converter or some clever triggers.
A little poking around and I got this as something you may be able to start from:
<TabControl TabStripPlacement="Left">
<TabControl.Resources>
<DataTemplate x:Key="TabHeaderTemplate">
<StackPanel Margin="3">
<TextBlock>Option Group</TextBlock>
<TextBlock Text="{Binding}" />
</StackPanel>
</DataTemplate>
</TabControl.Resources>
<TabItem Header="Tab Number 1"
HeaderTemplate="{StaticResource TabHeaderTemplate}">
<Button>BTN 1</Button>
</TabItem>
<TabItem Header="Tab Number 2"
HeaderTemplate="{StaticResource TabHeaderTemplate}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0">Property 1</TextBlock>
<TextBox Grid.Row="0" Grid.Column="1">ddd</TextBox>
<TextBlock Grid.Row="1" Grid.Column="0">Property 2</TextBlock>
<TextBox Grid.Row="1" Grid.Column="1">fff</TextBox>
</Grid>
</TabItem>
</TabControl>
|
|
|
|
|
I am setting a combobox with 3 choices that the user will select one. When the choice is made, I want to put the choice in the Properties.Settings.Default.ApplicationSelected which I have defined as an int. So far, so good.
But when the user restarts the application, I would like to cause the combobox to be set to the saved choice. I haven't found any way to do this, and I get an error when I do this:
comboBox1.SelectedIndex = Properties.Settings.Default.ApplicationSelected;
How do I do this?
Chuck Summers
summers.chuck@gmail.com
|
|
|
|
|
Are you sure that the setting is being saved???
I do all my users settings binding in XAML:
Create a ResourceSettings.xaml file like:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:settings="clr-namespace:YourNameSpace.Properties">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<settings:Settings x:Key="settings" />
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Then in app.xaml as a dictionary pointing to this in your merged dictionaries:
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="SettingsResources.xaml"/>
</ResourceDictionary.MergedDictionaries>
then for each setting you wish to bind do:
PropertyToBind="{Binding Source={StaticResource settings}, Path=Default.MainTop, Mode=TwoWay}"
Don't forget to add a window_closed to your main window with:
private void Window_Closed(object sender, EventArgs e)
{
Settings.Default.Save();
}
Cheers,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
I know it is being saved, and I would like to do it in C#, but I'll look at your solution to see if I can use that.
Thanks for your time,
Chuck
|
|
|
|
|
Hi
Is there any class in .Net Silverlight which is used for updating version of application.
Regards
ABM
|
|
|
|
|
Normally, we used to update the version of application manually. Why do you want to update the version of Silverlight from code?
|
|
|
|
|
hello ng,
how can i open/show a wpf-contextmenu with the left mouseclick???
byby andy
|
|
|
|
|
hello,
it is so simple:
ContextMenu.isOpend = True
is the solution
byby andy
|
|
|
|
|
I've come across some really unexpected behavior using the OpenFileDialog, WPF, and a PocketPC (physical) device.
I'm trying to let users select a file on their PocketPC using an OpenFileDialog, and when the user selects Open, WPF copies the file into the Temporary Internet Files directory, and then returns that as the path. I'm really confused as to why this happens, but here's the code to reproduce it.
Dim ofd As New Microsoft.Win32.OpenFileDialog
ofd.CheckFileExists = False
ofd.CheckPathExists = True
ofd.AddExtension = False
ofd.Filter = "Folders|*.*"
ofd.Multiselect = False
ofd.InitialDirectory = "C:\"
ofd.ShowDialog()
Console.WriteLine(ofd.FileName)
When I select a file from the My Documents (eg, "\My Documents\Meeting Notes.psw") directory on my PocketPC, this is the output that is written in the console "C:\Users\*****\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\82P6MGLK\Meeting_Notes[1].psw" (Note, the astericks are used to hide my user-name). In addition to this, if you try it with a large file, the UI just freezes until the file finishes copying. Windows does not say that the program is "Not Responding", just you can't interact with the UI at all.
Does anyone know why this happens? It certainly is interesting behaviour.
Thanks,
Mitch
modified on Thursday, June 12, 2008 1:11 AM
|
|
|
|
|
It'll be the same behaviour as with a Windows Forms app. It sounds like you are performing the copy on the primary thread, which blocks the UI until it completes the operation. Try moving the copy onto a background thread instead - this should help.
|
|
|
|
|
Pete O'Hanlon wrote: It'll be the same behaviour as with a Windows Forms app.
I just tried the same block of code in .Net 2.0, and that's correct; it copied the file to my hard drive as well.
Pete O'Hanlon wrote: It sounds like you are performing the copy on the primary thread, which blocks the UI until it completes the operation.
The only thing that confuses me is that I don't have any code to perform the copy in my project; when the user presses the Open button on the OpenFileDialog, it is copied over automatically without any extra code.
Thanks,
Mitch
|
|
|
|
|
Hi all
I am developing an Voice Chat Application in WPF.....
I used DirectSound For Capturing the Audio.
Using WaveFormat I am capturing the audio bytes and sending it over the client.....
My client is receiving the Audio Byte...But it is not playing.......
Can anyone tell me what will be the reason.......
I have written the code for audio capturing in the seperate class, let us say voicechat.cs
in that device.SetCooperativeLevel is creating problem...
so i have inherited System.windows.forms.Form and used....
the way i used to set cooperative level is correct or not....
if it is not please give me a solution to fix both problems i am facing
Thanks in Advance
Vayanan
|
|
|
|
|
Most application of this ilk actually use ASIO not DirectSound, Skype for instance. Its a much better solution than DirectSound.
Also you may want to look into XAudio2 as its replacing DirectSound.
Not really a lot we can say without seeing your code. When it comes to audio there are SO SO many things that can go wrong, without seeing code its more or less impossible to help.
What audio format are you using? Does the client machine have the neccessary codecs to decode the audio bytes. If I remember correctly during my brief look at DirectSound using window handles was slightlf different than windows forms ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
public class RecordUtil
{
public IntPtr _IntPtr;
public RecordUtil(IntPtr iptr)
{
_IntPtr=iptr;
}
}
in main window use this--
{
IntPtr source = new WindowInteropHelper(this).Handle;
recorder = new RecordUtil(source);
}
|
|
|
|
|
Hi All,
There is a requirement in our VS 2008 WPF application to take the screen shot of a scrollable XAML window and save it in a pdf. The window includes numerous controls such as Textboxes, images, comboboxes, etc.
Currently we are able to capture whatever is visible on the screen. The parts of the scrollable window outside the visible screen is not captured.
Can anyone suggest a way to do this?
Thanks in Advance...
|
|
|
|
|
Can't you use the scrollable window data source as the data source for the pdf?
Cheers,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
If every control is nicely tucked into a panel or canvas, the layout control can be embedded into a FlowDocument control.
Look into the following components (I tried to have proper heirarchy of control embedding).
1)FlowDocumentReader.Document
2)FixedDocument
3)FixedPage
4)PageContent
5)Inside of the page content you would add a child WPF control (your controls you want screen captured).
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|