|
Excellent - if you hear an anguished squawk from this region it will be some IT flunky trying to dodge a job! thanks POH
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
No problems mate. Glad to help, and glad that I can shift the burden of care off your shoulders and dump it entirely on somebody else's.
|
|
|
|
|
who someone can help me.... i am doing a project about WPF ... but it can playing through the network ... who can help me? please!
|
|
|
|
|
Are you asking how you can make WPF applications communicate online? If you are, then you should look into using Windows Communication Foundation to accomplish this. Without any more details of what you are trying to accomplish I really can't offer any further assistance.
|
|
|
|
|
You need to use WPF with web services (or some other network protocol) to communicate over the network.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
How can we display our WPF user control into Visual Studio ToolBox under a particular tab? I understand that we can drag a DLL into toolbox or right-click and select 'choose items', but what if we want to deploy it to some other user? Now for example, as soon as I install Telerik controls - it creates a tab 'RadControls for WPF Q1 2010' and places all related controls inside that. Also, it places all controls into 'Assets' tab of Expression Blend. So how to do that with our user control? Any help/ website reference?
|
|
|
|
|
I would assume you build your controls into a control library (it is a project type) which will compile into a DLL and then you include that DLL same as any other. Blend I have no idea about.
Caveat - I have not used this so it is an assumption.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks for your reply. But my question is related to already compiled DLL using control library project type.
I am sorry if I couldn't make it clear, but I am not asking about including a DLL into the project. Once we have the DLL with us, how can we put into VS tool box under a particular tab - along with other default controls. Again, that should not be by dragging DLL into VS tool box. Because I need to deploy that DLL. So, I guess - I need to create some EXE, which will perform some specific action - and everything will be done. Just like in the case of Telerik and other professional WPF controls.
I need to get an idea about how to do that.
|
|
|
|
|
Yeah I felt the answer was way too simplistic.
I presume you are looking to create an installation package that will place the controls into a specified tab in VS.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yess!!
|
|
|
|
|
This is a follow-up to http://www.codeproject.com/Messages/3896423/Create-business-objects-from-XML.aspx[^] for which I didn't get any answer.
I'm experimenting with the idea of putting a static set of pre-defined business objects in a assembly (CRRT.Domain) by means of XAML. I have a ReportDefinitions.xaml file containing this:
<?xml version="1.0" encoding="utf-8" ?>
<ReportDefinition
xmlns="clr-namespace:CRRT.Domain;assembly=CRRT.Domain" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ReportDefinition.Parameters>
<TextInConditionReportParameter Name="Foo" />
<TextInConditionReportParameter Name="Bar" />
</ReportDefinition.Parameters>
</ReportDefinition>
Alas I get the following message: error MC3074: The tag 'ReportDefinition' does not exist in XML namespace 'clr-namespace:CRRT.Domain;assembly=CRRT.Domain'. Line 3 Position 3
What's wrong ? I checked that the classes do exist (in the proper namespace).
And by the way, should this eventually work, where would the result of the compilation go ? In a resource ? I stumbled upon this last question by accident btw, my initial plan was to incorporate the XAML as a text resource and load it using XamlReader. But Visual Studio spotted the .xaml extension and created a build step.
|
|
|
|
|
Okay, I found how to make it compile: remove the assembly directive from the namespace declaration:
<?xml version="1.0" encoding="utf-8" ?>
<ReportDefinition
xmlns="clr-namespace:CRRT.Domain;assembly=CRRT.Domain" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
...
This works:
<?xml version="1.0" encoding="utf-8" ?>
<ReportDefinition
xmlns="clr-namespace:CRRT.Domain" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
...
Now for my other question, where did the compilation product go ? And more importantly, how do I get at it ?
|
|
|
|
|
Hello all,
I have a series of "drawing" objects that hold some application specific data alongside an image. These objects (or at least their dates) are displayed in a listbox, when an item is selected it's image should be generated and displayed in another part of the grid. It does however not appear.
Here is some code:
<ListBox Grid.Column="0" ItemsSource="{Binding Source={StaticResource _Settings}, Path=ImageCollection.CurrentList}" Name="DrawingsList">
<ListBox.ItemTemplate>
<DataTemplate>
<Label Content="{Binding DateTime}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Image Grid.Column="1" Source="{Binding ElementName=DrawingsList, Path=SelectedItem.ActualImage}" Width="500" Height="500"/>
<!--<Label Grid.Column="1" Content="{Binding ElementName=DrawingsList, Path=SelectedItem.DateTime}"/> -->
And behind:
private System.Drawing.Image _ActualImage;
public System.Drawing.Image ActualImage
{
get
{
if (_ActualImage == null)
{
_ActualImage = GenerateImage();
}
return _ActualImage;
}
}
private System.Drawing.Image GenerateImage()
{
Bitmap bmp = new Bitmap(500, 500);
Graphics G = Graphics.FromImage(bmp);
G.Clear(Color.Red);
G.Save();
return bmp;
}
The commented label in the WPF that just displays the datetime property of the object works perfectly, so why doesn't the image ?
|
|
|
|
|
You can't use a System.Drawing.Image (which is GDI) as the Source of a WPF Image...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
can any one tell me how to change the color of a specific row in a listbox.
This is my xaml code.
<ListBox x:Name="lbDirectiveList" ItemsSource="{Binding}" SelectionChanged="LbDirectiveListSelectionChanged" MaxHeight="200" SelectionMode="Single" ScrollViewer.VerticalScrollBarVisibility="Auto">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="25" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Name="tbDirName" Text="{Binding Path=DirectiveName, Mode=TwoWay}" Grid.Column="0" FontWeight="Bold" MinWidth="200"/>
<TextBlock Text=" - " Grid.Column="1"/>
<TextBlock Grid.Column="2" Name="tbDirDesc" Text="{Binding Path=DirectiveDescription, Mode=TwoWay}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
List<ObservableCollection> list = new List<ObservableCollection>();
lbDirectiveList.ItemsSource = list;
when the user click on a checkbox(set color) in my application, it has to change the color of that selected item from the listbox, so how to do it..
|
|
|
|
|
Make a class that implements the INotifyPropertyChanged interface and use a collection of that class to bind to the listbox.
Create a property "color" in that class and throw the property changed event in the setter.
In the datatemplate of the listbox, bind the color property to the background of the item.
Make sure you have a reference to the selected item of the listbox.
When the checkbox is clicked, set the new color to the "color" property of the selected item.
Done.
That's how I would do it anyway...
|
|
|
|
|
We are writing a Silverlight 4.0 application which is actually a conversion of ASP to this application.
In one block of forms we have a datagrid at the top of the form. The remainder of the form (each grouped in sections) can only be visible when the datagrid's selected index is > 0.
So I know I have to bind the Visibility attribute and I know I have to use a BooleanToVisibilityConverter. What I'm not sure about is that I cannot seem to find just the right statement to get addressability to the datagrid and its' properties leastwise how to do the comparison.
I'm thinking I may have to write my own Converter to do the comparison logic but I still have to know how to define the datagrid as the object being passed to the converter.
Any help would be greatly appreciated!!!
Thanks much,
Michael
|
|
|
|
|
How about a IndexGreaterThanZeroToVisibilityConverter...
public class IndexGreaterThanZeroToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return ((int)value > 0) ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
(Note: ListBox used here for simplicity...works the same with a DataGrid)
<UserControl.Resources>
<local:IndexGreaterThanZeroToVisibilityConverter x:Key="IndexGreaterThanZeroToVisibilityConverter" />
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ListBox Name="listBox1" Grid.Row="0" Height="100" >
<ListBoxItem Content="Item 1" />
<ListBoxItem Content="Item 2" />
<ListBoxItem Content="Item 3" />
</ListBox>
<Grid Grid.Row="1" Visibility="{Binding ElementName=listBox1, Path=SelectedIndex, Mode=OneWay, Converter={StaticResource IndexGreaterThanZeroToVisibilityConverter}}" >
<TextBlock Text="This area is visibile!" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</Grid>
Mark Salsbery
Microsoft MVP - Visual C++
modified on Thursday, May 19, 2011 11:43 PM
|
|
|
|
|
Hey Mark!
You're okay for a C++ guy.
So I implemented my convert. check
Then I implemented the binding. check
Added the namespace for local. check
Then did local: my converter was visible and got it set with a key. check
Ran the solution and got this error at compile time.
Error 1 The tag 'DataGridVisibilityConverter' does not exist in XML namespace 'clr-namespace:CNRPGlobal.Converters; assembly=GlobalLibraryDefinitions'.
So how is it I can type local: and see my class library. Yet when I compile XAML cannot? I confirmed it is public.
Here is a snippet of what I've got:
xmlns:local="clr-namespace:CNRPGlobal.Converters; assembly=GlobalLibraryDefinitions"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<UserControl.Resources>
<ResourceDictionary x:Key="styles" Source="/GlobalLibraryDefinitions;component/Themes/Generic.xaml" />
<local:DataGridVisibilityConverter x:Key="VisibilityConverter" />
</UserControl.Resources>
And the consumption of the converter:
<cnrp:FormSection x:Name="designSection" Title="Design Section" DataContext="{Binding CurrentDesign, Mode=TwoWay}"
Visibility="{Binding ElementName=dgDesigns, Path=SelectedIndex, Mode=OneWay, Converter={StaticResource VisibilityConverter}}">
|
|
|
|
|
From what you've shown I can' see the problem.
Try a rebuild?
The namespace and assembly are correct and you have a reference to that assembly?
Also, "local" maybe not a good name for a namespace in a separate assembly
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark,
OMG -- the initial problem was I had a space between the namespace and the assembly name
But now I'm getting a runtime error
Local values are not allowed in resource dictionary with Source set [Line: 14 Position: 46]
It is pointing at my styles object!
modified on Friday, May 20, 2011 2:15 PM
|
|
|
|
|
Patterns are for programmers....the compiler doesn't know anything about MVVM.
If there's a class called DataGridVisibilityConverter in a namespace CNRPGlobal.Converters in an assembly GlobalLibraryDefinitions then it should work.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Try a USerControl from scratch, totally stripped down..does this compile??
<UserControl x:Class="SilverlightTester.ConverterTestPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:gspace="clr-namespace:CNRPGlobal.Converters;assembly=GlobalLibraryDefinitions"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<UserControl.Resources>
<gspace:DataGridVisibilityConverter x:Key="VisibilityConverter" />
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
</Grid>
</UserControl>
Mark Salsbery
Microsoft MVP - Visual C++
modified on Friday, May 20, 2011 2:25 PM
|
|
|
|
|
got past the compile issue. It was the space just before assembly:!!!
Now I just have to figure out my runtime issues with the resource dictionary.
It doesn't like having that resource along with a ResourceDictionary entry! WTF???
|
|
|
|
|
Hmm CodeProject editor must have added the space - there's no space in my code here!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|