|
I took your scenario and binded by creating the dependency property, for me everything works. Once the mouse is over the combo box and combobox has the focus , scrolling works fine with the mouse. you can only post a sample so that actual issue can be observed
<ComboBox x:Name="cboDistrict" IsSynchronizedWithCurrentItem="True"
Grid.Column="1" Grid.Row="0" Style="{DynamicResource BaseComboBox}"
ItemsSource="{Binding Path=AllDistricts, Mode=Default}"
SelectedItem="{Binding Path=BodyTextDistrict, Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding }"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
Private Property AllDistricts() As ObservableCollection(Of String)
Get
Return DirectCast(GetValue(AllDistrictsProperty), ObservableCollection(Of String))
End Get
Set(ByVal value As ObservableCollection(Of String))
SetValue(AllDistrictsProperty, value)
End Set
End Property
Public Shared AllDistrictsProperty As DependencyProperty = _
DependencyProperty.Register("AllDistricts", GetType(ObservableCollection(Of String)), _
GetType(NameView), New UIPropertyMetadata(New ObservableCollection(Of String)))
Public Property BodyTextDistrict() As String
Get
Return Convert.ToString(GetValue(BodyTextDistrictProperty))
End Get
Set(ByVal value As String)
SetValue(BodyTextDistrictProperty, value)
End Set
End Property
Public Shared BodyTextDistrictProperty As DependencyProperty = _
DependencyProperty.Register("BodyTextDistrict", GetType(String), _
GetType(NameView), New UIPropertyMetadata(String.Empty))
|
|
|
|
|
I don't know what it means. It's XAMLParseException :
Cannot convert the value in attribute 'Style' to object of type 'System.Windows.Style'. Specified element is already the logical child of another element. Disconnect it first. Error at object 'buttonPushPin' in markup file 'CometWPF2;component/controlcrm.xaml' Line 42 Position 23.
Here's the offending code:
<ToggleButton Style="{DynamicResource UDPPushPinButton}" Name="buttonPushPin"
Width="26" Height="23" Margin="0,0,19,0" HorizontalAlignment="Right" VerticalAlignment="Top"
BorderThickness="0" Background="Transparent" BorderBrush="Transparent"
ToolTip="Pin this tab" />
More Info: This button is in all of the tabs in a tab control, and this error occurs when more than one tab (with the button) is added to the tab control. The tabs all contain a UserControl that has the button it.
"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 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
modified on Wednesday, April 15, 2009 9:17 AM
|
|
|
|
|
Set x:Shared="false" for this. This creates a unique instance instead of a static instance.
"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
|
|
|
|
|
No workee. I also tried putting that on the style itself.
"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 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Do you want to send it to me and I'll have a look? You've got my email address.
"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
|
|
|
|
|
Let me see if I can cut it down to a minimal project.
"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 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I have a very slimmed down app that duplicates the behavior. I'll have to wait until I get home tonight to send it to you.
"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 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Well, I got it not to crash by doing this:
<ImageBrush x:Key="PinUpBrush" ImageSource="/WpfTest;component/Icons/blue_pushpin.png" />
<ImageBrush x:Key="PinDownBrush" ImageSource="/WpfTest;component/Icons/red_pushpin.png" />
<Style TargetType="ToggleButton" x:Key="UDPPushPinButton2" >
<Setter Property="Button.Background" Value="{StaticResource PinUpBrush}" />
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Button.Background" Value="{StaticResource PinDownBrush}" />
</Trigger>
</Style.Triggers>
</Style>
Now all I gotta do is figure out how to make the border not show up when I click it....
"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 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: Now all I gotta do is figure out how to make the border not show up when I click it....
That will be in the control template. Here's the default template ripped from
a control on Vista:
<Style x:Key="ButtonFocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="2" SnapsToDevicePixels="true"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#F3F3F3" Offset="0"/>
<GradientStop Color="#EBEBEB" Offset="0.5"/>
<GradientStop Color="#DDDDDD" Offset="0.5"/>
<GradientStop Color="#CDCDCD" Offset="1"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF707070"/>
<Style x:Key="ToggleButtonStyle1" TargetType="{x:Type ToggleButton}">
<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Microsoft_Windows_Themes:ButtonChrome x:Name="Chrome" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" RenderDefaulted="{TemplateBinding Button.IsDefaulted}" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True"/>
</Microsoft_Windows_Themes:ButtonChrome>
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter Property="RenderDefaulted" TargetName="Chrome" Value="true"/>
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter Property="RenderPressed" TargetName="Chrome" Value="true"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="#ADADAD"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am using clr 3.5 for asp 2008. My aim is to enter daily task and to save it in that day's month view. WebMonthView control seems not to have any click events. The data i am adding for a particular date should be visible in that day in MonthView Control. Any Idea ? Pls help me urgent!!!
Gomathi R
|
|
|
|
|
Wrong message board!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Then, this question comes under which board? It is silver light control only na?
Gomathi R
|
|
|
|
|
ASP.NET I would guess. I see no WebMonthView control in Silverlight
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi everybody.
How can I modify a XML file into Isolated Storage with silverlight 2 ? (without using LINQ)
For example : assume we have a XML file like this :
<CodeColorizer>
<Settings>
<IsVB>False</IsVB>
<IsStriped>False</IsStriped>
</Settings>
</CodeColorizer>
Now , I wanna change the content of IsVB to True .
How can I do it ?
By the way : I've already searched in Google, unfortunately I couldn't find anything special
Thank in advance.
|
|
|
|
|
|
I've checked it out. We couldn't modify a XML file with the link.
Braulio Dez wrote: Just a curiosity, why you don't want to use LINQ To XML? works pretty well and it's pretty easy to use.
Because using LINQ in SL2 causes we force to add some DLLs to our projects.
It means we will have a SL2 Application with a larger volume.
|
|
|
|
|
Mmm...
Haven't used XMLWriter on SL, but in theory you can generate a file using XML Writer on SL, mmm... I guess what you want is just modify the file without rewriting it isn't it?
More about XMLWriter and SL
https://silverlight.net/forums/t/6655.aspx[^]
If you just want to modify a single setting, you try to open it as a text file and then just check with a regex where the nodes are (a bit crappy stuff but should work).
Another curiosity, how much extra weight did ad the LINQ to your XAP?
/// -------------------------
Braulio Díez
DBSchemaEditor.com
Free Silverlight based DB Schema Modeling Tool
/// -------------------------
|
|
|
|
|
Braulio Dez wrote: If you just want to modify a single setting, you try to open it as a text file and then just check with a regex where the nodes are (a bit crappy stuff but should work).
Yeah, I think ,I have to do it.
Braulio Dez wrote: Another curiosity, how much extra weight did ad the LINQ to your XAP?
If we using LINQ , we have to add some DLLs beside the SL2 project.
|
|
|
|
|
In my case (dbschemaeditor.com) I'm using LINQ To XML, and I have developed a desktop like app and the release mode of the XAP is just about 3OO kbytes (in your case the DLL's that you will be added will be compressed by the SL and added to the XAP), I could shorten it by chopping it into several XAP, and load features on demand, and use caching on the isolated storage.
What's the size of your XAP? Have you checked on Release mode?
Cheers
Braulio
/// -------------------------
Braulio Díez
DBSchemaEditor.com
Free Silverlight based DB Schema Modeling Tool
/// -------------------------
|
|
|
|
|
Braulio Dez wrote: What's the size of your XAP? Have you checked on Release mode?
About 1.2 MB
|
|
|
|
|
Ouch !
Mmmm... Or it's a hugue project, or there's something wrong going there.
My solution is composed of 12 projects and more than 100 classes, maybe not a big project but at least medium sized.
Have you checked what does take that hugue size? Are you embedding images or any expensive resource? Pure code shouldn't take that much.
If you want to analyze how longs takes each part of the XAP, you can rename the file top ZIP and then unpack it and check sizes of DLL's, resource, and folders.
Cheers
Braulio
/// -------------------------
Braulio Díez
DBSchemaEditor.com
Free Silverlight based DB Schema Modeling Tool
/// -------------------------
|
|
|
|
|
|
I'm trying to set up a toggle button that changes the image when the button is checked/no checked. Consider the following XAML:
<style targettype="ToggleButton" x:key="PushPinButton" mode="hold" xmlns:x="#unknown" /> <Setter Property="Template" />
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Image Source="/CometWPF2;component/Icons/blue_pushpin.png" Margin="0"
VerticalAlignment="Center" HorizontalAlignment="Center" />
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Template" />
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Image Source="/CometWPF2;component/Icons/red_pushpin.png" Margin="0"
VerticalAlignment="Center" HorizontalAlignment="Center" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
The IDE is telling me that the Setter.Value attachable property doesn't exist. I have no idea if I'm doing this anywhere close to correctly...
I did this and it works:
<Image Source="/CometWPF2;component/Icons/blue_pushpin.png" x:Key="PinUp" />
<Image Source="/CometWPF2;component/Icons/red_pushpin.png" x:Key="PinDown" />
<Style TargetType="ToggleButton" x:Key="UDPPushPinButton">
<Setter Property="Content" Value="{DynamicResource PinUp}" />
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Content" Value="{DynamicResource PinDown}" />
</Trigger>
</Style.Triggers>
</Style>
Now I want to get rid of the border that shows up (and remains displayed) when it's clicked.
"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 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
modified on Tuesday, April 14, 2009 5:11 PM
|
|
|
|
|
The Setter tag is closed. <Setter Property="Template" /> should be <Setter Property="Template" > . The Style tag too.
XAML is well-formed XML.
Eslam Afifi
|
|
|
|
|
Add:
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
So it will be something like:
<Image Source="/CometWPF2;component/Icons/blue_pushpin.png" x:Key="PinUp" />
<Image Source="/CometWPF2;component/Icons/red_pushpin.png" x:Key="PinDown" />
<Style TargetType="ToggleButton" x:Key="UDPPushPinButton">
<Setter Property="Content" Value="{DynamicResource PinUp}" />
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Content" Value="{DynamicResource PinDown}" />
</Trigger>
</Style.Triggers>
</Style>
|
|
|
|