Xamarin Mac NSScrollView with dynamic content
Solution
For everyone having the same problem, here is a solution i found.
It was coded with Swift, but implementing it in C# is easy.
android data binding with a custom view
In your Custom View, inflate layout however you normally would and provide a setter for the attribute you want to set:
private MyCustomViewBinding mBinding;
public MyCustomView(...) {
...
LayoutInflater inflater = (LayoutInflater)
context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mBinding = MyCustomViewBinding.inflate(inflater);
}
public void setMyViewModel(MyViewModelObject obj) {
mBinding.setMyViewModel(obj);
}
Then in the layout you use it in:
<layout xmlns...>
<data>
<variable
name="myViewModel"
type="com.mypath.MyViewModelObject" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.mypath.MyCustomView
android:id="@+id/my_view"
app:myViewModel="@{myViewModel}"
android:layout_width="match_parent"
android:layout_height="40dp"/>
</LinearLayout>
</layout>
In the above, an automatic binding attribute is created for app:myViewModel because there is a setter with the name setMyViewModel.
Dynamically change an image in a Crystal Report at runtime
At work we do this by pushing the image(s) into the report as fields of a datatable. It's not pretty, but it gets the job done. Of course, this solution requires that you push data into the reports via a DataSet. I've always felt this was a hack at best. I really wish that image parameters were a possibility with CR.
Edit: It's worth noting, if you are binding your crystal report to plain old objects you want to expose a byte[] property for the report to treat that as an image.
.NET Core 3.0: Razor views don't automatically recompile on change
OK it looks like it's not supported yet :(
Runtime compilation removed As a consequence of cleaning up the
ASP.NET Core shared framework to not depend on Roslyn, support for
runtime compilation of pages and views has also been removed in this
preview release. Instead compilation of pages and views is performed
at build time. In a future preview update we will provide a NuGet
packages for optionally enabling runtime compilation support in an
app.
You can read more about the issue here https://github.com/aspnet/Announcements/issues/343
Applications that require runtime compilation or re-compilation of Razor files should:
- Add a reference to the
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
package. It'll be available as part of the 3.0.0-preview3 release. - Update the application's
ConfigureServices
to include a call toAddMvcRazorRuntimeCompilation
:
How to use Auto Layout to move other views when a view is hidden?
It is possible, but you'll have to do a little extra work. There are a couple conceptual things to get out of the way first:
- Hidden views, even though they don't draw, still participate in Auto Layout and usually retain their frames, leaving other related views in their places.
- When removing a view from its superview, all related constraints are also removed from that view hierarchy.
In your case, this likely means:
- If you set your left view to be hidden, the labels stay in place, since that left view is still taking up space (even though it's not visible).
- If you remove your left view, your labels will probably be left ambiguously constrained, since you no longer have constraints for your labels' left edges.
What you need to do is judiciously over-constrain your labels. Leave your existing constraints (10pts space to the other view) alone, but add another constraint: make your labels' left edges 10pts away from their superview's left edge with a non-required priority (the default high priority will probably work well).
Then, when you want them to move left, remove the left view altogether. The mandatory 10pt constraint to the left view will disappear along with the view it relates to, and you'll be left with just a high-priority constraint that the labels be 10pts away from their superview. On the next layout pass, this should cause them to expand left until they fill the width of the superview but for your spacing around the edges.
One important caveat: if you ever want your left view back in the picture, not only do you have to add it back into the view hierarchy, but you also have to reestablish all its constraints at the same time. This means you need a way to put your 10pt spacing constraint between the view and its labels back whenever that view is shown again.
Context dependable dynamic context menus in VS Code TreeView?
The vscode.TreevItem
has a property contextValue
, assign this a string and use this in the when
clause of the menu item
"when": "view == myGitFlow && viewItem == current"
"when": "view == myGitFlow && viewItem != current"
Related Topics
What Is Ruby (1.8.7) Analog to Sorteddictionary in C#/.Net
Is Idependencyresolver an Anti-Pattern
C# Call C++ Dll Passing Pointer-To-Pointer Argument
Why Must C# Operator Overloads Be Static
Download a File from Azure Devops Server Writes Wrong Data to The File
Decrypt String in C# That Was Encrypted with PHP Openssl_Encrypt
How to Add a Reference to an Unmanaged C++ Project Called by a C# Project
Creating Safe SQL Statements as Strings
Convert JavaScript Regex to C#
Entity Framework 4.1 Inverseproperty Attribute and Foreignkey
SQL Server Blocked Access to Procedure 'Sys.Sp_Oacreate' of Component 'Ole Automation Procedures'
C# Dllimport with C++ Boolean Function Not Returning Correctly
How to Hook into Hardware Keyboard Events at an Application Level
Navigation Property Without Declaring Foreign Key
Non-Virtual Interface Design Pattern in C#/C++
Why Does a Float Variable Stop Incrementing at 16777216 in C#