|
Actually, it's got something to do with RenderSize on the adorned element. I thought I had it figured out today when I overrode OnRender , and set the render size in there, but when I do something else (like drag, resize, or rotate), the RenderSize goes back to its original value, but then immediately reverts to it's set size (because I set it in OnRender ). Furthermore, the rotation code STILL uses the (wrong) render size values to set the center of the rotate transform.
I hate WPF. If you think it would be worth it, I could post my adorner code (but like I said before, there's a LOT of it).
".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
|
|
|
|
|
You usually just override the MeasureOverride and the ArrangeOverride methods. Those two methods have to return the correct sizes and arrange everything properly for the adorners to work right.
|
|
|
|
|
I have a requirement where I am using a datagrid and the number of columns will not be known until runtime. I found the following article and was able to get it working.
http://elegantcode.com/2010/03/08/silverlight-datagrid-populate-dynamic-columns-from-a-child-collection/
However this solution uses the XamlReader and creates a datatemplate in the code behind. I am not entirely happy with this solution. Is there another way that I can achieve the same result without using the XamlReader. Essentially im trying to achieve something like this
CellTemp.Append(String.Format("<TextBlock Text='{{Binding Periods[{0}].{1}}}'/>", index, propertyName)); but instead of using the XamlReader create this binding in in xaml.
modified 17-Dec-12 0:34am.
|
|
|
|
|
I'm researching control packages for WPF.
I'm considering Telerik, XCeed, and DevExpress.
As far as Telerik goes, I have used them before and I like them a lot. Good controls with excellent support.
Anyone used XCeed, or DevExpress?
Please don't suggest Infragistics. They flat out suck and I'll never use them again.
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
I'll be astonished if you can get a balanced response to that question, 1 lousy experience will ruin some ones opinion of a toolset. A good experience and deep knowledge will do the opposite.
We use Telerik and are very pleased to have changed from Infragistics.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Take a look at Mindscape. I use them a lot and am really impressed by them.
|
|
|
|
|
Thanks, they look nice. And their site says their controls are geared towards MVVM, which is nice
If it's not broken, fix it until it is
|
|
|
|
|
I can't praise them enough. The way I view it is, would I use this control if I had to pay for it myself? And I did.
|
|
|
|
|
Good, thanks! +5
If it's not broken, fix it until it is
|
|
|
|
|
High praise indeed.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have a DataTemplate which, when referenced, displays a Slider Bar. The setup of the slider is dependant on data passed to the Form from the calling class. The XAML for the config looks like this.
<pre lang="xml">
<Window.Resources>
<DataTemplate DataType="{x:Type ContentControl}" x:Key="TextBoxTemplate">
<TextBox Text="{Binding ElementName=MyWindow, Path=m_csValue}" Height="23"/>
</DataTemplate>
<DataTemplate DataType="{x:Type ContentControl}" x:Key="SliderTemplate">
<Slider Name="sli" Value="{Binding ElementName = MyWindow, Path=sli}" ValueChanged="OnSliderValueChanged" IsSnapToTickEnabled="True" Margin="5" />
</DataTemplate>
<Style TargetType="{x:Type ContentControl}" x:Key="DisplayValues">
<Setter Property="ContentTemplate" Value="{StaticResource TextBoxTemplate}" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=MyWindow, Path=eType}" Value="{x:Static local:eTagDisplay.Text}">
<Setter Property="ContentTemplate" Value="{StaticResource TextBoxTemplate}" />
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=MyWindow, Path=eType}" Value="{x:Static local:eTagDisplay.Slider}">
<Setter Property="ContentTemplate" Value="{StaticResource SliderTemplate}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid Width="267">
<StackPanel Margin="0,37,0,133" Height="123">
<TextBlock Height="23" Name="textBlock1" Text="TextBlock" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
<ContentControl Style="{StaticResource DisplayValues}" Margin="12,12,12,158" />
</Grid>
</pre>
In my Code Behind I set up the Max, Min, Tick Frequency and Value when the Form is created.
When the Slider bar is updated i find that the slider in the code behind is not bound to the slider on display, and so I'm not updating the value of the object I wish to update.
How can I ensure that the slider created in the XAML is bound to the slider in the code behind?
Regards
Tony
|
|
|
|
|
In my project I have this xaml code for my slider
<StatusBarItem Grid.Column="5" Padding="4,0,15,0">
<StackPanel x:Name="StatusBarSlider" Orientation="Horizontal">
<TextBlock x:Name="StatusBarItem"
Margin="0,1,0,1"
Foreground="{Binding Foreground,
ElementName=navigationPane}"
Padding="6,0,6,0"
Text="{Binding Value,
ConverterParameter=%,
Converter={StaticResource PercentageConverter},
ElementName=scaleSlider}" />
<RepeatButton Margin="1,0,1,0"
CommandTarget="{Binding ElementName=scaleSlider}"
ribbon:ScreenTipService.ScreenTipHeader="Zoom Out"
Style="{StaticResource {x:Static themes:SharedResourceKeys.StatusBarEmbeddedSliderDecreaseButtonBaseStyleKey}}" />
<Slider x:Name="scaleSlider"
Width="100"
VerticalAlignment="Center"
IsSnapToTickEnabled="True"
LargeChange="0.5"
Maximum="2.0"
Minimum="0.5"
ribbon:ScreenTipService.ScreenTipHeader="Zoom"
SmallChange="0.1"
TickFrequency="0.1"
Value="1.0" />
<RepeatButton Margin="1,0,1,0"
CommandTarget="{Binding ElementName=scaleSlider}"
ribbon:ScreenTipService.ScreenTipHeader="Zoom In"
Style="{StaticResource {x:Static themes:SharedResourceKeys.StatusBarEmbeddedSliderIncreaseButtonBaseStyleKey}}" />
</StackPanel>
</StatusBarItem>
My code Behind this is
ScaleTransform scaleTransform = new ScaleTransform();
Binding scaleXBinding = new Binding("Value");
scaleXBinding.Source = scaleSlider;
Binding scaleYBinding = new Binding("Value");
scaleYBinding.Source = scaleSlider;
BindingOperations.SetBinding(scaleTransform,
ScaleTransform.ScaleXProperty,
scaleXBinding);
BindingOperations.SetBinding(scaleTransform,
ScaleTransform.ScaleYProperty,
scaleYBinding);
and since I am scaling something being displayed inside a tab I use this
newTab.Content = Contact2;
Contact2.contentContainer.LayoutTransform = scaleTransform;
This binds the slider control to the contents of my contacts. Hope this helps.
|
|
|
|
|
Hi,
Thanks for your response, I've only just managed to pick this up.
I've looked at your code sample, many thanks.
The issue that I'm seeing is that using the "Name" declared for the Slider, I cannot use it in my CodeBehind without declaring an independent Slider object - which creates and new object and doesnt bind to the declared Slider in the XAML.
As the Slider is named and delcared in a the <Windows.Resources> section, and as part of a <DataTemplate>, do I need to reference by more than just the object name, e.g. would I need to call it something like someItem.sli as opposed to just sli?
Regards
Tony
|
|
|
|
|
How does one define IOleServiceProvider in a C# WPF application?
I was told that it was automatically recogized if I downloaded and installed the visual studio SDK. Is there some extra step I am missing?
http://i67.photobucket.com/albums/h292/Athono/programming/12-9-2012.png
IOleServiceProvider is from the Namespace Microsoft.TeamFoundation...
But I cannot declare this:
http://i67.photobucket.com/albums/h292/Athono/programming/12-9-2012-2.png
|
|
|
|
|
Are you trying to use this from a Visual Studio addin? That's what the VS SDK IOleServiceProvider is present in. Here's[^] an example using it.
|
|
|
|
|
<pre>
<HierarchicalDataTemplate DataType="{x:Type local:RegionViewModel}" ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal">
<Image Width="16" Height="16" Margin="3,0" Source="Images\Region.png" />
<TextBlock Text="{Binding RegionName}" />
</StackPanel>
</HierarchicalDataTemplate>
</pre>
Hi in the above data template whenever the type is a region, it says to use a particular icon.
But I want to chose icon based on the name of the region! Could you please let me know How I do this please?
Regards
RK
|
|
|
|
|
|
I have a combo box of lookup items. It's bound to an ObservableCollection of LookupEntity. The code-behind:
private ObservableCollection<LookupEntity> _EmployeeTypes;
public ObservableCollection<LookupEntity> EmployeeTypes
{
get { return _EmployeeTypes; }
set
{
if (_EmployeeTypes != value)
{
_EmployeeTypes = value;
RaisePropertyChanged("EmployeeTypes");
}
}
}
private LookupEntity _SelectedEmployeeType;
public LookupEntity SelectedEmployeeType
{
get { return _SelectedEmployeeType; }
set
{
if (_SelectedEmployeeType != value)
{
_SelectedEmployeeType = value;
RaisePropertyChanged("SelectedEmployeeType");
}
}
}
and
public override void RefreshView()
{
ViewHeaderText = "Employee - " + employee.FullName;
FirstName = employee.FirstName;
LastName = employee.LastName;
SelectedEmployeeType = employee.EmployeeType;
}
the XAML
<ComboBox Grid.Row="2"
Grid.Column="1"
Width="120"
HorizontalAlignment="Left"
ItemsSource="{Binding EmployeeTypes}"
SelectedItem="{Binding SelectedEmployeeType, Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Caption}">
<TextBlock.ToolTip>
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding Caption}"
FontWeight="Bold"/>
<TextBlock Text="{Binding Description}"/>
</StackPanel>
</TextBlock.ToolTip>
</TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
The combo item is not being selected. Anyone see what's wrong?
If it's not broken, fix it until it is
|
|
|
|
|
As a quick solution you can use SelectedIndex bind to an int property.
|
|
|
|
|
If you want your combobox to automatically select the employee's type, then you need to set the SelectedValue and SelectedValuePath properties as well, something like this :-
<ComboBox Grid.Row="2"
Grid.Column="1"
Width="120"
HorizontalAlignment="Left"
SelectedValue="{Binding Path=SelecetdEmployee.SelecetdEmployeeType.EmpoyeeTypeID}"
SelecetdValuePath="EmployeeTypeID"
ItemsSource="{Binding EmployeeTypes}"
SelectedItem="{Binding SelectedEmployeeType, Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Caption}">
<TextBlock.ToolTip>
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding Caption}"
FontWeight="Bold"/>
<TextBlock Text="{Binding Description}"/>
</StackPanel>
</TextBlock.ToolTip>
</TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
Just note that it is important to set the SelectedValue and SelectedValuePath properties before setting the ItemsSource property for the bindings to work properly.
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Thjat did it!
Many thanks
+5
If it's not broken, fix it until it is
|
|
|
|
|
That did it!
Many thanks
+5
If it's not broken, fix it until it is
|
|
|
|
|
Glad to help!
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
I want to use at command on hyper terminal by using Nokia x2 00 mobile . but i can't even type command
on hyper terminal. it might be possible that i made mistake while connection set up of mob to pc
can anybody tell me what are the steps to connect mobile to hyper terminal
|
|
|
|
|
You posted this question in the wrong forum....unless X2 uses Silverlight.
|
|
|
|